OpenNMS API 1.2.9

## org.opennms.netmgt.poller.monitors
Class JDBCMonitor

    java.lang.Object
      org.opennms.netmgt.poller.monitors.IPv4LatencyMonitor
          org.opennms.netmgt.poller.monitors.JDBCMonitor

All Implemented Interfaces:
  ServiceMonitor

Direct Known Subclasses:
  JDBCStoredProcedureMonitor

public class JDBCMonitor
extends IPv4LatencyMonitor

This class implements a basic JDBC monitoring framework; The idea is than these tests doesn't take too long (or too much resources to run) and provide the basic healt information about the polled server. See `src/services/org/opennms/netmgt/poller` OpenNMS plugin information at OpenNMS developer site

Since:
  0.1
Author:
  Jose Vicente Nunez Zuleta (josevnz@users.sourceforge.net) - RHCE, SJCD, SJCP version 0.1 - 07/23/2002 * version 0.2 - 08/05/2002 -- Added retry logic, input validations to poller.

Field Summary
`static int` `DEFAULT_RETRY` Default number of times to retry a test
`static int` `DEFAULT_TIMEOUT` Number of miliseconds to wait before timing out a database login using JDBC Hint: 1 minute is 6000 miliseconds.

Fields inherited from class org.opennms.netmgt.poller.monitors.IPv4LatencyMonitor
`DS_NAME`

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
`JDBCMonitor()` Class constructor.

Method Summary
`int` `checkStatus(org.apache.log4j.Category log, java.util.Map parameters, java.sql.Connection con)`
`void` `initialize(NetworkInterface iface)` This method is called when an interface that support the service is added to the scheduling service.
`void` `initialize(PollerConfig pollerConfig, java.util.Map parameters)` This method is called after the framework loads the plugin.
`int` `poll(NetworkInterface iface, java.util.Map parameters, Package pkg)` Network interface to poll for a given service.
`void` `release()` Release any used services by the plugin,normally during framework exit For now this method is just an 'adaptor', does nothing
`void` `release(NetworkInterface iface)` This method is the called whenever an interface is being removed from the scheduler.

Methods inherited from class org.opennms.netmgt.poller.monitors.IPv4LatencyMonitor
`createRRD, updateRRD`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_TIMEOUT

    public static final int DEFAULT_TIMEOUT

  Number of miliseconds to wait before timing out a database login using JDBC Hint: 1 minute is 6000 miliseconds.

  See Also:
    Constant Field Values

### DEFAULT_RETRY

    public static final int DEFAULT_RETRY

  Default number of times to retry a test

  See Also:
    Constant Field Values

Constructor Detail

### JDBCMonitor

    public JDBCMonitor()
                throws java.lang.ClassNotFoundException,
                       java.lang.InstantiationException,
                       java.lang.IllegalAccessException

  Class constructor.

Method Detail

### initialize

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

  This method is called after the framework loads the plugin.

  Specified by:
    `initialize` in interface `ServiceMonitor`
  Overrides:
    `initialize` in class `IPv4LatencyMonitor`
  Parameters:
    `parameters` - Configuration parameters passed to the plugin
  Throws:
    `java.lang.RuntimeException` - If there is any error that prevents the plugin from running

### release

    public void release()

  Release any used services by the plugin,normally during framework exit For now this method is just an 'adaptor', does nothing

  Specified by:
    `release` in interface `ServiceMonitor`
  Overrides:
    `release` in class `IPv4LatencyMonitor`
  Throws:
    `java.lang.RuntimeException` - Thrown if an error occurs during deallocation.

### initialize

    public void initialize(NetworkInterface iface)

  This method is called when an interface that support the service is added to the scheduling service.

  Specified by:
    `initialize` in interface `ServiceMonitor`
  Overrides:
    `initialize` in class `IPv4LatencyMonitor`
  Parameters:
    `iface` - The network interface to poll
  Throws:
    `java.lang.RuntimeException` - Thrown if an unrecoverable error occurs that prevents the interface from being monitored.
    `NetworkInterfaceNotSupportedException` - Thrown if the passed interface is invalid for this monitor.

### release

    public void release(NetworkInterface iface)

  This method is the called whenever an interface is being removed from the scheduler. For now this method is just an 'adaptor', does nothing

  Specified by:
    `release` in interface `ServiceMonitor`
  Overrides:
    `release` in class `IPv4LatencyMonitor`
  Parameters:
    `iface` - The network interface that was being monitored.
  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)

  Network interface to poll for a given service. Make sure you're using the latest (at least 5.5) JConnect version or the plugin will not be able to tell exactly if the service is up or not.

  Parameters:
    `iface` - The interface to poll
    `parameters` - Parameters to pass when polling the interface Currently recognized Map keys:
    - user - Database user
    - password - User password
    - port - server port
    - timeout - Number of miliseconds to wait before sending a timeout
    - driver - The JDBC driver to use
    - url - The vendor specific jdbc URL
  Returns:
    int An status code that shows the status of the service
  Throws:
    `java.lang.RuntimeException` - Thrown if an unrecoverable error occurs that prevents the interface from being monitored.
  See Also:
    `ServiceMonitor.SURPRESS_EVENT_MASK`, `ServiceMonitor.SERVICE_AVAILABLE`, `ServiceMonitor.SERVICE_UNAVAILABLE`, `ServiceMonitor.SERVICE_UNRESPONSIVE`, Error codes for JConnect

### checkStatus

    public int checkStatus(org.apache.log4j.Category log,
                           java.util.Map parameters,
                           java.sql.Connection con)

OpenNMS API 1.2.9

Generated by ranger on May 19 2007 2335.