Package org.opennms.netmgt.config
Class SnmpInterfacePollerConfigManager
- java.lang.Object
-
- org.opennms.netmgt.config.SnmpInterfacePollerConfigManager
-
- All Implemented Interfaces:
SnmpInterfacePollerConfig
- Direct Known Subclasses:
SnmpInterfacePollerConfigFactory
public abstract class SnmpInterfacePollerConfigManager extends java.lang.Object implements SnmpInterfacePollerConfig
Abstract SnmpInterfacePollerConfigManager class.
- Version:
- $Id: $
- Author:
- Mathew Brozowski, David Hustace, Mathew Brozowski, David Hustace
-
-
Constructor Summary
Constructors Constructor Description SnmpInterfacePollerConfigManager(java.io.InputStream stream)
Constructor for SnmpInterfacePollerConfigManager.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addPackage(Package pkg)
addPackagejava.util.Enumeration<Package>
enumeratePackage()
enumeratePackagejava.util.List<java.lang.String>
getAllPackageMatches(java.lang.String ipaddr)
getAllPackageMatchesSnmpInterfacePollerConfiguration
getConfiguration()
Return the poller configuration object.java.util.Optional<java.lang.String>
getCriteria(java.lang.String pkgName, java.lang.String pkgInterfaceName)
getCriteriajava.lang.String[]
getCriticalServiceIds()
This method returns the configured critical service name.java.lang.String
getDownValues()
getDownValuesjava.lang.String
getDownValues(java.lang.String pkgName, java.lang.String pkgInterfaceName)
getDownValuesjava.util.Set<java.lang.String>
getInterfaceOnPackage(java.lang.String pkgName)
getInterfaceOnPackagelong
getInterval()
getThreadslong
getInterval(java.lang.String pkgName, java.lang.String pkgInterfaceName)
getIntervaljava.util.List<java.net.InetAddress>
getIpList(Package pkg)
getIpListjava.lang.Integer
getMaxVarsPerPdu(java.lang.String pkgName, java.lang.String pkgInterfaceName)
getMaxVarsPerPduPackage
getPackage(java.lang.String name)
getPackagePackage
getPackageForAddress(java.lang.String ipaddr)
Returns the first package that the ip belongs to, null if none.java.lang.String
getPackageName(java.lang.String ipaddr)
getPackageNamejava.util.Optional<java.lang.Integer>
getPort(java.lang.String pkgName, java.lang.String pkgInterfaceName)
getPortjava.util.Optional<java.lang.Integer>
getRetries(java.lang.String pkgName, java.lang.String pkgInterfaceName)
getRetriesjava.lang.String
getService()
getServiceboolean
getStatus(java.lang.String pkgName, java.lang.String pkgInterfaceName)
getStatusint
getThreads()
getThreadsjava.util.Optional<java.lang.Integer>
getTimeout(java.lang.String pkgName, java.lang.String pkgInterfaceName)
getTimeoutjava.lang.String
getUpValues()
getUpValuesjava.lang.String
getUpValues(java.lang.String pkgName, java.lang.String pkgInterfaceName)
getUpValuesboolean
hasMaxVarsPerPdu(java.lang.String pkgName, java.lang.String pkgInterfaceName)
hasMaxVarsPerPduboolean
hasPort(java.lang.String pkgName, java.lang.String pkgInterfaceName)
hasPortboolean
hasRetries(java.lang.String pkgName, java.lang.String pkgInterfaceName)
hasRetriesboolean
hasTimeout(java.lang.String pkgName, java.lang.String pkgInterfaceName)
hasTimeoutjava.lang.Iterable<java.lang.String>
includeURLs(Package pkg)
includeURLsboolean
interfaceInPackage(java.lang.String iface, Package pkg)
This method is used to determine if the named interface is included in the passed package definition.java.lang.Iterable<Package>
packages()
packagesvoid
rebuildPackageIpListMap()
This method is used to rebuild the package against IP list mapping when needed.protected void
reloadXML(java.io.InputStream stream)
reloadXMLvoid
save()
Saves the current in-memory configuration to disk and reloadsprotected abstract void
saveXml(java.lang.String xml)
saveXmlabstract void
update()
updateboolean
useCriteriaFilters()
useCriteriaFilters
-
-
-
Method Detail
-
update
public abstract void update() throws java.io.IOException
update
- Specified by:
update
in interfaceSnmpInterfacePollerConfig
- 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.
-
reloadXML
protected void reloadXML(java.io.InputStream stream) throws java.io.IOException
reloadXML
- Parameters:
stream
- aInputStream
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- Throws:
java.io.IOException
- if any.
-
getConfiguration
public SnmpInterfacePollerConfiguration getConfiguration()
Return the poller configuration object.- Returns:
- a
SnmpInterfacePollerConfiguration
object.
-
getPackage
public Package getPackage(java.lang.String name)
getPackage
- Parameters:
name
- aString
object.- Returns:
- a
Package
object.
-
getCriticalServiceIds
public java.lang.String[] getCriticalServiceIds()
This method returns the configured critical service name.- Specified by:
getCriticalServiceIds
in interfaceSnmpInterfacePollerConfig
- Returns:
- the name of the configured critical service, or null if none is present
-
getIpList
public java.util.List<java.net.InetAddress> getIpList(Package pkg)
getIpList
- Parameters:
pkg
- aPackage
object.- Returns:
- a
List
object.
-
rebuildPackageIpListMap
public void rebuildPackageIpListMap()
This method is used to rebuild the package against IP list 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 IP list should be rebuilt so that poller could know which package this IP/service pair is in.- Specified by:
rebuildPackageIpListMap
in interfaceSnmpInterfacePollerConfig
-
interfaceInPackage
public 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. 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.- 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.
-
getPackageForAddress
public Package getPackageForAddress(java.lang.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.- 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 already in the database.- Specified by:
getAllPackageMatches
in interfaceSnmpInterfacePollerConfig
- Parameters:
ipaddr
- aString
object.- Returns:
- a
List
object.
-
getPackageName
public java.lang.String getPackageName(java.lang.String ipaddr)
getPackageName
- Specified by:
getPackageName
in interfaceSnmpInterfacePollerConfig
- Parameters:
ipaddr
- aString
object.- Returns:
- a
String
object.
-
getInterfaceOnPackage
public java.util.Set<java.lang.String> getInterfaceOnPackage(java.lang.String pkgName)
getInterfaceOnPackage
- Specified by:
getInterfaceOnPackage
in interfaceSnmpInterfacePollerConfig
- Parameters:
pkgName
- aString
object.- Returns:
- a
Set
object.
-
getStatus
public boolean getStatus(java.lang.String pkgName, java.lang.String pkgInterfaceName)
getStatus
- Specified by:
getStatus
in interfaceSnmpInterfacePollerConfig
- Parameters:
pkgName
- aString
object.pkgInterfaceName
- aString
object.- Returns:
- a boolean.
-
getInterval
public long getInterval(java.lang.String pkgName, java.lang.String pkgInterfaceName)
getInterval
- Specified by:
getInterval
in interfaceSnmpInterfacePollerConfig
- Parameters:
pkgName
- aString
object.pkgInterfaceName
- aString
object.- Returns:
- a long.
-
getCriteria
public java.util.Optional<java.lang.String> getCriteria(java.lang.String pkgName, java.lang.String pkgInterfaceName)
getCriteria
- Specified by:
getCriteria
in interfaceSnmpInterfacePollerConfig
- Parameters:
pkgName
- aString
object.pkgInterfaceName
- aString
object.- Returns:
- a
String
object.
-
hasPort
public boolean hasPort(java.lang.String pkgName, java.lang.String pkgInterfaceName)
hasPort
- Specified by:
hasPort
in interfaceSnmpInterfacePollerConfig
- Parameters:
pkgName
- aString
object.pkgInterfaceName
- aString
object.- Returns:
- a boolean.
-
getPort
public java.util.Optional<java.lang.Integer> getPort(java.lang.String pkgName, java.lang.String pkgInterfaceName)
getPort
- Specified by:
getPort
in interfaceSnmpInterfacePollerConfig
- Parameters:
pkgName
- aString
object.pkgInterfaceName
- aString
object.- Returns:
- a int.
-
hasTimeout
public boolean hasTimeout(java.lang.String pkgName, java.lang.String pkgInterfaceName)
hasTimeout
- Specified by:
hasTimeout
in interfaceSnmpInterfacePollerConfig
- Parameters:
pkgName
- aString
object.pkgInterfaceName
- aString
object.- Returns:
- a boolean.
-
getTimeout
public java.util.Optional<java.lang.Integer> getTimeout(java.lang.String pkgName, java.lang.String pkgInterfaceName)
getTimeout
- Specified by:
getTimeout
in interfaceSnmpInterfacePollerConfig
- Parameters:
pkgName
- aString
object.pkgInterfaceName
- aString
object.- Returns:
- a int.
-
hasRetries
public boolean hasRetries(java.lang.String pkgName, java.lang.String pkgInterfaceName)
hasRetries
- Specified by:
hasRetries
in interfaceSnmpInterfacePollerConfig
- Parameters:
pkgName
- aString
object.pkgInterfaceName
- aString
object.- Returns:
- a boolean.
-
getRetries
public java.util.Optional<java.lang.Integer> getRetries(java.lang.String pkgName, java.lang.String pkgInterfaceName)
getRetries
- Specified by:
getRetries
in interfaceSnmpInterfacePollerConfig
- Parameters:
pkgName
- aString
object.pkgInterfaceName
- aString
object.- Returns:
- a int.
-
hasMaxVarsPerPdu
public boolean hasMaxVarsPerPdu(java.lang.String pkgName, java.lang.String pkgInterfaceName)
hasMaxVarsPerPdu
- Specified by:
hasMaxVarsPerPdu
in interfaceSnmpInterfacePollerConfig
- Parameters:
pkgName
- aString
object.pkgInterfaceName
- aString
object.- Returns:
- a boolean.
-
getMaxVarsPerPdu
public java.lang.Integer getMaxVarsPerPdu(java.lang.String pkgName, java.lang.String pkgInterfaceName)
getMaxVarsPerPdu
- Specified by:
getMaxVarsPerPdu
in interfaceSnmpInterfacePollerConfig
- Parameters:
pkgName
- aString
object.pkgInterfaceName
- aString
object.- Returns:
- a int.
-
getUpValues
public java.lang.String getUpValues(java.lang.String pkgName, java.lang.String pkgInterfaceName)
getUpValues
- Specified by:
getUpValues
in interfaceSnmpInterfacePollerConfig
- Parameters:
pkgName
- aString
object.pkgInterfaceName
- aString
object.- Returns:
-
getDownValues
public java.lang.String getDownValues(java.lang.String pkgName, java.lang.String pkgInterfaceName)
getDownValues
- Specified by:
getDownValues
in interfaceSnmpInterfacePollerConfig
- Parameters:
pkgName
- aString
object.pkgInterfaceName
- aString
object.- Returns:
- a String.
-
enumeratePackage
public java.util.Enumeration<Package> enumeratePackage()
enumeratePackage
- Returns:
- a
Enumeration
object.
-
packages
public java.lang.Iterable<Package> packages()
packages
- Returns:
- a
Iterable
object.
-
includeURLs
public java.lang.Iterable<java.lang.String> includeURLs(Package pkg)
includeURLs
- Parameters:
pkg
- aPackage
object.- Returns:
- a
Iterable
object.
-
getThreads
public int getThreads()
getThreads
- Specified by:
getThreads
in interfaceSnmpInterfacePollerConfig
- Returns:
- a int.
-
getInterval
public long getInterval()
getThreads
- Specified by:
getInterval
in interfaceSnmpInterfacePollerConfig
- Returns:
- a long.
-
getService
public java.lang.String getService()
getService
- Specified by:
getService
in interfaceSnmpInterfacePollerConfig
- Returns:
- a
String
object.
-
useCriteriaFilters
public boolean useCriteriaFilters()
useCriteriaFilters
- Specified by:
useCriteriaFilters
in interfaceSnmpInterfacePollerConfig
- Returns:
- a boolean.
-
getUpValues
public java.lang.String getUpValues()
getUpValues
- Specified by:
getUpValues
in interfaceSnmpInterfacePollerConfig
- Returns:
- a String
-
getDownValues
public java.lang.String getDownValues()
getDownValues
- Specified by:
getDownValues
in interfaceSnmpInterfacePollerConfig
- Returns:
- a String
-
-