Code

common: check_create_dir(): Support symlinks as well.
[collectd.git] / README
1  collectd - System information collection daemon
2 =================================================
3 http://collectd.org/
5 About
6 -----
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.
13 Features
14 --------
16   * collectd is able to collect the following data:
18     - apache
19       Apache server utilization: Number of bytes transfered, number of
20       requests handled and detailed scoreboard statistics
22     - apcups
23       APC UPS Daemon: UPS charge, load, input/output/battery voltage, etc.
25     - apple_sensors
26       Sensors in Macs running Mac OS X / Darwin: Temperature, fanspeed and
27       voltage sensors.
29     - ascent
30       Statistics about Ascent, a free server for the game `World of Warcraft'.
32     - battery
33       Batterycharge, -current and voltage of ACPI and PMU based laptop
34       batteries.
36     - bind
37       Name server and resolver statistics from the `statistics-channel'
38       interface of BIND 9.5, 9,6 and later.
40     - conntrack
41       Number of nf_conntrack entries.
43     - contextswitch
44       Number of context switches done by the operating system.
46     - cpu
47       CPU utilization: Time spent in the system, user, nice, idle, and related
48       states.
50     - cpufreq
51       CPU frequency (For laptops with speed step or a similar technology)
53     - curl
54       Parse statistics from websites using regular expressions.
56     - curl_json
57       Retrieves JSON data via cURL and parses it according to user
58       configuration.
60     - curl_xml
61       Retrieves XML data via cURL and parses it according to user
62       configuration.
64     - dbi
65       Executes SQL statements on various databases and interprets the returned
66       data.
68     - df
69       Mountpoint usage (Basically the values `df(1)' delivers)
71     - disk
72       Disk utilization: Sectors read/written, number of read/write actions,
73       average time an IO-operation took to complete.
75     - dns
76       DNS traffic: Query types, response codes, opcodes and traffic/octets
77       transfered.
79     - email
80       Email statistics: Count, traffic, spam scores and checks.
81       See collectd-email(5).
83     - entropy
84       Amount of entropy available to the system.
86     - exec
87       Values gathered by a custom program or script.
88       See collectd-exec(5).
90     - filecount
91       Count the number of files in directories.
93     - fscache
94       Linux file-system based caching framework statistics.
96     - gmond
97       Receive multicast traffic from Ganglia instances.
99     - hddtemp
100       Harddisk temperatures using hddtempd.
102     - interface
103       Interface traffic: Number of octets, packets and errors for each
104       interface.
106     - iptables
107       Iptables' counters: Number of bytes that were matched by a certain
108       iptables rule.
110     - ipmi
111       IPMI (Intelligent Platform Management Interface) sensors information.
113     - ipvs
114       IPVS connection statistics (number of connections, octets and packets
115       for each service and destination).
116       See http://www.linuxvirtualserver.org/software/index.html.
118     - irq
119       IRQ counters: Frequency in which certain interrupts occur.
121     - java
122       Integrates a `Java Virtual Machine' (JVM) to execute plugins in Java
123       bytecode. See “Configuring with libjvm” below.
125     - load
126       System load average over the last 1, 5 and 15 minutes.
128     - libvirt
129       CPU, disk and network I/O statistics from virtual machines.
131     - madwifi
132       Queries very detailed usage statistics from wireless LAN adapters and
133       interfaces that use the Atheros chipset and the MadWifi driver.
135     - mbmon
136       Motherboard sensors: temperature, fanspeed and voltage information,
137       using mbmon(1).
139     - memcachec
140       Query and parse data from a memcache daemon (memcached).
142     - memcached
143       Statistics of the memcached distributed caching system.
144       <http://www.danga.com/memcached/>
146     - memory
147       Memory utilization: Memory occupied by running processes, page cache,
148       buffer cache and free.
150     - modbus
151       Reads values from Modbus/TCP enabled devices. Supports reading values
152       from multiple "slaves" so gateway devices can be used.
154     - multimeter
155       Information provided by serial multimeters, such as the `Metex
156       M-4650CR'.
158     - mysql
159       MySQL server statistics: Commands issued, handlers triggered, thread
160       usage, query cache utilization and traffic/octets sent and received.
162     - netapp
163       Plugin to query performance values from a NetApp storage system using the
164       “Manage ONTAP” SDK provided by NetApp.
166     - netlink
167       Very detailed Linux network interface and routing statistics. You can get
168       (detailed) information on interfaces, qdiscs, classes, and, if you can
169       make use of it, filters.
171     - network
172       Receive values that were collected by other hosts. Large setups will
173       want to collect the data on one dedicated machine, and this is the
174       plugin of choice for that.
176     - nfs
177       NFS Procedures: Which NFS command were called how often. Only NFSv2 and
178       NFSv3 right now.
180     - nginx
181       Collects statistics from `nginx' (speak: engine X), a HTTP and mail
182       server/proxy.
184     - ntpd
185       NTP daemon statistics: Local clock drift, offset to peers, etc.
187     - nut
188       Network UPS tools: UPS current, voltage, power, charge, utilisation,
189       temperature, etc. See upsd(8).
191     - olsrd
192       Queries routing information from the “Optimized Link State Routing”
193       daemon.
195     - onewire (EXPERIMENTAL!)
196       Read onewire sensors using the owcapu library of the owfs project.
197       Please read in collectd.conf(5) why this plugin is experimental.
199     - openvpn
200       RX and TX of each client in openvpn-status.log (status-version 2).
201       <http://openvpn.net/index.php/documentation/howto.html>
203     - oracle
204       Query data from an Oracle database.
206     - perl
207       The perl plugin implements a Perl-interpreter into collectd. You can
208       write your own plugins in Perl and return arbitrary values using this
209       API. See collectd-perl(5).
211     - pinba
212       Receive and dispatch timing values from Pinba, a profiling extension for
213       PHP.
215     - ping
216       Network latency: Time to reach the default gateway or another given
217       host.
219     - postgresql
220       PostgreSQL database statistics: active server connections, transaction
221       numbers, block IO, table row manipulations.
223     - powerdns
224       PowerDNS name server statistics.
226     - processes
227       Process counts: Number of running, sleeping, zombie, ... processes.
229     - protocols
230       Counts various aspects of network protocols such as IP, TCP, UDP, etc.
232     - python
233       The python plugin implements a Python interpreter into collectd. This
234       makes it possible to write plugins in Python which are executed by
235       collectd without the need to start a heavy interpreter every interval.
236       See collectd-python(5) for details.
238     - routeros
239       Query interface and wireless registration statistics from RouterOS.
241     - rrdcached
242       RRDtool caching daemon (RRDcacheD) statistics.
244     - sensors
245       System sensors, accessed using lm_sensors: Voltages, temperatures and
246       fan rotation speeds.
248     - serial
249       RX and TX of serial interfaces. Linux only; needs root privileges.
251     - snmp
252       Read values from SNMP (Simple Network Management Protocol) enabled
253       network devices such as switches, routers, thermometers, rack monitoring
254       servers, etc. See collectd-snmp(5).
256     - swap
257       Pages swapped out onto harddisk or whatever is called `swap' by the OS..
259     - table
260       Parse table-like structured files.
262     - tail
263       Follows (tails) logfiles, parses them by lines and submits matched
264       values.
266     - tape
267       Bytes and operations read and written on tape devices. Solaris only.
269     - tcpconns
270       Number of TCP connections to specific local and remote ports.
272     - teamspeak2
273       TeamSpeak2 server statistics.
275     - ted
276       Plugin to read values from `The Energy Detective' (TED).
278     - thermal
279       Linux ACPI thermal zone information.
281     - tokyotyrant
282       Reads the number of records and file size from a running Tokyo Tyrant
283       server.
285     - uptime
286       System uptime statistics.
288     - users
289       Users currently logged in.
291     - vmem
292       Virtual memory statistics, e. g. the number of page-ins/-outs or the
293       number of pagefaults.
295     - vserver
296       System resources used by Linux VServers.
297       See <http://linux-vserver.org/>.
299     - wireless
300       Link quality of wireless cards. Linux only.
302     - xmms
303       Bitrate and frequency of music played with XMMS.
305     - zfs_arc
306       Statistics for ZFS' “Adaptive Replacement Cache” (ARC).
308   * Output can be written or sent to various destinations by the following
309     plugins:
311     - csv
312       Write to comma separated values (CSV) files. This needs lots of
313       diskspace but is extremely portable and can be analysed with almost
314       every program that can analyse anything. Even Microsoft's Excel..
316     - network
317       Send the data to a remote host to save the data somehow. This is useful
318       for large setups where the data should be saved by a dedicated machine.
320     - perl
321       Of course the values are propagated to plugins written in Perl, too, so
322       you can easily do weird stuff with the plugins we didn't dare think of
323       ;) See collectd-perl(5).
325     - python
326       It's possible to implement write plugins in Python using the python
327       plugin. See collectd-python(5) for details.
329     - rrdcached
330       Output to round-robin-database (RRD) files using the RRDtool caching
331       daemon (RRDcacheD) - see rrdcached(1). That daemon provides a general
332       implementation of the caching done by the `rrdtool' plugin.
334     - rrdtool
335       Output to round-robin-database (RRD) files using librrd. See rrdtool(1).
336       This is likely the most popular destination for such values. Since
337       updates to RRD-files are somewhat expensive this plugin can cache
338       updates to the files and write a bunch of updates at once, which lessens
339       system load a lot.
341     - unixsock
342       One can query the values from the unixsock plugin whenever they're
343       needed. Please read collectd-unixsock(5) for a description on how that's
344       done.
346     - write_http
347       Sends the values collected by collectd to a web-server using HTTP POST
348       requests. The transmitted data is either in a form understood by the
349       Exec plugin or formatted in JSON.
351   * Logging is, as everything in collectd, provided by plugins. The following
352     plugins keep up informed about what's going on:
354     - logfile
355       Writes logmessages to a file or STDOUT/STDERR.
357     - perl
358       Log messages are propagated to plugins written in Perl as well.
359       See collectd-perl(5).
361     - python
362       It's possible to implement log plugins in Python using the python plugin.
363       See collectd-python(5) for details.
365     - syslog
366       Logs to the standard UNIX logging mechanism, syslog.
368   * Notifications can be handled by the following plugins:
370     - notify_desktop
371       Send a desktop notification to a notification daemon, as defined in
372       the Desktop Notification Specification. To actually display the
373       notifications, notification-daemon is required.
374       See http://www.galago-project.org/specs/notification/.
376     - notify_email
377       Send an E-mail with the notification message to the configured
378       recipients.
380     - exec
381       Execute a program or script to handle the notification.
382       See collectd-exec(5).
384     - logfile
385       Writes the notification message to a file or STDOUT/STDERR.
387     - network
388       Send the notification to a remote host to handle it somehow.
390     - perl
391       Notifications are propagated to plugins written in Perl as well.
392       See collectd-perl(5).
394     - python
395       It's possible to implement notification plugins in Python using the
396       python plugin. See collectd-python(5) for details.
398   * Value processing can be controlled using the "filter chain" infrastructure
399     and "matches" and "targets". The following plugins are available:
401     - match_empty_counter
402       Match counter values which are currently zero.
404     - match_hashed
405       Match values using a hash function of the hostname.
407     - match_regex
408       Match values by their identifier based on regular expressions.
410     - match_timediff
411       Match values with an invalid timestamp.
413     - match_value
414       Select values by their data sources' values.
416     - target_notification
417       Create and dispatch a notification.
419     - target_replace
420       Replace parts of an identifier using regular expressions.
422     - target_scale
423       Scale (multiply) values by an arbitrary value.
425     - target_set
426       Set (overwrite) entire parts of an identifier.
428   * Miscellaneous plugins:
430     - uuid
431       Sets the hostname to an unique identifier. This is meant for setups
432       where each client may migrate to another physical host, possibly going
433       through one or more name changes in the process.
435   * Performance: Since collectd is running as a daemon it doesn't spend much
436     time starting up again and again. With the exception of the exec plugin no
437     processes are forked. Caching in output plugins, such as the rrdtool and
438     network plugins, makes sure your resources are used efficiently. Also,
439     since collectd is programmed multithreaded it benefits from hyperthreading
440     and multicore processors and makes sure that the daemon isn't idle if only
441     one plugin waits for an IO-operation to complete.
443   * Once set up, hardly any maintenance is necessary. Setup is kept as easy
444     as possible and the default values should be okay for most users.
447 Operation
448 ---------
450   * collectd's configuration file can be found at `sysconfdir'/collectd.conf.
451     Run `collectd -h' for a list of builtin defaults. See `collectd.conf(5)'
452     for a list of options and a syntax description.
454   * When the `csv' or `rrdtool' plugins are loaded they'll write the values to
455     files. The usual place for these files is beneath `/var/lib/collectd'.
457   * When using some of the plugins, collectd needs to run as user root, since
458     only root can do certain things, such as craft ICMP packages needed to ping
459     other hosts. collectd should NOT be installed setuid root since it can be
460     used to overwrite valuable files!
462   * Sample scripts to generate graphs reside in `contrib/' in the source
463     package or somewhere near `/usr/share/doc/collectd' in most distributions.
464     Please be aware that those script are meant as a starting point for your
465     own experiments.. Some of them require the `RRDs' Perl module.
466     (`librrds-perl' on Debian) If you have written a more sophisticated
467     solution please share it with us.
469   * The RRAs of the automatically created RRD files depend on the `step'
470     and `heartbeat' settings given. If change these settings you may need to
471     re-create the files, losing all data. Please be aware of that when changing
472     the values and read the rrdtool(1) manpage thoroughly.
475 collectd and chkrootkit
476 -----------------------
478   If you are using the `dns' plugin chkrootkit(1) will report collectd as a
479   packet sniffer ("<iface>: PACKET SNIFFER(/usr/sbin/collectd[<pid>])"). The
480   plugin captures all UDP packets on port 53 to analyze the DNS traffic. In
481   this case, collectd is a legitimate sniffer and the report should be
482   considered to be a false positive. However, you might want to check that
483   this really is collectd and not some other, illegitimate sniffer.
486 Prerequisites
487 -------------
489   To compile collectd from source you will need:
491   * Usual suspects: C compiler, linker, preprocessor, make, ...
493   * A POSIX-threads (pthread) implementation.
494     Since gathering some statistics is slow (network connections, slow devices,
495     etc) the collectd is parallelized. The POSIX threads interface is being
496     used and should be found in various implementations for hopefully all
497     platforms.
499   * CoreFoundation.framework and IOKit.framework (optional)
500     For compiling on Darwin in general and the `apple_sensors' plugin in
501     particular.
502     <http://developer.apple.com/corefoundation/>
504   * libclntsh (optional)
505     Used by the `oracle' plugin.
507   * libcurl (optional)
508     If you want to use the `apache', `ascent', `curl', `nginx', or `write_http'
509     plugin.
510     <http://curl.haxx.se/>
512   * libdbi (optional)
513     Used by the `dbi' plugin to connect to various databases.
514     <http://libdbi.sourceforge.net/>
516   * libesmtp (optional)
517     For the `notify_email' plugin.
518     <http://www.stafford.uklinux.net/libesmtp/>
520   * libganglia (optional)
521     Used by the `gmond' plugin to process data received from Ganglia.
522     <http://ganglia.info/>
524   * libgcrypt (optional)
525     Used by the `network' plugin for encryption and authentication.
526     <http://www.gnupg.org/>
528   * libhal (optional)
529     If present, the uuid plugin will check for UUID from HAL.
530     <http://hal.freedesktop.org/>
532   * libiptc (optional)
533     For querying iptables counters.
534     <http://netfilter.org/>
536     If not found on the system, a version shipped with this distribution can
537     be used. It requires some Linux headers in /usr/include/linux. You can
538     force the build system to use the shipped version by specifying
539       --with-libiptc=shipped
540     when running the configure script.
542   * libjvm (optional)
543     Library that encapsulates the `Java Virtual Machine' (JVM). This library is
544     used by the Java plugin to execute Java bytecode. See “Configuring with
545     libjvm” below.
546     <http://openjdk.java.net/> (and others)
548   * libmemcached (optional)
549     Used by the `memcachec' plugin to connect to a memcache daemon.
550     <http://tangent.org/552/libmemcached.html>
552   * libmodbus (optional)
553     Used by the “modbus” plugin to communicate with Modbus/TCP devices. The
554     “modbus” plugin works with version 2.0.3 of the library – due to frequent
555     API changes other versions may or may not compile cleanly.
556     <http://www.libmodbus.org/>
558   * libmysqlclient (optional)
559     Unsurprisingly used by the `mysql' plugin.
560     <http://dev.mysql.com/>
562   * libnetapp (optional)
563     Required for the “netapp” plugin.
564     This library is part of the “Manage ONTAP SDK” published by NetApp.
566   * libnetlink (optional)
567     Used, obviously, for the `netlink' plugin.
568     <http://www.linuxfoundation.org/en/Net:Iproute2>
570   * libnetsnmp (optional)
571     For the `snmp' plugin.
572     <http://www.net-snmp.org/>
574   * libnotify (optional)
575     For the `notify_desktop' plugin.
576     <http://www.galago-project.org/>
578   * liboping (optional)
579     Used by the `ping' plugin to send and receive ICMP packets.
580     <http://verplant.org/liboping/>
582   * libowcapi (optional)
583     Used by the `onewire' plugin to read values from onewire sensors (or the
584     owserver(1) daemon).
585     <http://www.owfs.org/>
587   * libpcap (optional)
588     Used to capture packets by the `dns' plugin.
589     <http://www.tcpdump.org/>
591   * libperfstat (optional)
592     Used by various plugins to gather statistics under AIX.
594   * libperl (optional)
595     Obviously used by the `perl' plugin. The library has to be compiled with
596     ithread support (introduced in Perl 5.6.0).
597     <http://www.perl.org/>
599   * libpq (optional)
600     The PostgreSQL C client library used by the `postgresql' plugin.
601     <http://www.postgresql.org/>
603   * libprotobuf-c, protoc-c (optional)
604     Used by the `pinba' plugin to generate a parser for the network packets
605     sent by the Pinba PHP extension.
606     <http://code.google.com/p/protobuf-c/>
608   * libpython (optional)
609     Used by the `python' plugin. Currently, only 2.3 ≦ Python < 3 is supported.
610     <http://www.python.org/>
612   * librouteros (optional)
613     Used by the `routeros' plugin to connect to a device running `RouterOS'.
614     <http://verplant.org/librouteros/>
616   * librrd (optional)
617     Used by the `rrdtool' and `rrdcached' plugins. The latter requires RRDtool
618     client support which was added after version 1.3 of RRDtool. Versions 1.0,
619     1.2 and 1.3 are known to work with the `rrdtool' plugin.
620     <http://oss.oetiker.ch/rrdtool/>
622   * librt, libsocket, libkstat, libdevinfo (optional)
623     Various standard Solaris libraries which provide system functions.
624     <http://developers.sun.com/solaris/>
626   * libsensors (optional)
627     To read from `lm_sensors', see the `sensors' plugin.
628     <http://www.lm-sensors.org/>
630   * libstatgrab (optional)
631     Used by various plugins to collect statistics on systems other than Linux
632     and/or Solaris.
633     <http://www.i-scream.org/libstatgrab/>
635   * libtokyotyrant (optional)
636     Used by the tokyotyrant plugin.
637     <http://1978th.net/tokyotyrant/>
639   * libupsclient/nut (optional)
640     For the `nut' plugin which queries nut's `upsd'.
641     <http://networkupstools.org/>
643   * libvirt (optional)
644     Collect statistics from virtual machines.
645     <http://libvirt.org/>
647   * libxml2 (optional)
648     Parse XML data. This is needed for the `ascent' and `libvirt' plugins.
649     <http://xmlsoft.org/>
651   * libxmms (optional)
652     <http://www.xmms.org/>
654   * libyajl (optional)
655     Parse JSON data. This is needed for the `curl_json' plugin.
656     <http://github.com/lloyd/yajl>
658 Configuring / Compiling / Installing
659 ------------------------------------
661   To configure, build and install collectd with the default settings, run
662   `./configure && make && make install'.  For detailed, generic instructions
663   see INSTALL. For a complete list of configure options and their description,
664   run `./configure --help'.
666   By default, the configure script will check for all build dependencies and
667   disable all plugins whose requirements cannot be fulfilled (any other plugin
668   will be enabled). To enable a plugin, install missing dependencies (see
669   section `Prerequisites' above) and rerun `configure'. If you specify the
670   `--enable-<plugin>' configure option, the script will fail if the depen-
671   dencies for the specified plugin are not met. In that case you can force the
672   plugin to be built using the `--enable-<plugin>=force' configure option.
673   This will most likely fail though unless you're working in a very unusual
674   setup and you really know what you're doing. If you specify the
675   `--disable-<plugin>' configure option, the plugin will not be built. If you
676   specify the `--enable-all-plugins' or `--disable-all-plugins' configure
677   options, all plugins will be enabled or disabled respectively by default.
678   Explicitly enabling or disabling a plugin overwrites the default for the
679   specified plugin. These options are meant for package maintainers and should
680   not be used in everyday situations.
682   By default, collectd will be installed into `/opt/collectd'. You can adjust
683   this setting by specifying the `--prefix' configure option - see INSTALL for
684   details. If you pass DESTDIR=<path> to `make install', <path> will be
685   prefixed to all installation directories. This might be useful when creating
686   packages for collectd.
688 Configuring with libjvm
689 -----------------------
691   To determine the location of the required files of a Java installation is not
692   an easy task, because the locations vary with your kernel (Linux, SunOS, …)
693   and with your architecture (x86, SPARC, …) and there is no ‘java-config’
694   script we could use. Configuration of the JVM library is therefore a bit
695   tricky.
697   The easiest way to use the `--with-java=$JAVA_HOME' option, where
698   `$JAVA_HOME' is usually something like:
699     /usr/lib/jvm/java-1.5.0-sun-1.5.0.14
701   The configure script will then use find(1) to look for the following files:
703     - jni.h
704     - jni_md.h
705     - libjvm.so
707   If found, appropriate CPP-flags and LD-flags are set and the following
708   library checks succeed.
710   If this doesn't work for you, you have the possibility to specify CPP-flags,
711   C-flags and LD-flags for the ‘Java’ plugin by hand, using the following three
712   (environment) variables:
714     - JAVA_CPPFLAGS
715     - JAVA_CFLAGS
716     - JAVA_LDFLAGS
718   For example (shortened for demonstration purposes):
720     ./configure JAVA_CPPFLAGS="-I$JAVA_HOME/include -I$JAVA_HOME/include/linux"
722   Adding "-ljvm" to the JAVA_LDFLAGS is done automatically, you don't have to
723   do that.
725 Crosscompiling
726 --------------
728   To compile correctly collectd needs to be able to initialize static
729   variables to NAN (Not A Number). Some C libraries, especially the GNU
730   libc, have a problem with that.
732   Luckily, with GCC it's possible to work around that problem: One can define
733   NAN as being (0.0 / 0.0) and `isnan' as `f != f'. However, to test this
734   ``implementation'' the configure script needs to compile and run a short
735   test program. Obviously running a test program when doing a cross-
736   compilation is, well, challenging.
738   If you run into this problem, you can use the `--with-nan-emulation'
739   configure option to force the use of this implementation. We can't promise
740   that the compiled binary actually behaves as it should, but since NANs
741   are likely never passed to the libm you have a good chance to be lucky.
743   Likewise, collectd needs to know the layout of doubles in memory, in order
744   to craft uniform network packets over different architectures. For this, it
745   needs to know how to convert doubles into the memory layout used by x86. The
746   configure script tries to figure this out by compiling and running a few
747   small test programs. This is of course not possible when cross-compiling.
748   You can use the `--with-fp-layout' option to tell the configure script which
749   conversion method to assume. Valid arguments are:
751     * `nothing'    (12345678 -> 12345678)
752     * `endianflip' (12345678 -> 87654321)
753     * `intswap'    (12345678 -> 56781234)
756 Contact
757 -------
759   For questions, bug reports, development information and basically all other
760   concerns please send an email to collectd's mailing list at
761   <collectd at verplant.org>.
763   For live discussion and more personal contact visit us in IRC, we're in
764   channel #collectd on freenode.
767 Author
768 ------
770   Florian octo Forster <octo at verplant.org>,
771   Sebastian tokkee Harl <sh at tokkee.org>,
772   and many contributors (see `AUTHORS').
774   Please send bug reports and patches to the mailing list, see `Contact'
775   above.