WORK IN PROGRESS
ndo2fs originated as a debugger for ndomod.o. It takes data from ndomod.o either via a TCP or a UNIX socket. The aim of ndo2fs is to save the nagios data in a structured way using the file system. We kept in mind that the data has to be processed in an easy way.
In addition I'm working on a PHP class to access the data of ndo2fs. For more information read ndo2fs-php.
ndo2fs works like ndo2db but in contrast to ndo2db it is written in Perl and saves the data on the file system. That's about all.
The current version can be found in the GIT Repository under git.nagiosprojects.org.
Current GIT Repository Snapshots:
The NagVis developers Lars Michelsen and Michael Lübben as well as the check_multi developer Matthias Flacke provide valuable input right now.
In case of questions please send a mail to pitchfork@pnp4nagios.org
None yet! It's just a single Perl script.
Since version 0.1.13 the Perl module JSON::XS is needed to create the JSON files. Unfortunately the module is available as a package starting with Debian Lenny. Users of Debian Etch have to install it via CPAN typing
perl -MCPAN -e install JSON::XS
The data processed by ndomod can be minimized using the directive “data_processing_options” defined in ndomod.cfg as ndo2fs will only use a part of the data.
PROCESS_PROCESS_DATA 1
PROCESS_SERVICE_CHECK_DATA 64
PROCESS_HOST_CHECK_DATA 128
PROCESS_COMMENT_DATA 256
PROCESS_DOWNTIME_DATA 512
PROCESS_PROGRAM_STATUS_DATA 2048
PROCESS_HOST_STATUS_DATA 4096
PROCESS_SERVICE_STATUS_DATA 8192
PROCESS_OBJECT_CONFIG_DATA 262144
PROCESS_MAIN_CONFIG_DATA 524288
PROCESS_RETENTION_DATA 2097152
PROCESS_ACKNOWLEDGEMENT_DATA 4194304
PROCESS_STATECHANGE_DATA 8388608
PROCESS_CONTACT_STATUS_DATA 16777216
which adds up to
data_processing_options = 32259009
1.4m lines equate to 10 min on my production system
wc -l ndo.dat 1406535 ndo.dat
This data I passed to ndo2fs via NetCat
time cat ndo.dat | nc -q1 -n 127.0.0.1 5668 real 0m19.561s user 0m0.004s sys 0m0.064s
This results in 67 MB of data in the ndo2fs directory
du -s -h /tmp/ndo2fs 67M /tmp/ndo2fs
The measurements were taken from a Debian 4 VM on my Macbook Pro.
The data is stored in JSON format on the file system. JSON is short for ”JavaScript Object Notation” but don't panic, there are enough easy to use parsers.
Example using PHP5:
<?php $in = '/tmp/ndo2fs/VOLATILE/HOSTS/localhost/http/STATUS'; $data = file_get_contents($in); $out = json_decode($data); var_dump($out); ?>
Taking /tmp/ndo2fs as a base directory you'll find two sub directories after the start of ndo2fs.
The directory VOLATILE contains (what a surprise) volatile data which is created at the start of nagios. That means that VOLATILE can be stored on a TMPFS. PERSISTENT contains data which is created during runtime of nagios and will be kept across restarts.
The nagios instance forms the next level. For each nagios instance there will be a directory with the appropriate name. In the following the instance <default> will be used.
Below of VOLATILE/default/ there will be the data of the instance <default>.
Below of PERSISTENT/default/ there will be data which is collected during nagios runtime and kept across restarts