|
||||||||||
| 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.
| Nested Class Summary | |
|---|---|
protected class |
PluginBase.Logger
This class represent a generic logger that will be used by plugins extending the PluginBase to write logs. |
| Field Summary | |
|---|---|
protected PluginBase.Logger |
log
The logger object. |
| 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. |
protected Set<IJNRPEEventListener> |
getListeners()
Returns all the registered listeners. |
protected abstract String |
getPluginName()
|
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 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final PluginBase.Logger log
| Constructor Detail |
|---|
public PluginBase()
| Method Detail |
|---|
public final void addListener(IJNRPEEventListener listener)
addListener in interface IPluginInterfaceExlistener - The new listenerpublic final void addListeners(Collection<IJNRPEEventListener> listeners)
addListeners in interface IPluginInterfaceExlisteners - The collection of listeners to be added
public final void sendEvent(LogEvent evt,
String message)
evt - The event typemessage - The message
public final void sendEvent(LogEvent evt,
String message,
Exception exc)
evt - The event typemessage - The messageexc - The exception to be attached to the event
public final void sendEvent(String customEventName,
EventParam... paramsAry)
customEventName - The custom event identifierparamsAry - The parameter of the event. Can be null.protected abstract String getPluginName()
protected final Set<IJNRPEEventListener> getListeners()
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 IPluginInterfacecl - The command line
BadThresholdException - -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||