NSCA using PROCESS_FILE

Joerg Linge pitchfork at ederdrom.de
Thu Mar 1 16:00:37 CET 2007


Am Donnerstag, 1. März 2007 12:29 schrieb Thomas Guyot-Sionnest:
> On 01/03/07 01:54 AM, Hendrik Baecker wrote:
> > Thomas Guyot-Sionnest schrieb:
> >> Eh, I just realized my test could have been wrong... I restarted Nagios and
> >> did an strace and yes, it won't block. However it won't write anything
> >> either:
> >>
> >> write(5, "[SERVICEPERFDATA]\t1172678948\t10."..., 58) = -1 EPIPE (Broken
> >> pipe)
[...]

Hi List,

just an other way to do a bulk update.
Let nagios write to a File in append Mode.

nagios.cfg:
service_perfdata_file=/usr/local/nagios/var/service-perfdata
service_perfdata_file_mode=a

Nagios will write a line as defined in "service_perfdata_file_template"

Next let nagios rotate the file every 20 seconds by starting the command defined in service_perfdata_file_processing_command.

nagios.cfg:
service_perfdata_file_processing_interval=20
service_perfdata_file_processing_command=process-service-perfdata-file

The command process-service-perfdata-file is a simple move to a spool directory.

define command{
        command_name    process-service-perfdata-file
        command_line    /bin/mv /usr/local/nagios/var/service-perfdata  /usr/local/nagios/var/spool/service-perfdata.$TIMET$
        }

Nagios will close the Filehandle and move the file to /usr/local/nagios/var/spool

Now a little Perl Daemon ( or perhaps incrond ) watches /usr/local/nagios/var/spool  and processes the data in one block.
Also put /usr/local/nagios/var/spool on a ramdisk to minimize Disk IO.

So without a FIFO there is no blocking situation and no data loss.

What do you think abut that ? 

Jörg




-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV




More information about the Developers mailing list