Package org.opennms.netmgt.config
Class PollerConfigManager
- java.lang.Object
-
- org.opennms.netmgt.config.PollerConfigManager
-
- All Implemented Interfaces:
PathOutageConfig,PollerConfig
- Direct Known Subclasses:
PollerConfigFactory,ReadOnlyPollerConfigManager
public abstract class PollerConfigManager extends Object implements PollerConfig
Abstract PollerConfigManager class.
- Author:
- Mathew Brozowski, David Hustace
-
-
Field Summary
Fields Modifier and Type Field Description protected PollerConfigurationm_configThe config class loaded from the config file
-
Constructor Summary
Constructors Constructor Description PollerConfigManager(InputStream stream)Constructor for PollerConfigManager.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddMonitor(String svcName, String className)addMonitorvoidaddPackage(Package pkg)addPackageEnumeration<Package>enumeratePackage()enumeratePackageList<String>getAllPackageMatches(String ipaddr)getAllPackageMatchesPollerConfigurationgetConfiguration()Return the poller configuration object.StringgetCriticalService()This method returns the configured critical service name.InetAddressgetDefaultCriticalPathIp()intgetDefaultCriticalPathRetries()intgetDefaultCriticalPathTimeout()PackagegetFirstLocalPackageMatch(String ipaddr)Returns the first package that the ip belongs to that is not marked as remote, null if none.List<InetAddress>getIpList(Package pkg)Determine the list of IPs the filter rule for this package allowsStringgetNextOutageIdSql()getNextOutageIdSqlPackagegetPackage(String name)getPackageList<Package>getPackages()LockgetReadLock()getReadLockList<String>getRRAList(Package pkg)Retrieves configured list of RoundRobin Archive statements.ServicegetServiceInPackage(String svcName, Package pkg)Return the Service object with the given name from the give Package.ServiceMonitorgetServiceMonitor(String svcName)getServiceMonitorCollection<ServiceMonitorLocator>getServiceMonitorLocators()getServiceMonitorLocatorsSet<String>getServiceMonitorNames()ServiceMonitorRegistrygetServiceMonitorRegistry()Map<String,ServiceMonitor>getServiceMonitors()getServiceMonitorsServiceSelectorgetServiceSelectorForPackage(Package pkg)getServiceSelectorForPackageintgetStep(Package pkg)Retrieves configured RRD step size.intgetThreads()getThreadsLockgetWriteLock()getWriteLockbooleanisInterfaceInPackage(String iface, Package pkg)This method is used to determine if the named interface is included in the passed package definition.booleanisNodeOutageProcessingEnabled()Returns true if node outage processing is enabled.booleanisPathOutageEnabled()This method returns the boolean flag pathOutageEnabled to indicate if path outage processing on nodeDown events is enabledbooleanisPolled(String ipaddr)Returns true if the ip is part of at least one package.booleanisPolled(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.booleanisPolled(String svcName, Package pkg)Returns true if this package has the service enabled and if there is a monitor for this service.booleanisPolledLocally(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.booleanisPolledLocally(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.booleanisServiceInPackageAndEnabled(String svcName, Package pkg)Returns true if the service is part of the package and the status of the service is set to "on".booleanisServiceMonitored(String svcName)Returns true if the service has a monitor configured, false otherwise.booleanisServiceUnresponsiveEnabled()Returns true if serviceUnresponsive behavior is enabled.Iterable<Parameter>parameters(Service svc)parametersvoidrebuildPackageIpListMap()This method is used to rebuild the package agaist iplist mapping when needed.voidsave()Saves the current in-memory configuration to disk and reloadsprotected abstract voidsaveXml(String xml)saveXmlprotected voidsetUpInternalData()setUpInternalDatabooleanshouldPollAllIfNoCriticalServiceDefined()This method returns the configured value of the 'pollAllIfNoCriticalServiceDefined' flag.voidupdate()update
-
-
-
Field Detail
-
m_config
protected PollerConfiguration m_config
The config class loaded from the config file
-
-
Constructor Detail
-
PollerConfigManager
public PollerConfigManager(InputStream stream)
Constructor for PollerConfigManager.
- Parameters:
stream- aInputStreamobject.
-
-
Method Detail
-
getReadLock
public Lock getReadLock()
Description copied from interface:PollerConfiggetReadLock
- Specified by:
getReadLockin interfacePollerConfig- Returns:
- a Lock
-
getWriteLock
public Lock getWriteLock()
Description copied from interface:PollerConfiggetWriteLock
- Specified by:
getWriteLockin interfacePollerConfig- Returns:
- a Lock
-
setUpInternalData
protected void setUpInternalData()
setUpInternalData
-
update
public void update() throws IOExceptionupdate
- Specified by:
updatein interfacePollerConfig- Throws:
IOException- if any.
-
saveXml
protected abstract void saveXml(String xml) throws IOException
saveXml
- Parameters:
xml- aStringobject.- Throws:
IOException- if any.
-
save
public void save() throws IOExceptionSaves the current in-memory configuration to disk and reloads- Specified by:
savein interfacePollerConfig- Throws:
IOException- if any.
-
getConfiguration
public PollerConfiguration getConfiguration()
Return the poller configuration object.- Specified by:
getConfigurationin interfacePollerConfig- Returns:
- a
PollerConfigurationobject.
-
getPackage
public Package getPackage(String name)
getPackage
- Specified by:
getPackagein interfacePollerConfig- Parameters:
name- aStringobject.- Returns:
- a
Packageobject.
-
getServiceSelectorForPackage
public ServiceSelector getServiceSelectorForPackage(Package pkg)
getServiceSelectorForPackage
- Specified by:
getServiceSelectorForPackagein interfacePollerConfig- Parameters:
pkg- aPackageobject.- Returns:
- a
ServiceSelectorobject.
-
addPackage
public void addPackage(Package pkg)
addPackage
- Specified by:
addPackagein interfacePollerConfig- Parameters:
pkg- aPackageobject.
-
addMonitor
public void addMonitor(String svcName, String className)
addMonitor
- Specified by:
addMonitorin interfacePollerConfig- Parameters:
svcName- aStringobject.className- aStringobject.
-
isPathOutageEnabled
public boolean isPathOutageEnabled()
This method returns the boolean flag pathOutageEnabled to indicate if path outage processing on nodeDown events is enabled- Specified by:
isPathOutageEnabledin interfacePathOutageConfig- Returns:
- true if pathOutageEnabled
-
getDefaultCriticalPathRetries
public int getDefaultCriticalPathRetries()
- Specified by:
getDefaultCriticalPathRetriesin interfacePathOutageConfig
-
getDefaultCriticalPathTimeout
public int getDefaultCriticalPathTimeout()
- Specified by:
getDefaultCriticalPathTimeoutin interfacePathOutageConfig
-
getDefaultCriticalPathIp
public InetAddress getDefaultCriticalPathIp()
- Specified by:
getDefaultCriticalPathIpin interfacePathOutageConfig
-
getCriticalService
public String getCriticalService()
This method returns the configured critical service name.- Specified by:
getCriticalServicein interfacePollerConfig- Returns:
- the name of the configured critical service, or null if none is present
-
shouldPollAllIfNoCriticalServiceDefined
public boolean shouldPollAllIfNoCriticalServiceDefined()
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:
shouldPollAllIfNoCriticalServiceDefinedin interfacePollerConfig- Returns:
- true or false based on configured value
-
isNodeOutageProcessingEnabled
public boolean isNodeOutageProcessingEnabled()
Returns true if node outage processing is enabled.- Specified by:
isNodeOutageProcessingEnabledin interfacePollerConfig- Returns:
- a boolean.
-
isServiceUnresponsiveEnabled
public boolean isServiceUnresponsiveEnabled()
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:
isServiceUnresponsiveEnabledin interfacePollerConfig- Returns:
- a boolean.
-
getIpList
public List<InetAddress> getIpList(Package pkg)
Determine the list of IPs the filter rule for this package allows- Specified by:
getIpListin interfacePollerConfig- Parameters:
pkg- aPackageobject.- Returns:
- a
Listobject.
-
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:
rebuildPackageIpListMapin interfacePollerConfig
-
isInterfaceInPackage
public boolean isInterfaceInPackage(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. 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:
isInterfaceInPackagein interfacePollerConfig- 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.
-
isServiceInPackageAndEnabled
public boolean isServiceInPackageAndEnabled(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". 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:
isServiceInPackageAndEnabledin interfacePollerConfig- Parameters:
svcName- The service name to lookup.pkg- The package to lookup up service.- Returns:
- a boolean.
-
getServiceInPackage
public Service getServiceInPackage(String svcName, Package pkg)
Return the Service object with the given name from the give Package. Return the Service object with the given name from the give Package.- Specified by:
getServiceInPackagein interfacePollerConfig- Parameters:
svcName- the service name to lookuppkg- 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
-
isServiceMonitored
public boolean isServiceMonitored(String svcName)
Returns true if the service has a monitor configured, false otherwise. Returns true if the service has a monitor configured, false otherwise.- Specified by:
isServiceMonitoredin interfacePollerConfig- Parameters:
svcName- The service name to lookup.- Returns:
- a boolean.
-
getFirstLocalPackageMatch
public Package getFirstLocalPackageMatch(String ipaddr)
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:
getFirstLocalPackageMatchin interfacePollerConfig- 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)
getAllPackageMatches
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:
getAllPackageMatchesin interfacePollerConfig- Parameters:
ipaddr- aStringobject.- Returns:
- a
Listobject.
-
isPolled
public boolean isPolled(String ipaddr)
Returns true if the ip is part of at least one package. Note: Evaluation of the interface against a package filter will only work if the IP is already in the database. 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:
isPolledin interfacePollerConfig- Parameters:
ipaddr- the interface to check- Returns:
- true if the ip is part of at least one package, false otherwise
-
isPolledLocally
public 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.- Specified by:
isPolledLocallyin interfacePollerConfig- 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 already in the database. 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:
isPolledin interfacePollerConfig- Parameters:
svcName- the service to checkpkg- the package 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
-
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:
isPolledin interfacePollerConfig- Parameters:
ipaddr- the interface to checksvcName- 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)
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:
isPolledLocallyin interfacePollerConfig- Parameters:
ipaddr- the interface to checksvcName- 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. Retrieves configured RRD step size.- Specified by:
getStepin interfacePollerConfig- 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. Retrieves configured list of RoundRobin Archive statements.- Specified by:
getRRAListin interfacePollerConfig- Parameters:
pkg- Name of the data collection- Returns:
- list of RRA strings.
-
enumeratePackage
public Enumeration<Package> enumeratePackage()
enumeratePackage
- Specified by:
enumeratePackagein interfacePollerConfig- Returns:
- a
Enumerationobject.
-
getPackages
public List<Package> getPackages()
- Specified by:
getPackagesin interfacePollerConfig
-
parameters
public Iterable<Parameter> parameters(Service svc)
parameters
- Specified by:
parametersin interfacePollerConfig- Parameters:
svc- aServiceobject.- Returns:
- a
Iterableobject.
-
getThreads
public int getThreads()
getThreads
- Specified by:
getThreadsin interfacePollerConfig- Returns:
- a int.
-
getServiceMonitors
public Map<String,ServiceMonitor> getServiceMonitors()
getServiceMonitors
- Returns:
- a
Mapobject.
-
getServiceMonitorNames
public Set<String> getServiceMonitorNames()
- Specified by:
getServiceMonitorNamesin interfacePollerConfig
-
getServiceMonitor
public ServiceMonitor getServiceMonitor(String svcName)
getServiceMonitor
- Specified by:
getServiceMonitorin interfacePollerConfig- Parameters:
svcName- aStringobject.- Returns:
- a
ServiceMonitorobject.
-
getServiceMonitorLocators
public Collection<ServiceMonitorLocator> getServiceMonitorLocators()
getServiceMonitorLocators
- Specified by:
getServiceMonitorLocatorsin interfacePollerConfig- Returns:
- a
Collectionobject.
-
getServiceMonitorRegistry
public ServiceMonitorRegistry getServiceMonitorRegistry()
- Specified by:
getServiceMonitorRegistryin interfacePollerConfig
-
getNextOutageIdSql
public String getNextOutageIdSql()
getNextOutageIdSql
- Specified by:
getNextOutageIdSqlin interfacePollerConfig- Returns:
- a
Stringobject.
-
-