|
OpenNMS API 1.1.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opennms.netmgt.config.PollerConfigFactory
This is the singleton class used to load the configuration for the OpenNMS Poller service from the poller-configuration xml file. A mapping of the configured URLs to the iplist they contain is built at init() time so as to avoid numerous file reads. Note:Users of this class should make sure the init() is called before calling any other method to ensure the config is loaded before accessing other convenience methods.
Field Summary | |
private PollerConfiguration |
m_config
The config class loaded from the config file |
private static boolean |
m_loaded
This member is set to true if the configuration file has been loaded. |
private static java.lang.String |
m_localServer
The name of the local OpenNMS server |
private java.util.Map |
m_pkgIpMap
A mapping of the configured package to a list of IPs selected via filter rules, so as to avoid repetetive database access. |
private static PollerConfigFactory |
m_singleton
The singleton instance of this factory |
private java.util.Map |
m_urlIPMap
A mapping of the configured URLs to a list of the specific IPs configured in each - so as to avoid file reads |
private static boolean |
m_verifyServer
A boolean flag to indicate If a filter rule agaist the local OpenNMS server has to be used. |
Constructor Summary | |
private |
PollerConfigFactory(java.lang.String configFile)
Private constructor |
Method Summary | |
private void |
createPackageIpListMap()
This method is used to establish package agaist iplist mapping, with which, the iplist is selected per package via the configured filter rules from the database. |
private void |
createUrlIpMap()
Go through the poller configuration and build a mapping of each configured URL to a list of IPs configured in that URL - done at init() time so that repeated file reads can be avoided |
PollerConfiguration |
getConfiguration()
Return the poller configuration object. |
java.lang.String |
getCriticalService()
This method returns the configured critical service name. |
Package |
getFirstPackageMatch(java.lang.String ipaddr)
Returns the first package that the ip belongs to, null if none. |
static PollerConfigFactory |
getInstance()
Return the singleton instance of this factory. |
java.util.List |
getRRAList(Package pkg)
Retrieves configured list of RoundRobin Archive statements. |
int |
getStep(Package pkg)
Retrieves configured RRD step size. |
boolean |
getXmlrpc()
This method returns the boolean flag xmlrpc to indicate if notification to external xmlrpc server is needed. |
static void |
init()
Load the config from the default config file and create the singleton instance of this factory. |
boolean |
interfaceInPackage(java.lang.String iface,
Package pkg)
This method is used to determine if the named interface is included in the passed package definition. |
private boolean |
interfaceInUrl(java.lang.String addr,
java.lang.String url)
This method is used to determine if the named interface is included in the passed package's url includes. |
boolean |
isPolled(java.lang.String ipaddr)
Returns true if the ip is part of atleast one package. |
boolean |
isPolled(java.lang.String svcName,
Package pkg)
Returns true if this package has the service enabled and if there is a monitor for this service. |
boolean |
isPolled(java.lang.String ipaddr,
java.lang.String svcName)
Returns true if the ip is part of atleast one package and if this package has the service enabled and if there is a monitor for this service. |
boolean |
nodeOutageProcessingEnabled()
Returns true if node outage processing is enabled. |
boolean |
pollAllIfNoCriticalServiceDefined()
This method returns the configured value of the 'pollAllIfNoCriticalServiceDefined' flag. |
void |
rebuildPackageIpListMap()
This method is used to rebuild the package agaist iplist mapping when needed. |
static void |
reload()
Reload the config from the default config file |
boolean |
serviceInPackageAndEnabled(java.lang.String svcName,
Package pkg)
Returns true if the service is part of the package and the status of the service is set to "on". |
boolean |
serviceMonitored(java.lang.String svcName)
Returns true if the service has a monitor configured, false otherwise. |
boolean |
serviceUnresponsiveEnabled()
Returns true if serviceUnresponsive behavior is enabled. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static PollerConfigFactory m_singleton
private static boolean m_loaded
private PollerConfiguration m_config
private java.util.Map m_urlIPMap
private java.util.Map m_pkgIpMap
private static boolean m_verifyServer
private static java.lang.String m_localServer
Constructor Detail |
private PollerConfigFactory(java.lang.String configFile) throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
java.io.IOException
- Thrown if the specified config
file cannot be read
org.exolab.castor.xml.MarshalException
- Thrown if the
file does not conform to the schema.
org.exolab.castor.xml.ValidationException
- Thrown if
the contents do not match the required schema.Method Detail |
private void createUrlIpMap()
public static void init() throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
java.io.IOException
- Thrown if the specified config
file cannot be read
org.exolab.castor.xml.MarshalException
- Thrown if the
file does not conform to the schema.
org.exolab.castor.xml.ValidationException
- Thrown if
the contents do not match the required schema.public static void reload() throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
java.io.IOException
- Thrown if the specified config
file cannot be read/loaded
org.exolab.castor.xml.MarshalException
- Thrown if the
file does not conform to the schema.
org.exolab.castor.xml.ValidationException
- Thrown if
the contents do not match the required schema.public static PollerConfigFactory getInstance()
java.lang.IllegalStateException
- Thrown if the factory
has not yet been initialized.public PollerConfiguration getConfiguration()
private boolean interfaceInUrl(java.lang.String addr, java.lang.String url)
The file URL is read and each entry in this file checked. Each line in the URL file can be one of -# or or # Lines starting with a '#' are ignored and so are characters after a ' #' in a line.
addr
- The interface to test against the package's URLurl
- The url file to read
public boolean getXmlrpc()
public java.lang.String getCriticalService()
public boolean pollAllIfNoCriticalServiceDefined()
public boolean nodeOutageProcessingEnabled()
public boolean serviceUnresponsiveEnabled()
private void createPackageIpListMap()
public void rebuildPackageIpListMap()
public boolean interfaceInPackage(java.lang.String iface, Package pkg)
iface
- The interface to test against the package.pkg
- The package to check for the inclusion of
the interface.
public boolean serviceInPackageAndEnabled(java.lang.String svcName, Package pkg)
svcName
- The service name to lookup.pkg
- The package to lookup up service.public boolean serviceMonitored(java.lang.String svcName)
svcName
- The service name to lookup.public Package getFirstPackageMatch(java.lang.String ipaddr)
ipaddr
- the interface to check
public boolean isPolled(java.lang.String ipaddr)
ipaddr
- the interface to check
public boolean isPolled(java.lang.String svcName, Package pkg)
svcName
- the service to checkpkg
- the package to check
public boolean isPolled(java.lang.String ipaddr, java.lang.String svcName)
ipaddr
- the interface to checksvcName
- the service to check
public int getStep(Package pkg)
pkg
- Name of the data collection
public java.util.List getRRAList(Package pkg)
pkg
- Name of the data collection
|
OpenNMS API 1.1.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |