OpenNMS API 1.2.3

org.opennms.netmgt.threshd
Class ThresholdableService

java.lang.Object
  extended byorg.opennms.netmgt.poller.monitors.IPv4NetworkInterface
      extended byorg.opennms.netmgt.threshd.ThresholdableService
All Implemented Interfaces:
NetworkInterface, ReadyRunnable, java.lang.Runnable

final class ThresholdableService
extends IPv4NetworkInterface
implements ReadyRunnable

The ThresholdableService class ...

Author:
Mike Davidson , OpenNMS

Field Summary
private static boolean ABORT_THRESHOLD_CHECK
           
private  long m_lastScheduledThresholdCheckTime
          The last time this service was scheduled for threshold checking.
private  long m_lastThresholdCheckTime
          The last time a threshold check ocurred
private  int m_nodeId
          Interface's parent node identifier
private  Package m_package
          The package information for this interface/service pair
private static java.util.Map m_properties
          The map of thresholding parameters
private  EventProxy m_proxy
          The proxy used to send events.
private  Scheduler m_scheduler
          The scheduler for threshd
private  Service m_service
          The service informaion for this interface/service pair
private  int m_status
          Last known/current status
private  java.lang.String m_svcPropKey
          The key used to lookup the service properties that are passed to the thresholder.
private  ServiceThresholder m_thresholder
           
private  ThresholderUpdates m_updates
          Service updates
private static java.util.Map SVC_PROP_MAP
          The map of service parameters.
 
Fields inherited from class org.opennms.netmgt.poller.monitors.IPv4NetworkInterface
m_address
 
Fields inherited from interface org.opennms.netmgt.poller.monitors.NetworkInterface
TYPE_IPV4, TYPE_UNKNOWN
 
Constructor Summary
(package private) ThresholdableService(int dbNodeId, java.net.InetAddress address, java.lang.String svcName, Package pkg)
          Constructs a new instance of a ThresholdableService object.
 
Method Summary
 long getInterval()
          Returns the service's configured thresholding interval.
 int getNodeId()
          Returns node identifier
 java.lang.String getPackageName()
          Returns the service name
(package private)  java.util.Map getPropertyMap()
           
 java.lang.String getServiceName()
          Returns the service name
 ThresholderUpdates getThresholderUpdates()
          Returns updates object
 boolean isReady()
          This method is used to evaluate the status of this interface and service pair.
private  boolean processUpdates()
          Process any outstanding updates.
 void refreshPackage()
          Uses the existing package name to try and re-obtain the package from the threshd config factory.
 void run()
          This is the main method of the class.
private  boolean scheduledOutage()
          Checks the package information for the thresholdable service and determines if any of the calendar outages associated with the package apply to the current time and the service's interface.
private  void sendEvent(java.lang.String uei)
          Generate event and send it to eventd via the event proxy.
 void setNodeId(int nodeId)
          Set node identifier
 
Methods inherited from class org.opennms.netmgt.poller.monitors.IPv4NetworkInterface
getAddress, getAttribute, getType, setAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_nodeId

private int m_nodeId
Interface's parent node identifier


m_package

private Package m_package
The package information for this interface/service pair


m_service

private final Service m_service
The service informaion for this interface/service pair


m_status

private int m_status
Last known/current status


m_lastThresholdCheckTime

private long m_lastThresholdCheckTime
The last time a threshold check ocurred


m_lastScheduledThresholdCheckTime

private long m_lastScheduledThresholdCheckTime
The last time this service was scheduled for threshold checking.


m_proxy

private final EventProxy m_proxy
The proxy used to send events.


m_scheduler

private final Scheduler m_scheduler
The scheduler for threshd


m_updates

private ThresholderUpdates m_updates
Service updates


ABORT_THRESHOLD_CHECK

private static final boolean ABORT_THRESHOLD_CHECK
See Also:
Constant Field Values

m_properties

private static java.util.Map m_properties
The map of thresholding parameters


m_thresholder

private ServiceThresholder m_thresholder

m_svcPropKey

private final java.lang.String m_svcPropKey
The key used to lookup the service properties that are passed to the thresholder.


SVC_PROP_MAP

private static java.util.Map SVC_PROP_MAP
The map of service parameters. These parameters are mapped by the composite key (package name, service name).

Constructor Detail

ThresholdableService

ThresholdableService(int dbNodeId,
                     java.net.InetAddress address,
                     java.lang.String svcName,
                     Package pkg)
Constructs a new instance of a ThresholdableService object.

Parameters:
dbNodeId - The database identifier key for the interfaces' node
address - InetAddress of the interface to collect from
svcName - Service name
pkg - The package containing parms for this collectable service.
Method Detail

getNodeId

public int getNodeId()
Returns node identifier


setNodeId

public void setNodeId(int nodeId)
Set node identifier


getServiceName

public java.lang.String getServiceName()
Returns the service name


getPackageName

public java.lang.String getPackageName()
Returns the service name


refreshPackage

public void refreshPackage()
Uses the existing package name to try and re-obtain the package from the threshd config factory. Should be called when the threshd config has been reloaded.


getThresholderUpdates

public ThresholderUpdates getThresholderUpdates()
Returns updates object


isReady

public boolean isReady()
This method is used to evaluate the status of this interface and service pair. If it is time to run the threshold check again then a value of true is returned. If the interface is not ready then a value of false is returned.

Specified by:
isReady in interface ReadyRunnable

getInterval

public long getInterval()
Returns the service's configured thresholding interval.


sendEvent

private void sendEvent(java.lang.String uei)
Generate event and send it to eventd via the event proxy. uei Universal event identifier of event to generate.


run

public void run()
This is the main method of the class. An instance is normally enqueued on the scheduler which checks its isReady method to determine execution. If the instance is ready for execution then it is started with it's own thread context to execute the query. The last step in the method before it exits is to reschedule the interface.

Specified by:
run in interface java.lang.Runnable

getPropertyMap

java.util.Map getPropertyMap()

scheduledOutage

private boolean scheduledOutage()
Checks the package information for the thresholdable service and determines if any of the calendar outages associated with the package apply to the current time and the service's interface. If an outage applies true is returned...otherwise false is returned.

Returns:
false if no outage found (indicating thresholding may be performed) or true if applicable outage is found (indicating thresholding should be skipped).

processUpdates

private boolean processUpdates()
Process any outstanding updates.

Returns:
true if update indicates that threshold check should be aborted (for example due to deletion flag being set), false otherwise.

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.