App::Wubot::Check - perform checks for an instance of a monitor


version 0.3.10


    use App::Wubot::Check


This class managed a single instance of a monitor. It initializes the instance of the monitor and performs the check() method. It handles any configuration for the monitor, messages sent by the monitor, and monitor cache data. It also sends any messages produces by the instance through the reactor.


$obj->init( $config );

Initialize an instance of a monitor. This is only done once, when the monitoring engine starts up.

Any persisted cache data for the monitor will be read in.

If the monitor plugin defines the 'init' method, that method will be called for the instance.

If the init method produces any messages, they will be sent through the reactor.

The cache data will be written back out after the init() method is called.

$obj->check( $config )

Performs a single check of the monitor instance.

Any updated cache data will first be read in.

The check() method will then be called on the monitor instance. Both the instance configuration and cache data will be passed to the check() method.

An alarm will be set before the check() method is called to cancel the check if it runs longer than the expected time limit. The default timeout is 30 seconds, although this may be configured by setting the 'timeout' parameter in the check config.

If any messages are generated by the check() method, they will be passed through the reactor.

The cache will only be written back out after the check() method completes and the reactor has processed any messages.

$obj->enqueue_results( $results )

Add any messages generated by monitor instances to the reactor queue.

The reactor queue is for use by the separate reactor process. Note that this happens after any reactor rules defined directly on the monitor instance have been run.

The instance plugin class and key field will be added to any messages before adding them to the queue. Each unique monitor instance is defined by the combination of the 'plugin' plus 'key' field. If either 'plugin' or 'key' is already defined, they will not be overwritten. This ensures that results that are produced by one plugin and then collected by another plugin (e.g. on a remote host).