OpenNMS API 1.2.3

org.opennms.netmgt.poller.monitors
Class SnmpMonitor

java.lang.Object
  extended byorg.opennms.netmgt.poller.monitors.IPv4Monitor
      extended byorg.opennms.netmgt.poller.monitors.SnmpMonitor
All Implemented Interfaces:
ServiceMonitor

public final class SnmpMonitor
extends IPv4Monitor

This class is designed to be used by the service poller framework to test the availability of the SNMP service on remote interfaces. The class implements the ServiceMonitor interface that allows it to be used along with other plug-ins by the service poller framework.

Author:
Tarus Balog , Mike Davidson , OpenNMS

Field Summary
private static java.lang.String DEFAULT_OBJECT_IDENTIFIER
          Default object to collect if "oid" property not available.
private static int DEFAULT_PORT
           The default port on which the host is checked to see if it supports SNMP.
(package private) static java.lang.String EQUALS
           
(package private) static java.lang.String GREATER_THAN
           
(package private) static java.lang.String GREATER_THAN_EQUALS
           
(package private) static java.lang.String LESS_THAN
          Constant for less-than operand
(package private) static java.lang.String LESS_THAN_EQUALS
           
(package private) static java.lang.String MATCHES
           
(package private) static java.lang.String NOT_EQUAL
           
private static java.lang.String SERVICE_NAME
          Name of monitored service.
(package private) static java.lang.String SNMP_PEER_KEY
          Interface attribute key used to store the interface's JoeSNMP SnmpPeer object.
 
Fields inherited from interface org.opennms.netmgt.poller.monitors.ServiceMonitor
SERVICE_AVAILABLE, SERVICE_STATUS_MASK, SERVICE_UNAVAILABLE, SERVICE_UNKNOWN, SERVICE_UNRESPONSIVE, SURPRESS_EVENT_MASK
 
Constructor Summary
SnmpMonitor()
           
 
Method Summary
 void initialize(NetworkInterface iface)
           Called by the poller framework when an interface is being added to the scheduler.
 void initialize(PollerConfig pollerConfig, java.util.Map parameters)
           Initialize the service monitor.
 boolean meetsCriteria(SnmpSyntax result, java.lang.String operator, java.lang.String operand)
          Verifies that the result of the SNMP query meets the criteria specified by the operator and the operand from the configuartion file.
 int poll(NetworkInterface iface, java.util.Map parameters, Package pkg)
           The poll() method is responsible for polling the specified address for SNMP service availability.
 java.lang.String serviceName()
           Returns the name of the service that the plug-in monitors ("SNMP").
 
Methods inherited from class org.opennms.netmgt.poller.monitors.IPv4Monitor
release, release
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVICE_NAME

private static final java.lang.String SERVICE_NAME
Name of monitored service.

See Also:
Constant Field Values

DEFAULT_PORT

private static int DEFAULT_PORT

The default port on which the host is checked to see if it supports SNMP.


DEFAULT_OBJECT_IDENTIFIER

private static final java.lang.String DEFAULT_OBJECT_IDENTIFIER
Default object to collect if "oid" property not available.

See Also:
Constant Field Values

SNMP_PEER_KEY

static final java.lang.String SNMP_PEER_KEY
Interface attribute key used to store the interface's JoeSNMP SnmpPeer object.

See Also:
Constant Field Values

LESS_THAN

static final java.lang.String LESS_THAN
Constant for less-than operand

See Also:
Constant Field Values

GREATER_THAN

static final java.lang.String GREATER_THAN
See Also:
Constant Field Values

LESS_THAN_EQUALS

static final java.lang.String LESS_THAN_EQUALS
See Also:
Constant Field Values

GREATER_THAN_EQUALS

static final java.lang.String GREATER_THAN_EQUALS
See Also:
Constant Field Values

EQUALS

static final java.lang.String EQUALS
See Also:
Constant Field Values

NOT_EQUAL

static final java.lang.String NOT_EQUAL
See Also:
Constant Field Values

MATCHES

static final java.lang.String MATCHES
See Also:
Constant Field Values
Constructor Detail

SnmpMonitor

public SnmpMonitor()
Method Detail

serviceName

public java.lang.String serviceName()

Returns the name of the service that the plug-in monitors ("SNMP").

Returns:
The service that the plug-in monitors.

initialize

public void initialize(PollerConfig pollerConfig,
                       java.util.Map parameters)

Initialize the service monitor.

Specified by:
initialize in interface ServiceMonitor
Overrides:
initialize in class IPv4Monitor
Parameters:
parameters - Not currently used.
Throws:
java.lang.RuntimeException - Thrown if an unrecoverable error occurs that prevents the plug-in from functioning.

initialize

public void initialize(NetworkInterface iface)

Called by the poller framework when an interface is being added to the scheduler. Here we perform any necessary initialization to prepare the NetworkInterface object for polling.

Specified by:
initialize in interface ServiceMonitor
Overrides:
initialize in class IPv4Monitor
Parameters:
iface - The network interface to be initialized.
Throws:
java.lang.RuntimeException - Thrown if an unrecoverable error occurs that prevents the interface from being monitored.

poll

public int poll(NetworkInterface iface,
                java.util.Map parameters,
                Package pkg)

The poll() method is responsible for polling the specified address for SNMP service availability.

Parameters:
iface - The network interface to test the service on.
parameters - The package parameters (timeout, retry, etc...) to be used for this poll.
Returns:
The availability of the interface and if a transition event should be supressed.
Throws:
java.lang.RuntimeException - Thrown for any uncrecoverable errors.
See Also:
ServiceMonitor.SURPRESS_EVENT_MASK, ServiceMonitor.SERVICE_AVAILABLE, ServiceMonitor.SERVICE_UNAVAILABLE

meetsCriteria

public boolean meetsCriteria(SnmpSyntax result,
                             java.lang.String operator,
                             java.lang.String operand)
Verifies that the result of the SNMP query meets the criteria specified by the operator and the operand from the configuartion file.

Parameters:
result -
operator -
operand -
Returns:

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.