[collectd] perl notification plug-in

Sebastian Harl sh at tokkee.org
Mon Oct 13 17:43:52 CEST 2008


Hi Martin,

On Mon, Oct 13, 2008 at 02:59:04PM +0200, Martin Janota wrote:
> I am trying to set up collectd for monitoring of networked computers. I 
> have created an exec plug-in for management of notifications, it works 
> fine. However, I would also like my plug-in to utilise same options as 
> perl-plugin so that it behaves as perl-plug-in. I could not however find 
> how to receive notifications if it is at all possible.

This is possible starting with version 4.3.0 of collectd.

To receive notifications, you need to register a "notification callback"
with collectd. This is done using the plugin_register() function. The
daemon then calls the registered callback (a Perl subroutine) whenever a
notification has been dispatched. The notification (represented as a
reference to a Perl hash) will be passed as the only argument to the
callback. See the collectd-perl(5) manpage for details.

An example can be found in contrib/examples/MyPlugin.pm in the collectd
source distribution [1]. The relevant parts for handling notifications
are the call to plugin_register(TYPE_NOTIF, ...) on line 42 and the
subroutine called "my_notify" starting on line 136.

If you have any suggestions (or even better: patches) how to improve the
documentation (i.e. the collectd-perl(5) manpage), please let us know.

HTH,
Sebastian

[1]
http://git.verplant.org/?p=collectd.git;a=blob;f=contrib/examples/MyPlugin.pm

-- 
Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/

Those who would give up Essential Liberty to purchase a little Temporary
Safety, deserve neither Liberty nor Safety.         -- Benjamin Franklin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20081013/dfe4731e/attachment.pgp 


More information about the collectd mailing list