org.opennms.netmgt.config
Class PollerConfigManager

java.lang.Object
  extended by org.opennms.netmgt.config.PollerConfigManager
All Implemented Interfaces:
PollerConfig
Direct Known Subclasses:
PollerConfigFactory

public abstract class PollerConfigManager
extends Object
implements PollerConfig

Author:
Mathew Brozowski, David Hustace

Constructor Summary
PollerConfigManager(Reader reader, String localServer, boolean verifyServer)
           
 
Method Summary
 void addMonitor(String svcName, String className)
           
 void addPackage(Package pkg)
           
 Enumeration<Monitor> enumerateMonitor()
           
 Enumeration<Package> enumeratePackage()
           
 List<String> getAllPackageMatches(String ipaddr)
          Returns a list of package names that the ip belongs to, null if none.
 PollerConfiguration getConfiguration()
          Return the poller configuration object.
 String getCriticalService()
          This method returns the configured critical service name.
 Package getFirstLocalPackageMatch(String ipaddr)
          Returns the first package that the ip belongs to that is not marked as remote, null if none.
 Package getFirstPackageMatch(String ipaddr)
          Returns the first package that the ip belongs to, null if none.
 List<String> getIpList(Package pkg)
          Determine the list of IPs the filter rule for this package allows
 String getNextOutageIdSql()
           
 Package getPackage(String name)
           
 List<String> getRRAList(Package pkg)
          Retrieves configured list of RoundRobin Archive statements.
 Service getServiceInPackage(String svcName, Package pkg)
          Return the Service object with the given name from the give Package.
 ServiceMonitor getServiceMonitor(String svcName)
           
 Collection<ServiceMonitorLocator> getServiceMonitorLocators(DistributionContext context)
           
 Map<String,ServiceMonitor> getServiceMonitors()
           
 ServiceSelector getServiceSelectorForPackage(Package pkg)
           
 int getStep(Package pkg)
          Retrieves configured RRD step size.
 int getThreads()
           
 boolean getXmlrpc()
          This method returns the boolean flag xmlrpc to indicate if notification to external xmlrpc server is needed.
 Iterable<String> includeURLs(Package pkg)
           
 boolean interfaceInPackage(String iface, Package pkg)
          This method is used to determine if the named interface is included in the passed package definition.
 boolean isPolled(String ipaddr)
          Returns true if the ip is part of atleast one package.
 boolean isPolled(String svcName, Package pkg)
          Returns true if this package has the service enabled and if there is a monitor for this service.
 boolean isPolled(String ipaddr, 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 isPolledLocally(String ipaddr)
          Returns true if the ip is part of at least one package that is NOT marked as remote Note: Evaluation of the interface against a package filter will only work if the IP is already in the database.
 boolean isPolledLocally(String ipaddr, String svcName)
          Returns true if the ip is part of at least one package and if this package has the service enabled and if there is a monitor for this service and the package is NOT marked as remote Note: Evaluation of the interface against a package filter will only work if the IP is already in the database.
 Iterable<Monitor> monitors()
           
 boolean nodeOutageProcessingEnabled()
          Returns true if node outage processing is enabled.
 Iterable<Package> packages()
           
 Iterable<Parameter> parameters(Service svc)
           
 boolean pathOutageEnabled()
          This method returns the boolean flag pathOutageEnabled to indicate if path outage processing on nodeDown events 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.
 void releaseAllServiceMonitors()
           
protected  void reloadXML(Reader reader)
           
 void save()
          Saves the current in-memory configuration to disk and reloads
 void saveResponseTimeData(String locationMonitor, OnmsMonitoredService monSvc, double responseTime, Package pkg)
           
protected abstract  void saveXml(String xml)
           
 boolean serviceInPackageAndEnabled(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(String svcName)
          Returns true if the service has a monitor configured, false otherwise.
 Iterable<Service> services(Package pkg)
           
 boolean serviceUnresponsiveEnabled()
          Returns true if serviceUnresponsive behavior is enabled.
abstract  void update()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PollerConfigManager

public PollerConfigManager(Reader reader,
                           String localServer,
                           boolean verifyServer)
                    throws org.exolab.castor.xml.MarshalException,
                           org.exolab.castor.xml.ValidationException,
                           IOException
Parameters:
reader -
localServer -
verifyServer -
Throws:
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
IOException
Method Detail

update

public abstract void update()
                     throws IOException,
                            org.exolab.castor.xml.MarshalException,
                            org.exolab.castor.xml.ValidationException
Specified by:
update in interface PollerConfig
Throws:
IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException

saveXml

protected abstract void saveXml(String xml)
                         throws IOException
Throws:
IOException

reloadXML

protected void reloadXML(Reader reader)
                  throws org.exolab.castor.xml.MarshalException,
                         org.exolab.castor.xml.ValidationException,
                         IOException
Throws:
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
IOException

save

public void save()
          throws org.exolab.castor.xml.MarshalException,
                 IOException,
                 org.exolab.castor.xml.ValidationException
Saves the current in-memory configuration to disk and reloads

Specified by:
save in interface PollerConfig
Throws:
org.exolab.castor.xml.MarshalException
IOException
org.exolab.castor.xml.ValidationException

getConfiguration

public PollerConfiguration getConfiguration()
Return the poller configuration object.

Specified by:
getConfiguration in interface PollerConfig

getPackage

public Package getPackage(String name)
Specified by:
getPackage in interface PollerConfig

getServiceSelectorForPackage

public ServiceSelector getServiceSelectorForPackage(Package pkg)
Specified by:
getServiceSelectorForPackage in interface PollerConfig

addPackage

public void addPackage(Package pkg)
Specified by:
addPackage in interface PollerConfig

addMonitor

public void addMonitor(String svcName,
                       String className)
Specified by:
addMonitor in interface PollerConfig

getXmlrpc

public boolean getXmlrpc()
This method returns the boolean flag xmlrpc to indicate if notification to external xmlrpc server is needed.

Specified by:
getXmlrpc in interface PollerConfig
Returns:
true if need to notify an external xmlrpc server

pathOutageEnabled

public boolean pathOutageEnabled()
This method returns the boolean flag pathOutageEnabled to indicate if path outage processing on nodeDown events is enabled

Specified by:
pathOutageEnabled in interface PollerConfig
Returns:
true if pathOutageEnabled

getCriticalService

public String getCriticalService()
This method returns the configured critical service name.

Specified by:
getCriticalService in interface PollerConfig
Returns:
the name of the configured critical service, or null if none is present

pollAllIfNoCriticalServiceDefined

public boolean pollAllIfNoCriticalServiceDefined()
This method returns the configured value of the 'pollAllIfNoCriticalServiceDefined' flag. A value of true causes the poller's node outage code to poll all the services on an interface if a status change has occurred and there is no critical service defined on the interface. A value of false causes the poller's node outage code to not poll all the services on an interface in this situation.

Specified by:
pollAllIfNoCriticalServiceDefined in interface PollerConfig
Returns:
true or false based on configured value

nodeOutageProcessingEnabled

public boolean nodeOutageProcessingEnabled()
Returns true if node outage processing is enabled.

Specified by:
nodeOutageProcessingEnabled in interface PollerConfig

serviceUnresponsiveEnabled

public boolean serviceUnresponsiveEnabled()
Returns true if serviceUnresponsive behavior is enabled. If enabled a serviceUnresponsive event is generated for TCP-based services if the service monitor is able to connect to the designated port but times out before receiving the expected response. If disabled, an outage will be generated in this scenario.

Specified by:
serviceUnresponsiveEnabled in interface PollerConfig

getIpList

public List<String> getIpList(Package pkg)
Description copied from interface: PollerConfig
Determine the list of IPs the filter rule for this package allows

Specified by:
getIpList in interface PollerConfig
Returns:

rebuildPackageIpListMap

public void rebuildPackageIpListMap()
This method is used to rebuild the package agaist iplist mapping when needed. When a node gained service event occurs, poller has to determine which package the ip/service combination is in, but if the interface is a newly added one, the package iplist should be rebuilt so that poller could know which package this ip/service pair is in.

Specified by:
rebuildPackageIpListMap in interface PollerConfig

interfaceInPackage

public boolean interfaceInPackage(String iface,
                                  Package pkg)
This method is used to determine if the named interface is included in the passed package definition. If the interface belongs to the package then a value of true is returned. If the interface does not belong to the package a false value is returned. Note: Evaluation of the interface against a package filter will only work if the IP is already in the database.

Specified by:
interfaceInPackage in interface PollerConfig
Parameters:
iface - The interface to test against the package.
pkg - The package to check for the inclusion of the interface.
Returns:
True if the interface is included in the package, false otherwise.

serviceInPackageAndEnabled

public boolean serviceInPackageAndEnabled(String svcName,
                                          Package pkg)
Returns true if the service is part of the package and the status of the service is set to "on". Returns false if the service is not in the package or it is but the status of the service is set to "off".

Specified by:
serviceInPackageAndEnabled in interface PollerConfig
Parameters:
svcName - The service name to lookup.
pkg - The package to lookup up service.

getServiceInPackage

public Service getServiceInPackage(String svcName,
                                   Package pkg)
Return the Service object with the given name from the give Package.

Specified by:
getServiceInPackage in interface PollerConfig
Parameters:
svcName - the service name to lookup
pkg - the packe to lookup the the service in
Returns:
the Service object from the package with the give name, null if its not in the pkg

serviceMonitored

public boolean serviceMonitored(String svcName)
Returns true if the service has a monitor configured, false otherwise.

Specified by:
serviceMonitored in interface PollerConfig
Parameters:
svcName - The service name to lookup.

getFirstPackageMatch

public Package getFirstPackageMatch(String ipaddr)
Returns the first package that the ip belongs to, null if none. Note: Evaluation of the interface against a package filter will only work if the IP is alrady in the database.

Specified by:
getFirstPackageMatch in interface PollerConfig
Parameters:
ipaddr - the interface to check
Returns:
the first package that the ip belongs to, null if none

getFirstLocalPackageMatch

public Package getFirstLocalPackageMatch(String ipaddr)
Description copied from interface: PollerConfig
Returns the first package that the ip belongs to that is not marked as remote, null if none. Note: Evaluation of the interface against a package filter will only work if the IP is already in the database.

Specified by:
getFirstLocalPackageMatch in interface PollerConfig
Parameters:
ipaddr - the interface to check
Returns:
the first package that the ip belongs to, null if none

getAllPackageMatches

public List<String> getAllPackageMatches(String ipaddr)
Returns a list of package names that the ip belongs to, null if none. Note: Evaluation of the interface against a package filter will only work if the IP is alrady in the database.

Specified by:
getAllPackageMatches in interface PollerConfig
Parameters:
ipaddr - the interface to check
Returns:
a list of package names that the ip belongs to, null if none

isPolled

public boolean isPolled(String ipaddr)
Returns true if the ip is part of atleast one package. Note: Evaluation of the interface against a package filter will only work if the IP is alrady in the database.

Specified by:
isPolled in interface PollerConfig
Parameters:
ipaddr - the interface to check
Returns:
true if the ip is part of atleast one package, false otherwise

isPolledLocally

public boolean isPolledLocally(String ipaddr)
Description copied from interface: PollerConfig
Returns true if the ip is part of at least one package that is NOT marked as remote Note: Evaluation of the interface against a package filter will only work if the IP is already in the database.

Specified by:
isPolledLocally in interface PollerConfig
Parameters:
ipaddr - the interface to check
Returns:
true if the ip is part of at least one package, false otherwise

isPolled

public boolean isPolled(String svcName,
                        Package pkg)
Returns true if this package has the service enabled and if there is a monitor for this service. Note: Evaluation of the interface against a package filter will only work if the IP is alrady in the database.

Specified by:
isPolled in interface PollerConfig
Parameters:
svcName - the service to check
pkg - the package to check
Returns:
true if the ip is part of atleast one package and the service is enabled in this package and monitored, false otherwise

isPolled

public boolean isPolled(String ipaddr,
                        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. Note: Evaluation of the interface against a package filter will only work if the IP is alrady in the database.

Specified by:
isPolled in interface PollerConfig
Parameters:
ipaddr - the interface to check
svcName - the service to check
Returns:
true if the ip is part of atleast one package and the service is enabled in this package and monitored, false otherwise

isPolledLocally

public boolean isPolledLocally(String ipaddr,
                               String svcName)
Description copied from interface: PollerConfig
Returns true if the ip is part of at least one package and if this package has the service enabled and if there is a monitor for this service and the package is NOT marked as remote Note: Evaluation of the interface against a package filter will only work if the IP is already in the database.

Specified by:
isPolledLocally in interface PollerConfig
Parameters:
ipaddr - the interface to check
svcName - the service to check
Returns:
true if the ip is part of at least one package and the service is enabled in this package and monitored, false otherwise

getStep

public int getStep(Package pkg)
Retrieves configured RRD step size.

Specified by:
getStep in interface PollerConfig
Parameters:
pkg - Name of the data collection
Returns:
RRD step size for the specified collection

getRRAList

public List<String> getRRAList(Package pkg)
Retrieves configured list of RoundRobin Archive statements.

Specified by:
getRRAList in interface PollerConfig
Parameters:
pkg - Name of the data collection
Returns:
list of RRA strings.

enumeratePackage

public Enumeration<Package> enumeratePackage()
Specified by:
enumeratePackage in interface PollerConfig

enumerateMonitor

public Enumeration<Monitor> enumerateMonitor()

services

public Iterable<Service> services(Package pkg)

includeURLs

public Iterable<String> includeURLs(Package pkg)

parameters

public Iterable<Parameter> parameters(Service svc)

packages

public Iterable<Package> packages()

monitors

public Iterable<Monitor> monitors()

getThreads

public int getThreads()
Specified by:
getThreads in interface PollerConfig

getServiceMonitors

public Map<String,ServiceMonitor> getServiceMonitors()
Specified by:
getServiceMonitors in interface PollerConfig

getServiceMonitor

public ServiceMonitor getServiceMonitor(String svcName)
Specified by:
getServiceMonitor in interface PollerConfig

getServiceMonitorLocators

public Collection<ServiceMonitorLocator> getServiceMonitorLocators(DistributionContext context)
Specified by:
getServiceMonitorLocators in interface PollerConfig

getNextOutageIdSql

public String getNextOutageIdSql()
Specified by:
getNextOutageIdSql in interface PollerConfig

releaseAllServiceMonitors

public void releaseAllServiceMonitors()
Specified by:
releaseAllServiceMonitors in interface PollerConfig

saveResponseTimeData

public void saveResponseTimeData(String locationMonitor,
                                 OnmsMonitoredService monSvc,
                                 double responseTime,
                                 Package pkg)
Specified by:
saveResponseTimeData in interface PollerConfig


Copyright © 2009. All Rights Reserved.