From: Sebastian Harl Date: Mon, 28 Jan 2008 11:23:55 +0000 (+0100) Subject: collectd-perl(5): Added documentation for the notification support. X-Git-Tag: collectd-4.3.0beta0~6 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=f4e4ec1d94cbeac4cb59a6d282091d097be5e25d;p=collectd.git collectd-perl(5): Added documentation for the notification support. Some minor errors have been fixed as well and the ChangeLog has been updated. Signed-off-by: Sebastian Harl Signed-off-by: Florian Forster --- diff --git a/ChangeLog b/ChangeLog index 5c6f22df..f8c40e20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,6 @@ yyyy-mm-dd, Version 4.3.0 * collectd: Notifications have been added to the daemon. Notifications - are status messages that may be associated with an data instance. + are status messages that may be associated with a data instance. * collectd: Threshold checking has been added to the daemon. This means that you can configure threshold values for each data instance. If this threshold is exceeded a notification will be @@ -23,9 +23,9 @@ yyyy-mm-dd, Version 4.3.0 domain name lookups in this plugin. * perl plugin: Many internal changes added support for handling multiple threads making the plugin reasonably usable inside collectd. The API has - been extended to export global variables to Perl plugins; callbacks now - have to be identified by name rather than a pointer to a subroutine. The - plugin is no longer experimental. + been extended to support notifications and export global variables to + Perl plugins; callbacks now have to be identified by name rather than a + pointer to a subroutine. The plugin is no longer experimental. * uuid plugin: The new UUID plugin sets the hostname to an unique identifier for this host. This is meant for setups where each client may migrate to another physical host, possibly going through one or diff --git a/src/collectd-perl.pod b/src/collectd-perl.pod index 194aa54e..4a01d146 100644 --- a/src/collectd-perl.pod +++ b/src/collectd-perl.pod @@ -97,6 +97,15 @@ once for each call to B. This type of function is used to pass messages of plugins or the daemon itself to the user. +=item notification function + +This type of function is used to act upon notifications. In general, a +notification is a status message that may be associated with a data instance. +Usually, a notification is generated by the daemon if a configured threshold +has been exceeded (see the section "THRESHOLD CONFIGURATION" in +L for more details), but any plugin may dispatch +notifications as well. + =item shutdown functions This type of function is called once before the daemon shuts down. It should @@ -104,8 +113,9 @@ be used to clean up the plugin (e.g. close sockets, ...). =back -Any function may set the B<$@> variable to describe errors in more detail. The -message will be passed on to the user using collectd's logging mechanism. +Any function (except log functions) may set the B<$@> variable to describe +errors in more detail. The message will be passed on to the user using +collectd's logging mechanism. See the documentation of the B method in the section "METHODS" below for the number and types of arguments passed to each @@ -132,7 +142,7 @@ structure. The general layout looks like this: [{ name => 'data_source_name', - type => DS_TYPE_COUNTER || DS_TYPE_GAUGE + type => DS_TYPE_COUNTER || DS_TYPE_GAUGE, min => value || undef, max => value || undef }, ...] @@ -148,12 +158,28 @@ layout looks like this: { values => [123, 0.5], time => time (), - host => 'localhost', + host => $hostname_g, plugin => 'myplugin', plugin_instance => '', type_instance => '' } +=item Notification + +A notification is one structure defining the severity, time and message of the +status message as well as an identification of a data instance: + + { + severity => NOTIF_FAILURE || NOTIF_WARNING || NOTIF_OKAY, + time => time (), + message => 'status message', + host => $hostname_g, + plugin => 'myplugin', + type => 'mytype', + plugin_instance => '', + type_instance => '' + } + =back =head1 METHODS @@ -179,6 +205,8 @@ I can be one of: =item TYPE_LOG +=item TYPE_NOTIF + =item TYPE_SHUTDOWN =item TYPE_DATASET @@ -232,6 +260,11 @@ level is B, the most important level is B. In between there are (from least to most important): B, B, and B. I is simply a string B a newline at the end. +=item TYPE_NOTIF + +The only argument passed is I. See above for the layout of this +data type. + =back =item B (I, I) @@ -246,6 +279,11 @@ is found (and the number of values matches the number of data-sources) then the type, data-set and value-list is passed to all write-callbacks that are registered with the daemon. +=item B (I) + +Submits a I to the daemon which will then pass it to all +notification-callbacks that are registered. + =item B (I, I) Submits a I of level I to collectd's logging mechanism. @@ -294,6 +332,8 @@ available (B<:all> will export all of them): =item B () +=item B () + =item B () =back @@ -350,6 +390,18 @@ available (B<:all> will export all of them): =back +=item B<:notif> + +=over 4 + +=item B + +=item B + +=item B + +=back + =item B<:globals> =over 4 @@ -429,8 +481,9 @@ plugin will be mapped to a Perl interpreter thread (see L). Any such thread will be created and destroyed transparently and on-the-fly. Hence, any plugin has to be thread-safe if it provides several entry points -from collectd (i.Ee. if it registers more than one callback). Please -note that no data is shared between threads by default. You have to use the +from collectd (i.Ee. if it registers more than one callback or if a +registered callback may be called more than once in parallel). Please note +that no data is shared between threads by default. You have to use the B module to do so. =item