Data collection methods

Data collection methods

This chapter shall give you a overview about the methods to get the performance data from nagios into your data storage (usually a relational database, usually mysql). I will explain all methods and give hints what method shall be used in which case. The next chapters will guide you through example configurations. So you will not need to understand all configuration options here. Just choose the methods and then go to the chapter that describe the methods in detail.

Get the data out of nagios

There are some possibilities to get the performance data out of nagios:

Method 1: Nagios writes performance data

Set the parameter service_perfdata_file in nagios to let nagios write a file containing the data. This possibility is not recommended since the file will grow until you restart nagios and restarting nagios can be harmful if you have a large nagios setup.

Method 2: Write data in a file with a nagios command

Use the nagios parameter service_perfdata_command to write the data in a file. This method can have a performance drawback since every check in nagios will generate a call to the defined command. This could cause one or more processes to be spawned. To avoid this you should use the enable-embedded-perl and with-perlcache parameters when compiling nagios and use the supplied perl script to write the data to a file. The perl script is located at the config directory in the source tree of perfparse and is named perfparse_nagios_command.pl

Method 3: Write data in a named pipe with a nagios command

Configuration and performance precautions are the similar to Method 2. Caution should be taken that the pipe is created before writing to it and that the pipe is read by another process. This makes this method more difficult to setup. A startscript that handles the pipe creation is located at the scripts directory in the source tree and is named perfparsed.sh. It also starts the perparse daemon - see below for mor information on perfparsed. To write to the pipe you should use the supplied perl script config/perfparse_nagios_pipe_command.pl.

Method 4: Nagios invokes Perfparse

Use the nagios parameter service_perfdata_command to call perfparse-log2mysql (or any other perfparse-log2... command) to hand data directly to perfparse. This method can have a performance drawback since every check in nagios will generate a call to the defined command. On the other hand this method is easy to setup and good for small sites.

Method 5: Use a NEB module (not yet implemented!!!)

A NEB module is dynamically loaded in nagios and hands the data to a socket. Easy to setup and good performance.

Get the data into perfparses data storage

Perfparse contains executables that are meant to store the data. You should use only one of these, although it is possible to use different executables in one environment.


The perfparse daemon can read from multiple data sources and store the data in different data stores. It reads the data sources continuously and can store the data in "realtime". The perfparsed also takes care of the retention policies and deletes old unused data from time to time.
The perfparse daemon can be used together with the methods 1,2,3 and 5 above.

perfparse-log2XXX (example: perfparse-log2mysql)

The perfparse-log2XXX executables do not run continuously. They are meant to be started, read the data, store them and then exit. They are easy to handle, but have some drawbacks: Usually the data don't get in realtime to the storage - except method 4 above. If you use perfprase-log2XXX you should care about retention and regulary start database cleanups with the perfparse_db_purge tool.

The perfparse-log2XXX can be used together with methods 1-4 above.

Special: use both

In some cases it may be necessary to separate nagios and perfparse. So you need methods to hand the data from nagios to perfparse over a network. In this case you can use either the NEB module in combination with perfparsed or perfparse-log2socket and perfparsed. The 3rd possibility is to use any method above and use the database network protocol to transfer the data to the remote host.

You can now decide which method you want to use and then skip to the chapter that describes the configuration for this situation.

Contributors to this page: redflo , StellaPugliese and KaylaSmith .
Page last modified on Thursday 10 of January, 2008 21:06:45 UTC by redflo.


redflo, 14:25 UTC, Sun 10 of Apr, 2005: No, lneuxyuhje, this shall write to a pipe not to a file and so ">" is o.k.
lneuxyuhje, 15:14 UTC, Thu 07 of Apr, 2005: is ">" meant to be ">>" in /usr/local/perfparse/bin/perfparse_nagios_pipe_command.pl ?
redflo, 08:35 UTC, Tue 05 of Apr, 2005: fhdplbvjipsld, it works now. Permissions were wrong.
fhdplbvjipsld, 14:42 UTC, Wed 30 of Mar, 2005: How to post to Forums->Help?
benclewett, 09:27 UTC, Thu 03 of Feb, 2005: Hi Jon! I hope you like our wiki site.