|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.jnrpe.plugins.PluginBase
public abstract class PluginBase
This class facilitates the implementation of plugins. If you don't need to
extend other classes, than extending PluginBase
is the best way.
This class gives you out of the box:
log
variable.
gatherMetrics(ICommandLine)
you can demand to this class all the
work required to evaluate thresholds. If you use the new threshold syntax,
all the configuration is done automatically. Otherwise you just have to
override the
configureThresholdEvaluatorBuilder(ThresholdsEvaluatorBuilder, ICommandLine)
to set the all the thresholds.
Constructor Summary | |
---|---|
PluginBase()
|
Method Summary | |
---|---|
void |
addListener(IJNRPEEventListener listener)
Adds a new listener to the list of objects that will receive the messages sent by this class. |
void |
addListeners(Collection<IJNRPEEventListener> listeners)
Adds a new collection of listeners. |
void |
configureThresholdEvaluatorBuilder(ThresholdsEvaluatorBuilder thrb,
ICommandLine cl)
Override this method if you don't use the new threshold syntax. |
ReturnValue |
execute(ICommandLine cl)
Executes the plugin. |
Collection<Metric> |
gatherMetrics(ICommandLine cl)
This method must be overridden if you don't override the execute(ICommandLine) method. |
void |
sendEvent(LogEvent evt,
String message)
Sends an event. |
void |
sendEvent(LogEvent evt,
String message,
Exception exc)
Sends an event. |
void |
sendEvent(String customEventName,
EventParam... paramsAry)
Sends a custom event. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PluginBase()
Method Detail |
---|
public final void addListener(IJNRPEEventListener listener)
addListener
in interface IPluginInterfaceEx
listener
- The new listenerpublic final void addListeners(Collection<IJNRPEEventListener> listeners)
addListeners
in interface IPluginInterfaceEx
listeners
- The collection of listeners to be addedpublic final void sendEvent(LogEvent evt, String message)
evt
- The event typemessage
- The messagepublic final void sendEvent(LogEvent evt, String message, Exception exc)
evt
- The event typemessage
- The messageexc
- The exception to be attached to the eventpublic final void sendEvent(String customEventName, EventParam... paramsAry)
customEventName
- The custom event identifierparamsAry
- The parameter of the event. Can be null.public void configureThresholdEvaluatorBuilder(ThresholdsEvaluatorBuilder thrb, ICommandLine cl) throws BadThresholdException
thrb
- The ThresholdsEvaluatorBuilder
object to be configuredcl
- The command line
BadThresholdException
- -public Collection<Metric> gatherMetrics(ICommandLine cl) throws MetricGatheringException
execute(ICommandLine)
method. This way you can demand all the
work about evaluating the thresholds to this class.
cl
- The command line.
MetricGatheringException
- -public ReturnValue execute(ICommandLine cl) throws BadThresholdException
gatherMetrics(ICommandLine)
instead.
execute
in interface IPluginInterface
cl
- The command line
BadThresholdException
- -
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |