Class JDBCMonitor
- java.lang.Object
-
- org.opennms.netmgt.poller.support.AbstractServiceMonitor
-
- org.opennms.netmgt.poller.monitors.support.ParameterSubstitutingMonitor
-
- org.opennms.netmgt.poller.monitors.JDBCMonitor
-
- All Implemented Interfaces:
ServiceMonitor
- Direct Known Subclasses:
JDBCQueryMonitor
,JDBCStoredProcedureMonitor
public class JDBCMonitor extends ParameterSubstitutingMonitor
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. Seesrc/services/org/opennms/netmgt/poller
OpenNMS plugin information at OpenNMS developer site- Since:
- 0.1
- Version:
- $Id: $
- 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
Fields Modifier and Type Field Description static int
DEFAULT_RETRY
Default number of times to retry a teststatic int
DEFAULT_TIMEOUT
Number of milliseconds to wait before timing out a database login JDBC Hint: 1 minute is 60000 milliseconds.static org.slf4j.Logger
LOG
-
Constructor Summary
Constructors Constructor Description JDBCMonitor()
Class constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PollStatus
checkDatabaseStatus(java.sql.Connection con, java.util.Map<java.lang.String,java.lang.Object> parameters)
checkDatabaseStatusprotected void
closeStmt(java.sql.Statement statement)
closeStmtPollStatus
poll(MonitoredService svc, java.util.Map<java.lang.String,java.lang.Object> parameters)
This method is the heart of the plug-in monitor.-
Methods inherited from class org.opennms.netmgt.poller.monitors.support.ParameterSubstitutingMonitor
getRuntimeAttributes, getSubstitutedParameters, parseString, resolveKeyedString
-
Methods inherited from class org.opennms.netmgt.poller.support.AbstractServiceMonitor
getEffectiveLocation, getKeyedBoolean, getKeyedInstance, getKeyedInteger, getKeyedLong, getKeyedObject, getKeyedString, getServiceProperties
-
-
-
-
Field Detail
-
LOG
public static final org.slf4j.Logger LOG
-
DEFAULT_TIMEOUT
public static final int DEFAULT_TIMEOUT
Number of milliseconds to wait before timing out a database login JDBC Hint: 1 minute is 60000 milliseconds.- 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.- Throws:
java.lang.ClassNotFoundException
- if any.java.lang.InstantiationException
- if any.java.lang.IllegalAccessException
- if any.
-
-
Method Detail
-
poll
public PollStatus poll(MonitoredService svc, java.util.Map<java.lang.String,java.lang.Object> parameters)
This method is the heart of the plug-in monitor. Each time an interface requires a check to be performed as defined by the scheduler the poll method is invoked. The poll is passed the service to check.
By default when the status transition from up to down or vice versa the framework will generate an event. Additionally, if the polling interval changes due to an extended unavailability, the framework will generate an additional down event. The plug-in can suppress the generation of the default events by setting the suppress event bit in the returned integer.
NOTE: This method may be invoked on a Minion, in which case certain bean and facilities will not be available. If any state related information is required such as agent related configuration, it should retrieved by the
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.ServiceMonitor.getRuntimeAttributes(MonitoredService, Map)
.- Parameters:
svc
- Includes details about to the service being monitored.parameters
- Includes the service parameters defined in poller-configuration.xml and those returned byServiceMonitor.getRuntimeAttributes(MonitoredService, Map)
.- Returns:
- The availability of the interface and if a transition event should be suppressed.
- See Also:
org.opennms.netmgt.poller.ServiceMonitor#SERVICE_AVAILABLE
,org.opennms.netmgt.poller.ServiceMonitor#SERVICE_UNAVAILABLE
,org.opennms.netmgt.poller.ServiceMonitor#SERVICE_UNRESPONSIVE
, Error codes for JConnect
-
closeStmt
protected void closeStmt(java.sql.Statement statement)
closeStmt
- Parameters:
statement
- aStatement
object.
-
checkDatabaseStatus
public PollStatus checkDatabaseStatus(java.sql.Connection con, java.util.Map<java.lang.String,java.lang.Object> parameters)
checkDatabaseStatus
- Parameters:
con
- aConnection
object.parameters
- aMap
object.- Returns:
- a
PollStatus
object.
-
-