OpenNMS API 1.2.3

org.opennms.netmgt.collectd
Class CollectableService

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

final class CollectableService
extends IPv4NetworkInterface
implements ReadyRunnable

The CollectableService class ...

Author:
Mike Davidson , OpenNMS

Field Summary
private static boolean ABORT_COLLECTION
           
private  ServiceCollector m_collector
           
private  long m_lastCollectionTime
          The last time data collection ocurred
private  long m_lastScheduledCollectionTime
          The last time the collector was scheduled for collection.
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 collection parameters
private  EventProxy m_proxy
          The event proxy
private  Scheduler m_scheduler
          The scheduler for collectd
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 monitor.
private  CollectorUpdates 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) CollectableService(int dbNodeId, java.net.InetAddress address, java.lang.String svcName, Package pkg)
          Constructs a new instance of a CollectableService object.
 
Method Summary
 CollectorUpdates getCollectorUpdates()
          Returns updates object
 int getNodeId()
          Returns node identifier
 java.lang.String getPackageName()
          Returns the package name
(package private)  java.util.Map getPropertyMap()
           
 java.lang.String getServiceName()
          Returns the service name
 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 collectd config factory.
 void run()
          This is the main method of the class.
private  boolean scheduledOutage()
          Checks the package information for the collectable 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 nodentifier
 
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_lastCollectionTime

private long m_lastCollectionTime
The last time data collection ocurred


m_lastScheduledCollectionTime

private long m_lastScheduledCollectionTime
The last time the collector was scheduled for collection.


m_scheduler

private final Scheduler m_scheduler
The scheduler for collectd


m_updates

private CollectorUpdates m_updates
Service updates


m_proxy

private EventProxy m_proxy
The event proxy


ABORT_COLLECTION

private static final boolean ABORT_COLLECTION
See Also:
Constant Field Values

m_properties

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


m_collector

private ServiceCollector m_collector

m_svcPropKey

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


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

CollectableService

CollectableService(int dbNodeId,
                   java.net.InetAddress address,
                   java.lang.String svcName,
                   Package pkg)
Constructs a new instance of a CollectableService 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 nodentifier


getServiceName

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


getPackageName

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


getCollectorUpdates

public CollectorUpdates getCollectorUpdates()
Returns updates object


refreshPackage

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


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 collection 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

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 collectable 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 a collection may be performed) or true if applicable outage is found (indicating collection should be skipped).

processUpdates

private boolean processUpdates()
Process any outstanding updates.

Returns:
true if update indicates that collection 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.