OpenNMS API 1.2.3

org.opennms.netmgt.mock
Class MockPollerConfig

java.lang.Object
  extended byorg.opennms.netmgt.config.PollOutagesConfigManager
      extended byorg.opennms.netmgt.mock.MockPollerConfig
All Implemented Interfaces:
PollerConfig, PollOutagesConfig

public class MockPollerConfig
extends PollOutagesConfigManager
implements PollerConfig


Field Summary
private  java.lang.String m_criticalSvcName
           
private  Package m_currentPkg
           
private  long m_defaultPollInterval
           
private  java.lang.String m_nextOutageIdSql
           
private  boolean m_outageProcessingEnabled
           
private  java.util.Vector m_pkgs
           
private  boolean m_pollAll
           
private  boolean m_serviceUnresponsiveEnabled
           
private  java.util.Map m_svcMonitors
           
private  int m_threads
           
 
Fields inherited from class org.opennms.netmgt.config.PollOutagesConfigManager
FORMAT1, FORMAT2, m_dayOfWeekMap
 
Constructor Summary
MockPollerConfig()
           
 
Method Summary
 void addDowntime(long interval, long begin, long end, boolean delete)
           
 void addPackage(java.lang.String name)
           
 void addScheduledOutage(Package pkg, java.lang.String outageName, long begin, long end, java.lang.String ipAddr)
           
 void addScheduledOutage(Package pkg, java.lang.String outageName, java.lang.String dayOfWeek, java.lang.String beginTime, java.lang.String endTime, java.lang.String ipAddr)
           
 void addScheduledOutage(java.lang.String outageName, long begin, long end, java.lang.String ipAddr)
           
 void addScheduledOutage(java.lang.String outageName, java.lang.String dayOfWeek, java.lang.String beginTime, java.lang.String endTime, java.lang.String ipAddr)
           
 void addService(MockService svc)
           
 void addService(java.lang.String name, long interval, ServiceMonitor monitor)
           
 void addService(java.lang.String name, ServiceMonitor monitor)
           
private  void addServiceMonitor(java.lang.String name, ServiceMonitor monitor)
           
 void clearDowntime()
           
 java.util.Enumeration enumeratePackage()
           
private  Outage findOutage(java.lang.String name)
           
private  Service findService(Package pkg, java.lang.String svcName)
           
 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.
 java.lang.String getNextOutageIdSql()
           
 Package getPackage(java.lang.String name)
           
 java.util.List getRRAList(Package pkg)
          Retrieves configured list of RoundRobin Archive statements.
 ServiceMonitor getServiceMonitor(java.lang.String svcName)
           
 java.util.Map getServiceMonitors()
           
 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.
 boolean hasServiceMonitor(java.lang.String svcName)
           
 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.
 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 populatePackage(MockNetwork network)
           
 void rebuildPackageIpListMap()
          This method is used to rebuild the package agaist iplist mapping when needed.
protected  void saveXML(java.lang.String xmlString)
           
 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.
 void setCriticalService(java.lang.String criticalSvcName)
           
 void setDefaultPollInterval(long defaultPollInterval)
           
 void setInterfaceMatch(java.lang.String matchRegexp)
           
 void setNextOutageIdSql(java.lang.String nextOutageIdSql)
           
 void setNodeOutageProcessingEnabled(boolean outageProcessingEnabled)
           
 void setPollAllIfNoCriticalServiceDefined(boolean pollAll)
           
 void setPollerThreads(int threads)
           
 void setPollInterval(Package pkg, java.lang.String svcName, long interval)
           
 void setPollInterval(java.lang.String svcName, long interval)
           
 void setServiceUnresponsiveEnabled(boolean serviceUnresponsiveEnabled)
           
 void update()
           
 
Methods inherited from class org.opennms.netmgt.config.PollOutagesConfigManager
addOutage, createDayOfWeekMapping, getConfig, getEndOfOutage, getEndOfOutage, getInterfaces, getNodeIds, getOutage, getOutages, getOutageTimes, getOutageType, isCurTimeInOutage, isCurTimeInOutage, isInterfaceInOutage, isInterfaceInOutage, isNodeIdInOutage, isNodeIdInOutage, isTimeInOutage, isTimeInOutage, isTimeInOutage, removeOutage, removeOutage, replaceOutage, saveCurrent, setConfig
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_criticalSvcName

private java.lang.String m_criticalSvcName

m_currentPkg

private Package m_currentPkg

m_outageProcessingEnabled

private boolean m_outageProcessingEnabled

m_pkgs

private java.util.Vector m_pkgs

m_svcMonitors

private java.util.Map m_svcMonitors

m_threads

private int m_threads

m_defaultPollInterval

private long m_defaultPollInterval

m_pollAll

private boolean m_pollAll

m_serviceUnresponsiveEnabled

private boolean m_serviceUnresponsiveEnabled

m_nextOutageIdSql

private java.lang.String m_nextOutageIdSql
Constructor Detail

MockPollerConfig

public MockPollerConfig()
Method Detail

addDowntime

public void addDowntime(long interval,
                        long begin,
                        long end,
                        boolean delete)

addScheduledOutage

public void addScheduledOutage(Package pkg,
                               java.lang.String outageName,
                               long begin,
                               long end,
                               java.lang.String ipAddr)

addScheduledOutage

public void addScheduledOutage(java.lang.String outageName,
                               long begin,
                               long end,
                               java.lang.String ipAddr)

addScheduledOutage

public void addScheduledOutage(Package pkg,
                               java.lang.String outageName,
                               java.lang.String dayOfWeek,
                               java.lang.String beginTime,
                               java.lang.String endTime,
                               java.lang.String ipAddr)

addScheduledOutage

public void addScheduledOutage(java.lang.String outageName,
                               java.lang.String dayOfWeek,
                               java.lang.String beginTime,
                               java.lang.String endTime,
                               java.lang.String ipAddr)

addService

public void addService(java.lang.String name,
                       ServiceMonitor monitor)

addService

public void addService(java.lang.String name,
                       long interval,
                       ServiceMonitor monitor)

addServiceMonitor

private void addServiceMonitor(java.lang.String name,
                               ServiceMonitor monitor)

addService

public void addService(MockService svc)

clearDowntime

public void clearDowntime()

addPackage

public void addPackage(java.lang.String name)

enumeratePackage

public java.util.Enumeration enumeratePackage()
Specified by:
enumeratePackage in interface PollerConfig

findOutage

private Outage findOutage(java.lang.String name)

findService

private Service findService(Package pkg,
                            java.lang.String svcName)

getCriticalService

public java.lang.String getCriticalService()
Description copied from interface: PollerConfig
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

getFirstPackageMatch

public Package getFirstPackageMatch(java.lang.String ipaddr)
Description copied from interface: PollerConfig
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

getNextOutageIdSql

public java.lang.String getNextOutageIdSql()
Specified by:
getNextOutageIdSql in interface PollerConfig

getPackage

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

getRRAList

public java.util.List getRRAList(Package pkg)
Description copied from interface: PollerConfig
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.

getServiceMonitor

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

getServiceMonitors

public java.util.Map getServiceMonitors()
Specified by:
getServiceMonitors in interface PollerConfig

getStep

public int getStep(Package pkg)
Description copied from interface: PollerConfig
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

getThreads

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

getXmlrpc

public boolean getXmlrpc()
Description copied from interface: PollerConfig
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

hasServiceMonitor

public boolean hasServiceMonitor(java.lang.String svcName)
Parameters:
svcName -
Returns:

interfaceInPackage

public boolean interfaceInPackage(java.lang.String iface,
                                  Package pkg)
Description copied from interface: PollerConfig
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.

isPolled

public boolean isPolled(java.lang.String ipaddr)
Description copied from interface: PollerConfig
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

isPolled

public boolean isPolled(java.lang.String svcName,
                        Package pkg)
Description copied from interface: PollerConfig
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(java.lang.String ipaddr,
                        java.lang.String svcName)
Description copied from interface: PollerConfig
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

nodeOutageProcessingEnabled

public boolean nodeOutageProcessingEnabled()
Description copied from interface: PollerConfig
Returns true if node outage processing is enabled.

Specified by:
nodeOutageProcessingEnabled in interface PollerConfig

pollAllIfNoCriticalServiceDefined

public boolean pollAllIfNoCriticalServiceDefined()
Description copied from interface: PollerConfig
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

setPollAllIfNoCriticalServiceDefined

public void setPollAllIfNoCriticalServiceDefined(boolean pollAll)

rebuildPackageIpListMap

public void rebuildPackageIpListMap()
Description copied from interface: PollerConfig
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

serviceInPackageAndEnabled

public boolean serviceInPackageAndEnabled(java.lang.String svcName,
                                          Package pkg)
Description copied from interface: PollerConfig
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.

serviceMonitored

public boolean serviceMonitored(java.lang.String svcName)
Description copied from interface: PollerConfig
Returns true if the service has a monitor configured, false otherwise.

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

serviceUnresponsiveEnabled

public boolean serviceUnresponsiveEnabled()
Description copied from interface: PollerConfig
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

setNextOutageIdSql

public void setNextOutageIdSql(java.lang.String nextOutageIdSql)

setServiceUnresponsiveEnabled

public void setServiceUnresponsiveEnabled(boolean serviceUnresponsiveEnabled)

setCriticalService

public void setCriticalService(java.lang.String criticalSvcName)

setInterfaceMatch

public void setInterfaceMatch(java.lang.String matchRegexp)

setNodeOutageProcessingEnabled

public void setNodeOutageProcessingEnabled(boolean outageProcessingEnabled)

setPollInterval

public void setPollInterval(java.lang.String svcName,
                            long interval)

setPollInterval

public void setPollInterval(Package pkg,
                            java.lang.String svcName,
                            long interval)

setPollerThreads

public void setPollerThreads(int threads)

setDefaultPollInterval

public void setDefaultPollInterval(long defaultPollInterval)

populatePackage

public void populatePackage(MockNetwork network)

saveXML

protected void saveXML(java.lang.String xmlString)
                throws java.io.IOException,
                       org.exolab.castor.xml.MarshalException,
                       org.exolab.castor.xml.ValidationException
Specified by:
saveXML in class PollOutagesConfigManager
Throws:
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException

update

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

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.