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 java.lang.Object implements PollerConfig
Abstract PollerConfigManager class.
- Author:
- Mathew Brozowski, David Hustace
-
-
Field Summary
Fields Modifier and Type Field Description protected PollerConfiguration
m_config
The config class loaded from the config file
-
Constructor Summary
Constructors Constructor Description PollerConfigManager(java.io.InputStream stream)
Constructor for PollerConfigManager.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addMonitor(java.lang.String svcName, java.lang.String className)
addMonitorvoid
addPackage(Package pkg)
addPackagejava.util.Enumeration<Package>
enumeratePackage()
enumeratePackagejava.util.List<java.lang.String>
getAllPackageMatches(java.lang.String ipaddr)
getAllPackageMatchesPollerConfiguration
getConfiguration()
Return the poller configuration object.java.lang.String
getCriticalService()
This method returns the configured critical service name.java.net.InetAddress
getDefaultCriticalPathIp()
int
getDefaultCriticalPathRetries()
int
getDefaultCriticalPathTimeout()
Package
getFirstLocalPackageMatch(java.lang.String ipaddr)
Returns the first package that the ip belongs to that is not marked as remote, null if none.java.util.List<java.net.InetAddress>
getIpList(Package pkg)
Determine the list of IPs the filter rule for this package allowsjava.lang.String
getNextOutageIdSql()
getNextOutageIdSqlPackage
getPackage(java.lang.String name)
getPackagejava.util.List<Package>
getPackages()
java.util.concurrent.locks.Lock
getReadLock()
getReadLockjava.util.List<java.lang.String>
getRRAList(Package pkg)
Retrieves configured list of RoundRobin Archive statements.Service
getServiceInPackage(java.lang.String svcName, Package pkg)
Return the Service object with the given name from the give Package.ServiceMonitor
getServiceMonitor(java.lang.String svcName)
getServiceMonitorjava.util.Collection<ServiceMonitorLocator>
getServiceMonitorLocators()
getServiceMonitorLocatorsjava.util.Set<java.lang.String>
getServiceMonitorNames()
ServiceMonitorRegistry
getServiceMonitorRegistry()
java.util.Map<java.lang.String,ServiceMonitor>
getServiceMonitors()
getServiceMonitorsServiceSelector
getServiceSelectorForPackage(Package pkg)
getServiceSelectorForPackageint
getStep(Package pkg)
Retrieves configured RRD step size.int
getThreads()
getThreadsjava.util.concurrent.locks.Lock
getWriteLock()
getWriteLockboolean
isInterfaceInPackage(java.lang.String iface, Package pkg)
This method is used to determine if the named interface is included in the passed package definition.boolean
isNodeOutageProcessingEnabled()
Returns true if node outage processing is enabled.boolean
isPathOutageEnabled()
This method returns the boolean flag pathOutageEnabled to indicate if path outage processing on nodeDown events is enabledboolean
isPolled(java.lang.String ipaddr)
Returns true if the ip is part of at least one package.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
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
isPolledLocally(java.lang.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(java.lang.String ipaddr, java.lang.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.boolean
isServiceInPackageAndEnabled(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
isServiceMonitored(java.lang.String svcName)
Returns true if the service has a monitor configured, false otherwise.boolean
isServiceUnresponsiveEnabled()
Returns true if serviceUnresponsive behavior is enabled.java.lang.Iterable<Parameter>
parameters(Service svc)
parametersvoid
rebuildPackageIpListMap()
This method is used to rebuild the package agaist iplist mapping when needed.void
save()
Saves the current in-memory configuration to disk and reloadsprotected abstract void
saveXml(java.lang.String xml)
saveXmlprotected void
setUpInternalData()
setUpInternalDataboolean
shouldPollAllIfNoCriticalServiceDefined()
This method returns the configured value of the 'pollAllIfNoCriticalServiceDefined' flag.void
update()
update
-
-
-
Field Detail
-
m_config
protected PollerConfiguration m_config
The config class loaded from the config file
-
-
Method Detail
-
getReadLock
public java.util.concurrent.locks.Lock getReadLock()
Description copied from interface:PollerConfig
getReadLock
- Specified by:
getReadLock
in interfacePollerConfig
- Returns:
- a Lock
-
getWriteLock
public java.util.concurrent.locks.Lock getWriteLock()
Description copied from interface:PollerConfig
getWriteLock
- Specified by:
getWriteLock
in interfacePollerConfig
- Returns:
- a Lock
-
setUpInternalData
protected void setUpInternalData()
setUpInternalData
-
update
public void update() throws java.io.IOException
update
- Specified by:
update
in interfacePollerConfig
- Throws:
java.io.IOException
- if any.
-
saveXml
protected abstract void saveXml(java.lang.String xml) throws java.io.IOException
saveXml
- Parameters:
xml
- aString
object.- Throws:
java.io.IOException
- if any.
-
save
public void save() throws java.io.IOException
Saves the current in-memory configuration to disk and reloads- Specified by:
save
in interfacePollerConfig
- Throws:
java.io.IOException
- if any.
-
getConfiguration
public PollerConfiguration getConfiguration()
Return the poller configuration object.- Specified by:
getConfiguration
in interfacePollerConfig
- Returns:
- a
PollerConfiguration
object.
-
getPackage
public Package getPackage(java.lang.String name)
getPackage
- Specified by:
getPackage
in interfacePollerConfig
- Parameters:
name
- aString
object.- Returns:
- a
Package
object.
-
getServiceSelectorForPackage
public ServiceSelector getServiceSelectorForPackage(Package pkg)
getServiceSelectorForPackage
- Specified by:
getServiceSelectorForPackage
in interfacePollerConfig
- Parameters:
pkg
- aPackage
object.- Returns:
- a
ServiceSelector
object.
-
addPackage
public void addPackage(Package pkg)
addPackage
- Specified by:
addPackage
in interfacePollerConfig
- Parameters:
pkg
- aPackage
object.
-
addMonitor
public void addMonitor(java.lang.String svcName, java.lang.String className)
addMonitor
- Specified by:
addMonitor
in interfacePollerConfig
- Parameters:
svcName
- aString
object.className
- aString
object.
-
isPathOutageEnabled
public boolean isPathOutageEnabled()
This method returns the boolean flag pathOutageEnabled to indicate if path outage processing on nodeDown events is enabled- Specified by:
isPathOutageEnabled
in interfacePathOutageConfig
- Returns:
- true if pathOutageEnabled
-
getDefaultCriticalPathRetries
public int getDefaultCriticalPathRetries()
- Specified by:
getDefaultCriticalPathRetries
in interfacePathOutageConfig
-
getDefaultCriticalPathTimeout
public int getDefaultCriticalPathTimeout()
- Specified by:
getDefaultCriticalPathTimeout
in interfacePathOutageConfig
-
getDefaultCriticalPathIp
public java.net.InetAddress getDefaultCriticalPathIp()
- Specified by:
getDefaultCriticalPathIp
in interfacePathOutageConfig
-
getCriticalService
public java.lang.String getCriticalService()
This method returns the configured critical service name.- Specified by:
getCriticalService
in 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:
shouldPollAllIfNoCriticalServiceDefined
in interfacePollerConfig
- Returns:
- true or false based on configured value
-
isNodeOutageProcessingEnabled
public boolean isNodeOutageProcessingEnabled()
Returns true if node outage processing is enabled.- Specified by:
isNodeOutageProcessingEnabled
in 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:
isServiceUnresponsiveEnabled
in interfacePollerConfig
- Returns:
- a boolean.
-
getIpList
public java.util.List<java.net.InetAddress> getIpList(Package pkg)
Determine the list of IPs the filter rule for this package allows- Specified by:
getIpList
in interfacePollerConfig
- Parameters:
pkg
- aPackage
object.- Returns:
- a
List
object.
-
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 interfacePollerConfig
-
isInterfaceInPackage
public boolean isInterfaceInPackage(java.lang.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:
isInterfaceInPackage
in 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(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". 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:
isServiceInPackageAndEnabled
in interfacePollerConfig
- Parameters:
svcName
- The service name to lookup.pkg
- The package to lookup up service.- Returns:
- a boolean.
-
getServiceInPackage
public Service getServiceInPackage(java.lang.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:
getServiceInPackage
in 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(java.lang.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:
isServiceMonitored
in interfacePollerConfig
- Parameters:
svcName
- The service name to lookup.- Returns:
- a boolean.
-
getFirstLocalPackageMatch
public Package getFirstLocalPackageMatch(java.lang.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:
getFirstLocalPackageMatch
in interfacePollerConfig
- Parameters:
ipaddr
- the interface to check- Returns:
- the first package that the ip belongs to, null if none
-
getAllPackageMatches
public java.util.List<java.lang.String> getAllPackageMatches(java.lang.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:
getAllPackageMatches
in interfacePollerConfig
- Parameters:
ipaddr
- aString
object.- Returns:
- a
List
object.
-
isPolled
public boolean isPolled(java.lang.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:
isPolled
in 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(java.lang.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:
isPolledLocally
in 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(java.lang.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:
isPolled
in 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(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. Note: Evaluation of the interface against a package filter will only work if the IP is alrady in the database.- Specified by:
isPolled
in 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(java.lang.String ipaddr, java.lang.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:
isPolledLocally
in 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:
getStep
in interfacePollerConfig
- Parameters:
pkg
- Name of the data collection- Returns:
- RRD step size for the specified collection
-
getRRAList
public java.util.List<java.lang.String> getRRAList(Package pkg)
Retrieves configured list of RoundRobin Archive statements. Retrieves configured list of RoundRobin Archive statements.- Specified by:
getRRAList
in interfacePollerConfig
- Parameters:
pkg
- Name of the data collection- Returns:
- list of RRA strings.
-
enumeratePackage
public java.util.Enumeration<Package> enumeratePackage()
enumeratePackage
- Specified by:
enumeratePackage
in interfacePollerConfig
- Returns:
- a
Enumeration
object.
-
getPackages
public java.util.List<Package> getPackages()
- Specified by:
getPackages
in interfacePollerConfig
-
parameters
public java.lang.Iterable<Parameter> parameters(Service svc)
parameters
- Specified by:
parameters
in interfacePollerConfig
- Parameters:
svc
- aService
object.- Returns:
- a
Iterable
object.
-
getThreads
public int getThreads()
getThreads
- Specified by:
getThreads
in interfacePollerConfig
- Returns:
- a int.
-
getServiceMonitors
public java.util.Map<java.lang.String,ServiceMonitor> getServiceMonitors()
getServiceMonitors
- Returns:
- a
Map
object.
-
getServiceMonitorNames
public java.util.Set<java.lang.String> getServiceMonitorNames()
- Specified by:
getServiceMonitorNames
in interfacePollerConfig
-
getServiceMonitor
public ServiceMonitor getServiceMonitor(java.lang.String svcName)
getServiceMonitor
- Specified by:
getServiceMonitor
in interfacePollerConfig
- Parameters:
svcName
- aString
object.- Returns:
- a
ServiceMonitor
object.
-
getServiceMonitorLocators
public java.util.Collection<ServiceMonitorLocator> getServiceMonitorLocators()
getServiceMonitorLocators
- Specified by:
getServiceMonitorLocators
in interfacePollerConfig
- Returns:
- a
Collection
object.
-
getServiceMonitorRegistry
public ServiceMonitorRegistry getServiceMonitorRegistry()
- Specified by:
getServiceMonitorRegistry
in interfacePollerConfig
-
getNextOutageIdSql
public java.lang.String getNextOutageIdSql()
getNextOutageIdSql
- Specified by:
getNextOutageIdSql
in interfacePollerConfig
- Returns:
- a
String
object.
-
-