couchdb plugin: Add plugin to fetch data from a CouchDB and parse its contents.
[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     - curl
37       Parse statistics from websites using regular expressions.
38
39     - bind
40       Name server and resolver statistics from the `statistics-channel'
41       interface of BIND 9.5, 9,6 and later.
42
43     - conntrack
44       Number of nf_conntrack entries.
45
46     - couchdb
47       Parse statistics from CouchDB JSON documents.
48
49     - cpu
50       CPU utilization: Time spent in the system, user, nice, idle, and related
51       states.
52
53     - cpufreq
54       CPU frequency (For laptops with speed step or a similar technology)
55
56     - dbi
57       Executes SQL statements on various databases and interprets the returned
58       data.
59
60     - df
61       Mountpoint usage (Basically the values `df(1)' delivers)
62
63     - disk
64       Disk utilization: Sectors read/written, number of read/write actions,
65       average time an IO-operation took to complete.
66
67     - dns
68       DNS traffic: Query types, response codes, opcodes and traffic/octets
69       transfered.
70
71     - email
72       Email statistics: Count, traffic, spam scores and checks.
73       See collectd-email(5).
74
75     - entropy
76       Amount of entropy available to the system.
77
78     - exec
79       Values gathered by a custom program or script.
80       See collectd-exec(5).
81
82     - filecount
83       Count the number of files in directories.
84
85     - gmond
86       Receive multicast traffic from Ganglia instances.
87
88     - hddtemp
89       Harddisk temperatures using hddtempd.
90
91     - interface
92       Interface traffic: Number of octets, packets and errors for each
93       interface.
94
95     - iptables
96       Iptables' counters: Number of bytes that were matched by a certain
97       iptables rule.
98
99     - ipmi
100       IPMI (Intelligent Platform Management Interface) sensors information.
101
102     - ipvs
103       IPVS connection statistics (number of connections, octets and packets
104       for each service and destination).
105       See http://www.linuxvirtualserver.org/software/index.html.
106
107     - irq
108       IRQ counters: Frequency in which certain interrupts occur.
109
110     - java
111       Integrates a `Java Virtual Machine' (JVM) to execute plugins in Java
112       bytecode. See “Configuring with libjvm” below.
113
114     - load
115       System load average over the last 1, 5 and 15 minutes.
116
117     - libvirt
118       CPU, disk and network I/O statistics from virtual machines.
119
120     - mbmon
121       Motherboard sensors: temperature, fanspeed and voltage information,
122       using mbmon(1).
123
124     - memcached
125       Statistics of the memcached distributed caching system.
126       <http://www.danga.com/memcached/>
127
128     - memory
129       Memory utilization: Memory occupied by running processes, page cache,
130       buffer cache and free.
131
132     - multimeter
133       Information provided by serial multimeters, such as the `Metex
134       M-4650CR'.
135
136     - mysql
137       MySQL server statistics: Commands issued, handlers triggered, thread
138       usage, query cache utilization and traffic/octets sent and received.
139
140     - netlink
141       Very detailed Linux network interface and routing statistics. You can get
142       (detailed) information on interfaces, qdiscs, classes, and, if you can
143       make use of it, filters.
144
145     - network
146       Receive values that were collected by other hosts. Large setups will
147       want to collect the data on one dedicated machine, and this is the
148       plugin of choice for that.
149
150     - nfs
151       NFS Procedures: Which NFS command were called how often. Only NFSv2 and
152       NFSv3 right now.
153
154     - nginx
155       Collects statistics from `nginx' (speak: engine X), a HTTP and mail
156       server/proxy.
157
158     - ntpd
159       NTP daemon statistics: Local clock drift, offset to peers, etc.
160
161     - nut
162       Network UPS tools: UPS current, voltage, power, charge, utilisation,
163       temperature, etc. See upsd(8).
164
165     - onewire (EXPERIMENTAL!)
166       Read onewire sensors using the owcapu library of the owfs project.
167       Please read in collectd.conf(5) why this plugin is experimental.
168
169     - openvpn
170       RX and TX of each client in openvpn-status.log (status-version 2).
171       <http://openvpn.net/index.php/documentation/howto.html>
172
173     - oracle
174       Query data from an Oracle database.
175
176     - perl
177       The perl plugin implements a Perl-interpreter into collectd. You can
178       write your own plugins in Perl and return arbitrary values using this
179       API. See collectd-perl(5).
180
181     - ping
182       Network latency: Time to reach the default gateway or another given
183       host.
184
185     - postgresql
186       PostgreSQL database statistics: active server connections, transaction
187       numbers, block IO, table row manipulations.
188
189     - powerdns
190       PowerDNS name server statistics.
191
192     - processes
193       Process counts: Number of running, sleeping, zombie, ... processes.
194
195     - protocols
196       Counts various aspects of network protocols such as IP, TCP, UDP, etc.
197
198     - rrdcached
199       RRDtool caching daemon (RRDcacheD) statistics.
200
201     - sensors
202       System sensors, accessed using lm_sensors: Voltages, temperatures and
203       fan rotation speeds.
204
205     - serial
206       RX and TX of serial interfaces. Linux only; needs root privileges.
207
208     - snmp
209       Read values from SNMP (Simple Network Management Protocol) enabled
210       network devices such as switches, routers, thermometers, rack monitoring
211       servers, etc. See collectd-snmp(5).
212
213     - swap
214       Pages swapped out onto harddisk or whatever is called `swap' by the OS..
215
216     - tail
217       Follows (tails) logfiles, parses them by lines and submits matched
218       values.
219
220     - tape
221       Bytes and operations read and written on tape devices. Solaris only.
222
223     - tcpconns
224       Number of TCP connections to specific local and remote ports.
225
226     - teamspeak2
227       TeamSpeak2 server statistics.
228
229     - ted
230       Plugin to read values from `The Energy Detective' (TED).
231
232     - thermal
233       Linux ACPI thermal zone information.
234
235     - users
236       Users currently logged in.
237
238     - vmem
239       Virtual memory statistics, e. g. the number of page-ins/-outs or the
240       number of pagefaults.
241
242     - vserver
243       System resources used by Linux VServers.
244       See <http://linux-vserver.org/>.
245
246     - wireless
247       Link quality of wireless cards. Linux only.
248
249     - xmms
250       Bitrate and frequency of music played with XMMS.
251
252   * Output can be written or send to various destinations by the following
253     plugins:
254
255     - csv
256       Write to comma separated values (CSV) files. This needs lots of
257       diskspace but is extremely portable and can be analysed with almost
258       every program that can analyse anything. Even Microsoft's Excel..
259
260     - network
261       Send the data to a remote host to save the data somehow. This is useful
262       for large setups where the data should be saved by a dedicated machine.
263
264     - perl
265       Of course the values are propagated to plugins written in Perl, too, so
266       you can easily do weird stuff with the plugins we didn't dare think of
267       ;) See collectd-perl(5).
268
269     - rrdcached
270       Output to round-robin-database (RRD) files using the RRDtool caching
271       daemon (RRDcacheD) - see rrdcached(1). That daemon provides a general
272       implementation of the caching done by the `rrdtool' plugin.
273
274     - rrdtool
275       Output to round-robin-database (RRD) files using librrd. See rrdtool(1).
276       This is likely the most popular destination for such values. Since
277       updates to RRD-files are somewhat expensive this plugin can cache
278       updates to the files and write a bunch of updates at once, which lessens
279       system load a lot.
280
281     - unixsock
282       One can query the values from the unixsock plugin whenever they're
283       needed. Please read collectd-unixsock(5) for a description on how that's
284       done.
285
286   * Logging is, as everything in collectd, provided by plugins. The following
287     plugins keep up informed about what's going on:
288
289     - logfile
290       Writes logmessages to a file or STDOUT/STDERR.
291
292     - perl
293       Log messages are propagated to plugins written in Perl as well.
294       See collectd-perl(5).
295
296     - syslog
297       Logs to the standard UNIX logging mechanism, syslog.
298
299   * Notifications can be handled by the following plugins:
300
301     - notify_desktop
302       Send a desktop notification to a notification daemon, as defined in
303       the Desktop Notification Specification. To actually display the
304       notifications, notification-daemon is required.
305       See http://www.galago-project.org/specs/notification/.
306
307     - notify_email
308       Send an E-mail with the notification message to the configured
309       recipients.
310
311     - exec
312       Execute a program or script to handle the notification.
313       See collectd-exec(5).
314
315     - logfile
316       Writes the notification message to a file or STDOUT/STDERR.
317
318     - network
319       Send the notification to a remote host to handle it somehow.
320
321     - perl
322       Notifications are propagated to plugins written in Perl as well.
323       See collectd-perl(5).
324
325   * Value processing can be controlled using the "filter chain" infrastructure
326     and "matches" and "targets". The following plugins are available:
327
328     - match_regex
329       Match values by their identifier based on regular expressions.
330
331     - match_timediff
332       Match values with an invalid timestamp.
333
334     - match_value
335       Select values by their data sources' values.
336
337     - target_notification
338       Create and dispatch a notification.
339
340     - target_replace
341       Replace parts of an identifier using regular expressions.
342
343     - target_set
344       Set (overwrite) entire parts of an identifier.
345
346   * Miscellaneous plugins:
347
348     - uuid
349       Sets the hostname to an unique identifier. This is meant for setups
350       where each client may migrate to another physical host, possibly going
351       through one or more name changes in the process.
352
353   * Performance: Since collectd is running as a daemon it doesn't spend much
354     time starting up again and again. With the exception of the exec plugin no
355     processes are forked. Caching in output plugins, such as the rrdtool and
356     network plugins, makes sure your resources are used efficiently. Also,
357     since collectd is programmed multithreaded it benefits from hyperthreading
358     and multicore processors and makes sure that the daemon isn't idle if only
359     one plugins waits for an IO-operation to complete.
360
361   * Once set up, hardly any maintenance is necessary. Setup is kept as easy
362     as possible and the default values should be okay for most users.
363
364
365 Operation
366 ---------
367
368   * collectd's configuration file can be found at `sysconfdir'/collectd.conf.
369     Run `collectd -h' for a list of builtin defaults. See `collectd.conf(5)'
370     for a list of options and a syntax description.
371
372   * When the `csv' or `rrdtool' plugins are loaded they'll write the values to
373     files. The usual place for these files is beneath `/var/lib/collectd'.
374
375   * When using some of the plugins, collectd needs to run as user root, since
376     only root can do certain things, such as craft ICMP packages needed to ping
377     other hosts. collectd should NOT be installed setuid root since it can be
378     used to overwrite valuable files!
379
380   * Sample scripts to generate graphs reside in `contrib/' in the source
381     package or somewhere near `/usr/share/doc/collectd' in most distributions.
382     Please be aware that those script are meant as a starting point for your
383     own experiments.. Some of them require the `RRDs' Perl module.
384     (`librrds-perl' on Debian) If you have written a more sophisticated
385     solution please share it with us.
386
387   * The RRAs of the automatically created RRD files depend on the `step'
388     and `heartbeat' settings given. If change these settings you may need to
389     re-create the files, losing all data. Please be aware of that when changing
390     the values and read the rrdtool(1) manpage thoroughly.
391
392
393 collectd and chkrootkit
394 -----------------------
395
396   If you are using the `dns' plugin chkrootkit(1) will report collectd as a
397   packet sniffer ("<iface>: PACKET SNIFFER(/usr/sbin/collectd[<pid>])"). The
398   plugin captures all UDP packets on port 53 to analyze the DNS traffic. In
399   this case, collectd is a legitimate sniffer and the report should be
400   considered to be a false positive. However, you might want to check that
401   this really is collectd and not some other, illegitimate sniffer.
402
403
404 Prerequisites
405 -------------
406
407   To compile collectd from source you will need:
408
409   * Usual suspects: C compiler, linker, preprocessor, make, ...
410
411   * A POSIX-threads (pthread) implementation.
412     Since gathering some statistics is slow (network connections, slow devices,
413     etc) the collectd is parallelized. The POSIX threads interface is being
414     used and should be found in various implementations for hopefully all
415     platforms.
416
417   * CoreFoundation.framework and IOKit.framework (optional)
418     For compiling on Darwin in general and the `apple_sensors' plugin in
419     particular.
420     <http://developer.apple.com/corefoundation/>
421
422   * libclntsh (optional)
423     Used by the `oracle' plugin.
424
425   * libcurl (optional)
426     If you want to use the `apache', `ascent', `curl' or `nginx' plugin.
427     <http://curl.haxx.se/>
428
429   * libdbi (optional)
430     Used by the `dbi' plugin to connect to various databases.
431     <http://libdbi.sourceforge.net/>
432
433   * libesmtp (optional)
434     For the `notify_email' plugin.
435     <http://www.stafford.uklinux.net/libesmtp/>
436
437   * libhal (optional)
438     If present, the uuid plugin will check for UUID from HAL.
439     <http://hal.freedesktop.org/>
440
441   * libiptc (optional, if not found a version shipped with this distribution
442     can be used if the Linux kernel headers are available)
443     For querying iptables counters.
444     <http://netfilter.org/>
445
446   * libjvm (optional)
447     Library that encapsulates the `Java Virtual Machine' (JVM). This library is
448     used by the Java plugin to execute Java bytecode. See “Configuring with
449     libjvm” below.
450
451   * libmysqlclient (optional)
452     Unsurprisingly used by the `mysql' plugin.
453     <http://dev.mysql.com/>
454
455   * libnetlink (optional)
456     Used, obviously, for the `netlink' plugin.
457     <http://www.linuxfoundation.org/en/Net:Iproute2>
458
459   * libnetsnmp (optional)
460     For the `snmp' plugin.
461     <http://www.net-snmp.org/>
462
463   * libnotify (optional)
464     For the `notify_desktop' plugin.
465     <http://www.galago-project.org/>
466
467   * liboping (optional, if not found a version shipped with this distribution
468     can be used)
469     Used by the `ping' plugin to send and receive ICMP packets.
470     <http://verplant.org/liboping/>
471
472   * libowcapi (optional)
473     Used by the `onewire' plugin to read values from onewire sensors (or the
474     owserver(1) daemon).
475     <http://www.owfs.org/>
476
477   * libpcap (optional)
478     Used to capture packets by the `dns' plugin.
479     <http://www.tcpdump.org/>
480
481   * libperl (optional)
482     Obviously used by the `perl' plugin. The library has to be compiled with
483     ithread support (introduced in Perl 5.6.0).
484     <http://www.perl.org/>
485
486   * libpq (optional)
487     The PostgreSQL C client library used by the `postgresql' plugin.
488     <http://www.postgresql.org/>
489
490   * librrd (optional)
491     Used by the `rrdtool' and `rrdcached' plugins. The latter requires RRDtool
492     client support which was added after version 1.3 of RRDtool. Versions 1.0,
493     1.2 and 1.3 are known to work with the `rrdtool' plugin.
494     <http://oss.oetiker.ch/rrdtool/>
495
496   * librt, libsocket, libkstat, libdevinfo (optional)
497     Various standard Solaris libraries which provide system functions.
498     <http://developers.sun.com/solaris/>
499
500   * libsensors (optional)
501     To read from `lm_sensors', see the `sensors' plugin.
502     <http://www.lm-sensors.org/>
503
504   * libstatgrab (optional)
505     Used by various plugins to collect statistics on systems other than Linux
506     and/or Solaris.
507     <http://www.i-scream.org/libstatgrab/>
508
509   * libupsclient/nut (optional)
510     For the `nut' plugin which queries nut's `upsd'.
511     <http://networkupstools.org/>
512
513   * libvirt (optional)
514     Collect statistics from virtual machines.
515     <http://libvirt.org/>
516
517   * libxml2 (optional)
518     Parse XML data. This is needed for the `ascent' and `libvirt' plugins.
519     <http://xmlsoft.org/>
520
521   * libxmms (optional)
522     <http://www.xmms.org/>
523
524   * libyajl (optional)
525     Parse JSON data. This is needed for the `couchdb' plugin.
526     <http://www.lloydforge.org/projects/yajl/>
527
528 Configuring / Compiling / Installing
529 ------------------------------------
530
531   To configure, build and install collectd with the default settings, run
532   `./configure && make && make install'.  For detailed, generic instructions
533   see INSTALL. For a complete list of configure options and their description,
534   run `./configure --help'.
535
536   By default, the configure script will check for all build dependencies and
537   disable all plugins whose requirements cannot be fulfilled (any other plugin
538   will be enabled). To enable a plugin, install missing dependencies (see
539   section `Prerequisites' above) and rerun `configure'. If you specify the
540   `--enable-<plugin>' configure option, the script will fail if the depen-
541   dencies for the specified plugin are not met. If you specify the
542   `--disable-<plugin>' configure option, the plugin will not be built. Both
543   options are meant for package maintainers and should not be used in everyday
544   situations.
545
546   By default, collectd will be installed into `/opt/collectd'. You can adjust
547   this setting by specifying the `--prefix' configure option - see INSTALL for
548   details. If you pass DESTDIR=<path> to `make install', <path> will be
549   prefixed to all installation directories. This might be useful when creating
550   packages for collectd.
551
552 Configuring with libjvm
553 -----------------------
554
555   To determine the location of the required files of a Java installation is not
556   an easy task, because the locations vary with your kernel (Linux, SunOS, …)
557   and with your architecture (x86, SPARC, …) and there is no ‘java-config’
558   script we could use. Configuration of the JVM library is therefore a bit
559   tricky.
560
561   The easiest way to use the `--with-java=$JAVA_HOME' option, where
562   `$JAVA_HOME' is usually something like:
563     /usr/lib/jvm/java-1.5.0-sun-1.5.0.14
564
565   The configure script will then use find(1) to look for the following files:
566
567     - jni.h
568     - jni_md.h
569     - libjvm.so
570
571   If found, appropriate CPP-flags and LD-flags are set and the following
572   library checks succeed.
573
574   If this doesn't work for you, you have the possibility to specify CPP-flags,
575   C-flags and LD-flags for the ‘Java’ plugin by hand, using the following three
576   (environment) variables:
577
578     - JAVA_CPPFLAGS
579     - JAVA_CFLAGS
580     - JAVA_LDFLAGS
581
582   For example (shortened for demonstration purposes):
583
584     ./configure JAVA_CPPFLAGS="-I$JAVA_HOME/include -I$JAVA_HOME/include/linux"
585
586   Adding "-ljvm" to the JAVA_LDFLAGS is done automatically, you don't have to
587   do that.
588
589 Crosscompiling
590 --------------
591
592   To compile correctly collectd needs to be able to initialize static
593   variables to NAN (Not A Number). Some C libraries, especially the GNU
594   libc, have a problem with that.
595
596   Luckily, with GCC it's possible to work around that problem: One can define
597   NAN as being (0.0 / 0.0) and `isnan' as `f != f'. However, to test this
598   ``implementation'' the configure script needs to compile and run a short
599   test program. Obviously running a test program when doing a cross-
600   compilation is, well, challenging.
601
602   If you run into this problem, you can use the `--with-nan-emulation'
603   configure option to force the use of this implementation. We can't promise
604   that the compiled binary actually behaves as it should, but since NANs
605   are likely never passed to the libm you have a good chance to be lucky.
606
607   Likewise, collectd needs to know the layout of doubles in memory, in order
608   to craft uniform network packets over different architectures. For this, it
609   needs to know how to convert doubles into the memory layout used by x86. The
610   configure script tries to figure this out by compiling and running a few
611   small test programs. This is of course not possible when cross-compiling.
612   You can use the `--with-fp-layout' option to tell the configure script which
613   conversion method to assume. Valid arguments are:
614
615     * `nothing'    (12345678 -> 12345678)
616     * `endianflip' (12345678 -> 87654321)
617     * `intswap'    (12345678 -> 56781234)
618
619
620 Contact
621 -------
622
623   For questions, bug reports, development information and basically all other
624   concerns please send an email to collectd's mailing list at
625   <collectd at verplant.org>.
626
627   For live discussion and more personal contact visit us in IRC, we're in
628   channel #collectd on freenode.
629
630
631 Author
632 ------
633
634   Florian octo Forster <octo at verplant.org>,
635   Sebastian tokkee Harl <sh at tokkee.org>,
636   and many contributors (see `AUTHORS').
637
638   Please send bug reports and patches to the mailing list, see `Contact'
639   above.
640