contrib/exec-nagios.px: Make it possible to run the same script multiple times.
[collectd.git] / README
1  collectd - System information collection daemon
2 =================================================
3 http://collectd.org/
4
5 About
6 -----
7
8   collectd is a small daemon which collects system information periodically
9   and provides mechanisms to store and monitor the values in a variety of
10   ways.
11
12
13 Features
14 --------
15
16   * collectd is able to collect the following data:
17
18     - apache
19       Apache server utilization: Number of bytes transfered, number of
20       requests handled and detailed scoreboard statistics
21
22     - apcups
23       APC UPS Daemon: UPS charge, load, input/output/battery voltage, etc.
24
25     - apple_sensors
26       Sensors in Macs running Mac OS X / Darwin: Temperature, fanspeed and
27       voltage sensors.
28
29     - ascent
30       Statistics about Ascent, a free server for the game `World of Warcraft'.
31
32     - battery
33       Batterycharge, -current and voltage of ACPI and PMU based laptop
34       batteries.
35
36     - cpu
37       CPU utilization: Time spent in the system, user, nice, idle, and related
38       states.
39
40     - cpufreq
41       CPU frequency (For laptops with speed step or a similar technology)
42
43     - df
44       Mountpoint usage (Basically the values `df(1)' delivers)
45
46     - disk
47       Disk utilization: Sectors read/written, number of read/write actions,
48       average time an IO-operation took to complete.
49
50     - dns
51       DNS traffic: Query types, response codes, opcodes and traffic/octets
52       transfered.
53
54     - email
55       Email statistics: Count, traffic, spam scores and checks.
56       See collectd-email(5).
57
58     - entropy
59       Amount of entropy available to the system.
60
61     - exec
62       Values gathered by a custom program or script.
63       See collectd-exec(5).
64
65     - filecount
66       Count the number of files in directories.
67
68     - hddtemp
69       Harddisk temperatures using hddtempd.
70
71     - interface
72       Interface traffic: Number of octets, packets and errors for each
73       interface.
74
75     - iptables
76       Iptables' counters: Number of bytes that were matched by a certain
77       iptables rule.
78
79     - ipvs
80       IPVS connection statistics (number of connections, octets and packets
81       for each service and destination).
82       See http://www.linuxvirtualserver.org/software/index.html.
83
84     - irq
85       IRQ counters: Frequency in which certain interrupts occur.
86
87     - load
88       System load average over the last 1, 5 and 15 minutes.
89
90     - libvirt
91       CPU, disk and network I/O statistics from virtual machines.
92
93     - mbmon
94       Motherboard sensors: temperature, fanspeed and voltage information,
95       using mbmon(1).
96
97     - memcached
98       Statistics of the memcached distributed caching system.
99       <http://www.danga.com/memcached/>
100
101     - memory
102       Memory utilization: Memory occupied by running processes, page cache,
103       buffer cache and free.
104
105     - multimeter
106       Information provided by serial multimeters, such as the `Metex
107       M-4650CR'.
108
109     - mysql
110       MySQL server statistics: Commands issued, handlers triggered, thread
111       usage, query cache utilization and traffic/octets sent and received.
112
113     - netlink
114       Very detailed Linux network interface and routing statistics. You can get
115       (detailed) information on interfaces, qdiscs, classes, and, if you can
116       make use of it, filters.
117
118     - network
119       Receive values that were collected by other hosts. Large setups will
120       want to collect the data on one dedicated machine, and this is the
121       plugin of choice for that.
122
123     - nfs
124       NFS Procedures: Which NFS command were called how often. Only NFSv2 and
125       NFSv3 right now.
126
127     - nginx
128       Collects statistics from `nginx' (speak: engine X), a HTTP and mail
129       server/proxy.
130
131     - ntpd
132       NTP daemon statistics: Local clock drift, offset to peers, etc.
133
134     - nut
135       Network UPS tools: UPS current, voltage, power, charge, utilisation,
136       temperature, etc. See upsd(8).
137
138     - onewire (EXPERIMENTAL!)
139       Read onewire sensors using the owcapu library of the owfs project.
140       Please read in collectd.conf(5) why this plugin is experimental.
141
142     - perl
143       The perl plugin implements a Perl-interpreter into collectd. You can
144       write your own plugins in Perl and return arbitrary values using this
145       API. See collectd-perl(5).
146
147     - ping
148       Network latency: Time to reach the default gateway or another given
149       host.
150
151     - postgresql
152       PostgreSQL database statistics: active server connections, transaction
153       numbers, block IO, table row manipulations.
154
155     - processes
156       Process counts: Number of running, sleeping, zombie, ... processes.
157
158     - sensors
159       System sensors, accessed using lm_sensors: Voltages, temperatures and
160       fan rotation speeds.
161
162     - serial
163       RX and TX of serial interfaces. Linux only; needs root privileges.
164
165     - snmp
166       Read values from SNMP (Simple Network Management Protocol) enabled
167       network devices such as switches, routers, thermometers, rack monitoring
168       servers, etc. See collectd-snmp(5).
169
170     - swap
171       Pages swapped out onto harddisk or whatever is called `swap' by the OS..
172
173     - tail
174       Follows (tails) logfiles, parses them by lines and submits matched
175       values.
176
177     - tape
178       Bytes and operations read and written on tape devices. Solaris only.
179
180     - tcpconns
181       Number of TCP connections to specific local and remote ports.
182
183     - users
184       Users currently logged in.
185
186     - vmem
187       Virtual memory statistics, e. g. the number of page-ins/-outs or the
188       number of pagefaults.
189
190     - vserver
191       System resources used by Linux VServers.
192       See <http://linux-vserver.org/>.
193
194     - wireless
195       Link quality of wireless cards. Linux only.
196
197     - xmms
198       Bitrate and frequency of music played with XMMS.
199
200   * Output can be written or send to various destinations by the following
201     plugins:
202
203     - csv
204       Write to comma separated values (CSV) files. This needs lots of
205       diskspace but is extremely portable and can be analysed with almost
206       every program that can analyse anything. Even Microsoft's Excel..
207
208     - network
209       Send the data to a remote host to save the data somehow. This is useful
210       for large setups where the data should be saved by a dedicated machine.
211
212     - perl
213       Of course the values are propagated to plugins written in Perl, too, so
214       you can easily do weird stuff with the plugins we didn't dare think of
215       ;) See collectd-perl(5).
216
217     - rrdtool
218       Output to round-robin-database (RRD) files using librrd. See rrdtool(1).
219       This is likely the most popular destination for such values. Since
220       updates to RRD-files are somewhat expensive this plugin can cache
221       updates to the files and write a bunch of updates at once, which lessens
222       system load a lot.
223
224     - unixsock
225       One can query the values from the unixsock plugin whenever they're
226       needed. Please read collectd-unixsock(5) for a description on how that's
227       done.
228
229   * Logging is, as everything in collectd, provided by plugins. The following
230     plugins keep up informed about what's going on:
231
232     - logfile
233       Writes logmessages to a file or STDOUT/STDERR.
234
235     - perl
236       Log messages are propagated to plugins written in Perl as well.
237       See collectd-perl(5).
238
239     - syslog
240       Logs to the standard UNIX logging mechanism, syslog.
241
242   * Notifications can be handled by the following plugins:
243
244     - notify_desktop
245       Send a desktop notification to a notification daemon, as defined in
246       the Desktop Notification Specification. To actually display the
247       notifications, notification-daemon is required.
248       See http://www.galago-project.org/specs/notification/.
249
250     - notify_email
251       Send an E-mail with the notification message to the configured
252       recipients.
253
254     - exec
255       Execute a program or script to handle the notification.
256       See collectd-exec(5).
257
258     - logfile
259       Writes the notification message to a file or STDOUT/STDERR.
260
261     - network
262       Send the notification to a remote host to handle it somehow.
263
264     - perl
265       Notifications are propagated to plugins written in Perl as well.
266       See collectd-perl(5).
267
268   * Miscellaneous plugins:
269
270     - uuid
271       Sets the hostname to an unique identifier. This is meant for setups
272       where each client may migrate to another physical host, possibly going
273       through one or more name changes in the process.
274
275   * Performance: Since collectd is running as a daemon it doesn't spend much
276     time starting up again and again. With the exception of the exec plugin no
277     processes are forked. Caching in output plugins, such as the rrdtool and
278     network plugins, makes sure your resources are used efficiently. Also,
279     since collectd is programmed multithreaded it benefits from hyperthreading
280     and multicore processors and makes sure that the daemon isn't idle if only
281     one plugins waits for an IO-operation to complete.
282     
283   * Once set up, hardly any maintenance is necessary. Setup is kept as easy
284     as possible and the default values should be okay for most users.
285
286
287 Operation
288 ---------
289
290   * collectd's configuration file can be found at `sysconfdir'/collectd.conf.
291     Run `collectd -h' for a list of builtin defaults. See `collectd.conf(5)'
292     for a list of options and a syntax description.
293
294   * When the `csv' or `rrdtool' plugins are loaded they'll write the values to
295     files. The usual place for these files is beneath `/var/lib/collectd'.
296
297   * When using some of the plugins, collectd needs to run as user root, since
298     only root can do certain things, such as craft ICMP packages needed to ping
299     other hosts. collectd should NOT be installed setuid root since it can be
300     used to overwrite valuable files!
301
302   * Sample scripts to generate graphs reside in `contrib/' in the source
303     package or somewhere near `/usr/share/doc/collectd' in most distributions.
304     Please be aware that those script are meant as a starting point for your
305     own experiments.. Some of them require the `RRDs' Perl module.
306     (`librrds-perl' on Debian) If you have written a more sophisticated
307     solution please share it with us.
308
309   * The RRAs of the automatically created RRD files depend on the `step'
310     and `heartbeat' settings given. If change these settings you may need to
311     re-create the files, losing all data. Please be aware of that when changing
312     the values and read the rrdtool(1) manpage thoroughly.
313
314
315 collectd and chkrootkit
316 -----------------------
317
318   If you are using the `dns' plugin chkrootkit(1) will report collectd as a
319   packet sniffer ("<iface>: PACKET SNIFFER(/usr/sbin/collectd[<pid>])"). The
320   plugin captures all UDP packets on port 53 to analyze the DNS traffic. In
321   this case, collectd is a legitimate sniffer and the report should be
322   considered to be a false positive. However, you might want to check that
323   this really is collectd and not some other, illegitimate sniffer.
324
325
326 Prerequisites
327 -------------
328
329   To compile collectd from source you will need:
330
331   * Usual suspects: C compiler, linker, preprocessor, make, ...
332
333   * A POSIX-threads (pthread) implementation.
334     Since gathering some statistics is slow (network connections, slow devices,
335     etc) the collectd is parallelized. The POSIX threads interface is being
336     used and should be found in various implementations for hopefully all
337     platforms.
338
339   * CoreFoundation.framework and IOKit.framework (optional)
340     For compiling on Darwin in general and the `apple_sensors' plugin in
341     particular.
342
343   * libcurl (optional)
344     If you want to use the `apache', `ascent', or `nginx' plugin.
345
346   * libesmtp (optional)
347     For the `notify_email' plugin.
348
349   * libhal (optional)
350     If present, the uuid plugin will check for UUID from HAL.
351
352   * libiptc (optional)
353     For querying iptables counters.
354
355   * libmysqlclient (optional)
356     Unsurprisingly used by the `mysql' plugin.
357
358   * libnetlink (optional)
359     Used, obviously, for the `netlink' plugin.
360
361   * libnetsnmp (optional)
362     For the `snmp' plugin.
363
364   * libnotify (optional)
365     For the `notify_desktop' plugin.
366
367   * liboping (optional, if not found a version shipped with this distribution
368     can be used)
369     Used by the `ping' plugin to send and receive ICMP packets.
370
371   * libowcapi (optional)
372     Used by the `onewire' plugin to read values from onewire sensors (or the
373     owserver(1) daemon).
374
375   * libpcap (optional)
376     Used to capture packets by the `dns' plugin.
377
378   * libperl (optional)
379     Obviously used by the `perl' plugin. The library has to be compiled with
380     ithread support (introduced in Perl 5.6.0).
381
382   * libpq (optional)
383     The PostgreSQL C client library used by the `postgresql' plugin.
384
385   * librrd (optional; headers and library; rrdtool 1.0 and 1.2 both work fine)
386     If built without `librrd' the resulting binary will be `client only', i.e.
387     will send its values via multicast and not create any RRD files itself.
388     Alternatively you can chose to write CSV-files (Comma Separated Values)
389     instead.
390
391   * librt, libsocket, libkstat, libdevinfo (optional)
392     Various standard Solaris libraries which provide system functions.
393
394   * libsensors (optional)
395     To read from `lm_sensors', see the `sensors' plugin.
396
397   * libstatgrab (optional) may be used to collect statistics on systems other
398     than Linux and/or Solaris. Note that CPU- and disk-statistics, while being
399     provided by this library, are not supported in collectd right now..
400     <http://www.i-scream.org/libstatgrab/> 
401
402   * libupsclient/nut (optional)
403     For the `nut' plugin which queries nut's `upsd'.
404
405   * libvirt (optional)
406     Collect statistics from virtual machines.
407
408   * libxml2 (optional)
409     Parse XML data. This is needed for the `ascent' and `libvirt' plugins.
410
411   * libxmms (optional)
412
413
414 Configuring / Compiling / Installing
415 ------------------------------------
416
417   To configure, build and install collectd with the default settings, run
418   `./configure && make && make install'.  For detailed, generic instructions
419   see INSTALL. For a complete list of configure options and their description,
420   run `./configure --help'.
421   
422   By default, the configure script will check for all build dependencies and
423   disable all plugins whose requirements cannot be fulfilled (any other plugin
424   will be enabled). To enable a plugin, install missing dependencies (see
425   section `Prerequisites' above) and rerun `configure'. If you specify the
426   `--enable-<plugin>' configure option, the script will fail if the depen-
427   dencies for the specified plugin are not met. If you specify the
428   `--disable-<plugin>' configure option, the plugin will not be built. Both
429   options are meant for package maintainers and should not be used in everyday
430   situations.
431
432   By default, collectd will be installed into `/opt/collectd'. You can adjust
433   this setting by specifying the `--prefix' configure option - see INSTALL for
434   details. If you pass DESTDIR=<path> to `make install', <path> will be
435   prefixed to all installation directories. This might be useful when creating
436   packages for collectd.
437
438
439 Crosscompiling
440 --------------
441
442   To compile correctly collectd needs to be able to initialize static
443   variables to NAN (Not A Number). Some C libraries, especially the GNU
444   libc, have a problem with that.
445
446   Luckily, with GCC it's possible to work around that problem: One can define
447   NAN as being (0.0 / 0.0) and `isnan' as `f != f'. However, to test this
448   ``implementation'' the configure script needs to compile and run a short
449   test program. Obviously running a test program when doing a cross-
450   compilation is, well, challenging.
451
452   If you run into this problem, you can use the `--with-nan-emulation'
453   configure option to force the use of this implementation. We can't promise
454   that the compiled binary actually behaves as it should, but since NANs
455   are likely never passed to the libm you have a good chance to be lucky.
456
457   Likewise, collectd needs to know the layout of doubles in memory, in order
458   to craft uniform network packets over different architectures. For this, it
459   needs to know how to convert doubles into the memory layout used by x86. The
460   configure script tries to figure this out by compiling and running a few
461   small test programs. This is of course not possible when cross-compiling.
462   You can use the `--with-fp-layout' option to tell the configure script which
463   conversion method to assume. Valid arguments are:
464
465     * `nothing'    (12345678 -> 12345678)
466     * `endianflip' (12345678 -> 87654321)
467     * `intswap'    (12345678 -> 56781234)
468
469
470 Contact
471 -------
472
473   For questions, bug reports, development information and basically all other
474   concerns please send an email to collectd's mailing list at
475   <collectd at verplant.org>.
476
477   For live discussion and more personal contact visit us in IRC, we're in
478   channel #collectd on freenode.
479
480
481 Author
482 ------
483
484   Florian octo Forster <octo at verplant.org>,
485   Sebastian tokkee Harl <sh at tokkee.org>,
486   and many contributors (see `AUTHORS').
487
488   Please send bug reports and patches to the mailing list, see `Contact'
489   above.
490