Code

Merge branch 'collectd-3.11' into collectd-4.0
[collectd.git] / src / collectd-unixsock.pod
1 =head1 NAME
3 collectd-unixsock - Documentation of collectd's C<unixsock plugin>
5 =head1 SYNOPSIS
7   # See collectd.conf(5)
8   LoadPlugin unixsock
9   # ...
10   <Plugin unixsock>
11     SocketFile "/path/to/socket"
12     SocketGroup "collectd"
13     SocketPerms "0770"
14   </Plugin>
16 =head1 DESCRIPTION
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
21 collectd.
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.
26 =head1 COMMANDS
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:
34 =over 4
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 separated list of
40 name-value-pairs:
42 I<num> I<name>B<=>I<value>[ I<name>B<=>I<value>[ ...]]
44 If I<num> is less then zero, an error occurred. 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>.
49 Example:
50   -> | GETVAL myhost/cpu-0/cpu-user
51   <- | 1 value=1.260000e+00
53 =item B<PUTVAL> I<Identifier> I<Valuelist>
55 Submits a value (identified by I<Identifier>, see below) to the daemon which
56 will dispatch it to all it's write-plugins. The I<Valuelist> is a
57 colon-separated list of the time and the values, each either an integer if the
58 data-source is a counter, of a double if the data-source if of type "gauge".
59 You can submit an undefined gauge-value by using B<U>. When submitting B<U> to
60 a counter the behavior is undefined. The time is given as epoch (i.E<nbsp>e.
61 standard UNIX time).
63 Example:
64   -> | PUTVAL testhost/interface/if_octets-test0 1179574444:123:456
65   <- | 0 Success
67 =back
69 =head2 Identifiers
71 Value or value-lists are identified in a uniform fashion:
73 I<Hostname>/I<Plugin>/I<Type>
75 Where I<Plugin> and I<Type> are both either of type "I<Name>" or
76 "I<Name>-I<Instance>". This sounds more complicated than it is, so here are
77 some examples:
79   myhost/cpu-0/cpu-user
80   myhost/load/load
81   myhost/memory/memory-used
82   myhost/disk-sda/disk_octets
84 =head2 Return values
86 Unless otherwise noted the plugin answers with a line of the following form:
88 I<Num> I<Message>
90 If I<Num> is zero the message indicates success, if I<Num> is non-zero the
91 message indicates failure. I<Message> is a human-readable string that describes
92 the return value further.
94 Commands that return values may use I<Num> to return the number of values that
95 follow, such as the B<GETVAL> command. These commands usually return a negative
96 value on failure and never return zero.
98 =head1 ABSTRACTION LAYER
100 Shipped with the sourcecode comes the Perl-Module L<Collectd::Unixsock> which
101 provides an abstraction layer over the actual socket connection. It can be
102 found in the directory F<contrib/PerlLib>. If you want to use Perl to
103 communicate with the daemon, you're encouraged to use and expand this module.
105 =head1 SEE ALSO
107 L<collectd(1)>,
108 L<collectd.conf(5)>,
109 L<collectd-nagios(1)>,
110 L<unix(7)>
112 =head1 AUTHOR
114 Florian Forster E<lt>octo@verplant.orgE<gt>
116 =cut