OpenNMS API 1.1.3

org.opennms.netmgt.poller
Class JDBCMonitor

java.lang.Object
  extended byorg.opennms.netmgt.poller.IPv4LatencyMonitor
      extended byorg.opennms.netmgt.poller.JDBCMonitor
All Implemented Interfaces:
ServiceMonitor

final 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.
(package private) static java.lang.String DS_NAME
          RRD data source name which doubles as the RRD file name.
(package private)  Interface m_rrdInterface
          Interface object which provides access to RRD functions via JNI.
 
Fields inherited from interface org.opennms.netmgt.poller.ServiceMonitor
SERVICE_AVAILABLE, SERVICE_STATUS_MASK, SERVICE_UNAVAILABLE, SERVICE_UNRESPONSIVE, SURPRESS_EVENT_MASK
 
Constructor Summary
JDBCMonitor()
          Class constructor.
 
Method Summary
 boolean createRRD(Interface rrdJniInterface, java.lang.String repository, java.net.InetAddress addr, java.lang.String dsName, Package pkg)
          Create an RRD database file for storing latency/response time data.
 void initialize(java.util.Map parameters)
          This method is called after the framework loads the plugin.
 void initialize(NetworkInterface iface)
          This method is called when an interface that support the service is added to the scheduling service.
 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.
 void updateRRD(Interface rrdJniInterface, java.lang.String repository, java.net.InetAddress addr, java.lang.String dsName, long value, Package pkg)
          Update an RRD database file with latency/response time data.
 
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

m_rrdInterface

Interface m_rrdInterface
Interface object which provides access to RRD functions via JNI.


DS_NAME

static java.lang.String DS_NAME
RRD data source name which doubles as the RRD file name.

Constructor Detail

JDBCMonitor

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

Method Detail

initialize

public void initialize(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

createRRD

public boolean createRRD(Interface rrdJniInterface,
                         java.lang.String repository,
                         java.net.InetAddress addr,
                         java.lang.String dsName,
                         Package pkg)
Create an RRD database file for storing latency/response time data.

Parameters:
rrdJniInterface - interface used to issue RRD commands.
repository - path to the RRD file repository
addr - interface address
dsName - data source/RRD file name
Returns:
true if RRD file successfully created, false otherwise

updateRRD

public void updateRRD(Interface rrdJniInterface,
                      java.lang.String repository,
                      java.net.InetAddress addr,
                      java.lang.String dsName,
                      long value,
                      Package pkg)
Update an RRD database file with latency/response time data.

Parameters:
rrdJniInterface - interface used to issue RRD commands.
repository - path to the RRD file repository
addr - interface address
value - value to update the RRD file with
Returns:
true if RRD file successfully created, false otherwise

OpenNMS API 1.1.3

Generated by root on August 19 2004 0130.