collectd-unixsock(5): Added a note about Collectd::Unixsock.
[collectd.git] / src / collectd-unixsock.pod
1 =head1 NAME
2
3 collectd-unixsock - Documentation of collectd's C<unixsock plugin>
4
5 =head1 SYNOPSIS
6
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>
15
16 =head1 DESCRIPTION
17
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.
22
23 =head1 COMMANDS
24
25 Upon start the C<unixsock plugin> opens a UNIX-socket and waits for
26 connections. Once a connection is established the client can send commands to
27 the daemon which it will answer, if it understand them.
28
29 The following commands are implemented:
30
31 =over 4
32
33 =item B<GETVAL> I<Identifier>
34
35 If the value identified by I<Identifier> (see below) is found the complete
36 value-list is returned. The response is a space seperated list of
37 name-value-pairs:
38
39 I<num> I<name>B<=>I<value>[ I<name>B<=>I<value>[ ...]]
40
41 If I<num> is less then zero, an error occured. Otherwise it contains the
42 number of values that follow. Each value is of the form I<name>B<=>I<value>.
43 Counter-values are converted to a rate, e.E<nbsp>g. bytes per second.
44 Undefined values are returned as B<NaN>.
45
46 Example:
47   -> | GETVAL myhost/cpu-0/cpu-user
48   <- | 1 value=1.260000e+00
49
50 =item B<PUTVAL> I<Identifier> I<Valuelist>
51
52 Submits a value (identified by I<Identifier>, see below) to the daemon which
53 will dispatch it to all it's write-plugins. The I<Valuelist> is a
54 colon-seperated list of values, either an integer if the data-source is a
55 counter, of a double if the data-source if of type "gauge". You can submit an
56 undefined gauge-value by using B<U>. When submitting B<U> to a counter the
57 behavior is undefined.
58
59 Example:
60   -> | PUTVAL testhost/interface/if_octets-test0 1179574444:123:456
61   <- | 0 Success
62
63 =back
64
65 =head2 Identifiers
66
67 Value or value-lists are identified in a uniform fassion:
68
69 I<Hostname>/I<Plugin>/I<Type>
70
71 Where I<Plugin> and I<Type> are both either of type "I<Name>" or
72 "I<Name>-I<Instance>". This sounds more complicated than it is, so here are
73 some examples:
74
75   myhost/cpu-0/cpu-user
76   myhost/load/load
77   myhost/memory/memory-used
78   myhost/disk-sda/disk_octets
79
80 =head2 Return values
81
82 Unless otherwise noted the plugin answers with a line of the following form:
83
84 I<Num> I<Message>
85
86 If I<Num> is zero the message indicates success, if I<Num> is non-zero the
87 message indicates failure. I<Message> is a human-readable string that describes
88 the return value further.
89
90 Commands that return values may use I<Num> to return the number of values that
91 follow, such as the B<GETVAL> command. These commands usually return a negative
92 value on failure and never return zero.
93
94 =head1 ABSTRACTION LAYER
95
96 Shipped with the sourcecode comes the Perl-Module L<Collectd::Unixsock> which
97 provides an abstraction layer over the actual socket connection. It can be
98 found in the directory F<contrib/PerlLib>. If you want to use Perl to
99 communicate with the daemon, you're encouraged to use and expand this module.
100
101 =head1 SEE ALSO
102
103 L<collectd(1)>, L<collectd.conf(5)>, L<unix(7)>
104
105 =head1 AUTHOR
106
107 Florian Forster E<lt>octo@verplant.orgE<gt>
108
109 =cut