3 collectd-unixsock - Documentation of collectd's C<unixsock plugin>
11 SocketFile "/path/to/socket"
12 SocketGroup "collectd"
18 The C<unixsock plugin> opens an UNIX-socket over which one can interact with
19 the daemon. This can be used to use the values collected by collectd in other
20 applications, such as monitoring, or submit externally collected values to
23 This plugin is used by L<collectd-nagios(1)> to check if some value is in a
24 certain range and exit with a Nagios-compatible exit code.
28 Upon start the C<unixsock plugin> opens a UNIX-socket and waits for
29 connections. Once a connection is established the client can send commands to
30 the daemon which it will answer, if it understand them.
32 The following commands are implemented:
36 =item B<GETVAL> I<Identifier>
38 If the value identified by I<Identifier> (see below) is found the complete
39 value-list is returned. The response is a space seperated list of
42 I<num> I<name>B<=>I<value>[ I<name>B<=>I<value>[ ...]]
44 If I<num> is less then zero, an error occured. Otherwise it contains the
45 number of values that follow. Each value is of the form I<name>B<=>I<value>.
46 Counter-values are converted to a rate, e.E<nbsp>g. bytes per second.
47 Undefined values are returned as B<NaN>.
50 -> | GETVAL myhost/cpu-0/cpu-user
51 <- | 1 value=1.260000e+00
55 Returnes a list of the values available in the value cache together with the
56 time of the last update, so that querying applications can issue a B<GETVAL>
57 command for the values that have changed.
59 The first line's status number is the number of identifiers returned or less
60 than zero if an error occured. Each of the following lines containes the
61 update time as an epoch value and the identifier, seperated by a space.
66 <- | 1182204284 leeloo/cpu-0/cpu-idle
67 <- | 1182204284 leeloo/cpu-0/cpu-nice
68 <- | 1182204284 leeloo/cpu-0/cpu-system
69 <- | 1182204284 leeloo/cpu-0/cpu-user
72 =item B<PUTVAL> I<Identifier> I<Valuelist>
74 Submits a value (identified by I<Identifier>, see below) to the daemon which
75 will dispatch it to all it's write-plugins. The I<Valuelist> is a
76 colon-seperated list of the time and the values, each either an integer if the
77 data-source is a counter, of a double if the data-source if of type "gauge".
78 You can submit an undefined gauge-value by using B<U>. When submitting B<U> to
79 a counter the behavior is undefined. The time is given as epoch (i.E<nbsp>e.
83 -> | PUTVAL testhost/interface/if_octets-test0 1179574444:123:456
90 Value or value-lists are identified in a uniform fassion:
92 I<Hostname>/I<Plugin>/I<Type>
94 Where I<Plugin> and I<Type> are both either of type "I<Name>" or
95 "I<Name>-I<Instance>". This sounds more complicated than it is, so here are
100 myhost/memory/memory-used
101 myhost/disk-sda/disk_octets
105 Unless otherwise noted the plugin answers with a line of the following form:
109 If I<Num> is zero the message indicates success, if I<Num> is non-zero the
110 message indicates failure. I<Message> is a human-readable string that describes
111 the return value further.
113 Commands that return values may use I<Num> to return the number of values that
114 follow, such as the B<GETVAL> command. These commands usually return a negative
115 value on failure and never return zero.
117 =head1 ABSTRACTION LAYER
119 Shipped with the sourcecode comes the Perl-Module L<Collectd::Unixsock> which
120 provides an abstraction layer over the actual socket connection. It can be
121 found in the directory F<contrib/PerlLib>. If you want to use Perl to
122 communicate with the daemon, you're encouraged to use and expand this module.
128 L<collectd-nagios(1)>,
133 Florian Forster E<lt>octo@verplant.orgE<gt>