1COLLECTD-UNIXSOCK(5)               collectd               COLLECTD-UNIXSOCK(5)
2
3
4

NAME

6       collectd-unixsock - Documentation of collectd's "unixsock plugin"
7

SYNOPSIS

9         # See collectd.conf(5)
10         LoadPlugin unixsock
11         # ...
12         <Plugin unixsock>
13           SocketFile "/path/to/socket"
14           SocketGroup "collectd"
15           SocketPerms "0770"
16           DeleteSocket false
17         </Plugin>
18

DESCRIPTION

20       The "unixsock plugin" opens an UNIX-socket over which one can interact
21       with the daemon. This can be used to use the values collected by
22       collectd in other applications, such as monitoring solutions, or submit
23       externally collected values to collectd.
24
25       For example, this plugin is used by collectd-nagios(1) to check if some
26       value is in a certain range and exit with a Nagios-compatible exit
27       code.
28

COMMANDS

30       Upon start the "unixsock plugin" opens a UNIX-socket and waits for
31       connections. Once a connection is established the client can send
32       commands to the daemon which it will answer, if it understand them.
33
34       In general the plugin answers with a status line of the following form:
35
36       Status Message
37
38       If Status is greater than or equal to zero the message indicates
39       success, if Status is less than zero the message indicates failure.
40       Message is a human-readable string that further describes the return
41       value.
42
43       On success, Status furthermore indicates the number of subsequent lines
44       of output (not including the status line). Each such lines usually
45       contains a single return value. See the description of each command for
46       details.
47
48       The following commands are implemented:
49
50       GETVAL Identifier
51           If the value identified by Identifier (see below) is found the
52           complete value-list is returned. The response is a list of name-
53           value-pairs, each pair on its own line (the number of lines is
54           indicated by the status line - see above). Each name-value-pair is
55           of the form name=value.  Counter-values are converted to a rate,
56           e. g. bytes per second.  Undefined values are returned as NaN.
57
58           Example:
59             -> | GETVAL myhost/cpu-0/cpu-user
60             <- | 1 Value found
61             <- | value=1.260000e+00
62
63       LISTVAL
64           Returns a list of the values available in the value cache together
65           with the time of the last update, so that querying applications can
66           issue a GETVAL command for the values that have changed. Each
67           return value consists of the update time as an epoch value and the
68           identifier, separated by a space. The update time is the time of
69           the last value, as provided by the collecting instance and may be
70           very different from the time the server considers to be "now".
71
72           Example:
73             -> | LISTVAL
74             <- | 69 Values found
75             <- | 1182204284 myhost/cpu-0/cpu-idle
76             <- | 1182204284 myhost/cpu-0/cpu-nice
77             <- | 1182204284 myhost/cpu-0/cpu-system
78             <- | 1182204284 myhost/cpu-0/cpu-user
79             ...
80
81       PUTVAL Identifier [OptionList] Valuelist
82           Submits one or more values (identified by Identifier, see below) to
83           the daemon which will dispatch it to all its write-plugins.
84
85           An Identifier is of the form "host/plugin-instance/type-instance"
86           with both instance-parts being optional. If they're omitted the
87           hyphen must be omitted, too. plugin and each instance-part may be
88           chosen freely as long as the tuple (plugin, plugin instance, type
89           instance) uniquely identifies the plugin within collectd. type
90           identifies the type and number of values (i. e. data-set) passed to
91           collectd. A large list of predefined data-sets is available in the
92           types.db file.
93
94           The OptionList is an optional list of Options, where each option is
95           a key-value-pair. A list of currently understood options can be
96           found below, all other options will be ignored. Values that contain
97           spaces must be quoted with double quotes.
98
99           Valuelist is a colon-separated list of the time and the values,
100           each either an integer if the data-source is a counter, or a double
101           if the data-source is of type "gauge". You can submit an undefined
102           gauge-value by using U. When submitting U to a counter the behavior
103           is undefined. The time is given as epoch (i. e. standard UNIX
104           time).
105
106           You can mix options and values, but the order is important: Options
107           only effect following values, so specifying an option as last field
108           is allowed, but useless. Also, an option applies to all following
109           values, so you don't need to re-set an option over and over again.
110
111           The currently defined Options are:
112
113           interval=seconds
114               Gives the interval in which the data identified by Identifier
115               is being collected.
116
117           Please note that this is the same format as used in the exec
118           plugin, see collectd-exec(5).
119
120           Example:
121             -> | PUTVAL testhost/interface/if_octets-test0 interval=10
122           1179574444:123:456
123             <- | 0 Success
124
125       PUTNOTIF [OptionList] message=Message
126           Submits a notification to the daemon which will then dispatch it to
127           all plugins which have registered for receiving notifications.
128
129           The PUTNOTIF command is followed by a list of options which further
130           describe the notification. The message option is special in that it
131           will consume the rest of the line as its value. The message,
132           severity, and time options are mandatory.
133
134           Valid options are:
135
136           message=Message (REQUIRED)
137               Sets the message of the notification. This is the message that
138               will be made accessible to the user, so it should contain some
139               useful information. As with all options: If the message
140               includes spaces, it must be quoted with double quotes. This
141               option is mandatory.
142
143           severity=failure|warning|okay (REQUIRED)
144               Sets the severity of the notification. This option is
145               mandatory.
146
147           time=Time (REQUIRED)
148               Sets the time of the notification. The time is given as
149               "epoch", i. e. as seconds since January 1st, 1970, 00:00:00.
150               This option is mandatory.
151
152           host=Hostname
153           plugin=Plugin
154           plugin_instance=Plugin-Instance
155           type=Type
156           type_instance=Type-Instance
157               These "associative" options establish a relation between this
158               notification and collected performance data. This connection is
159               purely informal, i. e. the daemon itself doesn't do anything
160               with this information. However, websites or GUIs may use this
161               information to place notifications near the affected graph or
162               table. All the options are optional, but plugin_instance
163               without plugin or type_instance without type doesn't make much
164               sense and should be avoided.
165
166           type:key=value
167               Sets user defined meta information. The type key is a single
168               character defining the type of the meta information.
169
170               The current supported types are:
171
172               s A string passed as-is.
173
174           Please note that this is the same format as used in the exec
175           plugin, see collectd-exec(5).
176
177           Example:
178             -> | PUTNOTIF type=temperature severity=warning time=1201094702
179           message=The roof is on fire!
180             <- | 0 Success
181
182       FLUSH [timeout=Timeout] [plugin=Plugin [...]] [identifier=Ident [...]]
183           Flushes all cached data older than Timeout seconds. If no timeout
184           has been specified, it defaults to -1 which causes all data to be
185           flushed.
186
187           If the plugin option has been specified, only the Plugin plugin
188           will be flushed. You can have multiple plugin options to flush
189           multiple plugins in one go. If the plugin option is not given all
190           plugins providing a flush callback will be flushed.
191
192           If the identifier option is given only the specified values will be
193           flushed.  This is meant to be used by graphing or displaying
194           frontends which want to have the latest values for a specific
195           graph. Again, you can specify the identifier option multiple times
196           to flush several values. If this option is not specified at all,
197           all values will be flushed.
198
199           Example:
200             -> | FLUSH plugin=rrdtool identifier=localhost/df/df-root
201           identifier=localhost/df/df-var
202             <- | 0 Done: 2 successful, 0 errors
203
204   Identifiers
205       Value or value-lists are identified in a uniform fashion:
206
207       Hostname/Plugin/Type
208
209       Where Plugin and Type are both either of type "Name" or
210       "Name-Instance". If the identifier includes spaces, it must be quoted
211       using double quotes. This sounds more complicated than it is, so here
212       are some examples:
213
214         myhost/cpu-0/cpu-user
215         myhost/load/load
216         myhost/memory/memory-used
217         myhost/disk-sda/disk_octets
218         "myups/snmp/temperature-Outlet 1"
219

ABSTRACTION LAYER

221       collectd ships the Perl-Module Collectd::Unixsock which provides an
222       abstraction layer over the actual socket connection. It can be found in
223       the directory bindings/perl/ in the source distribution or (usually)
224       somewhere near /usr/share/perl5/ if you're using a package. If you want
225       to use Perl to communicate with the daemon, you're encouraged to use
226       and expand this module.
227

SEE ALSO

229       collectd(1), collectd.conf(5), collectd-nagios(1), unix(7)
230

AUTHOR

232       Florian Forster <octo@collectd.org>
233
234
235
2365.9.2                             2019-09-16              COLLECTD-UNIXSOCK(5)
Impressum