Piped OCHP/OCSP daemon
Thomas Guyot-Sionnest
Thomas at zango.com
Sat Feb 24 10:06:03 CET 2007
Hi list, hi Ethan,
Here's what I came up with. This is a perl daemon that use Eventlib and Event::Lib. A lot of code comes from a perl daemon for processing performance data I talked about in another (or the same?) thread. You can find the original daemon here: http://www.control-alt-del.org/code/NPDaemon/.
Since I do not use OCHP/OCSP yet and I haven't had time to set up a test environment, this is untested (actually I tested every single part, not the whole thing).
############################################################
Piped OCHP/OCSP daemon Mini-HOWTO (Pre-Alpha!)
############################################################
1. Introduction
This document is a mini howto describing how to use Nagios's ability to write host / service data to a FIFO to build a very fast OCHP/OCSP processing system.
2. Copyright
GPL
3. Requirement
- A few properly setup Nagios boxes
- NSCA working
- Libevent
- Perl 5.8.6+ with Event::Lib
- You, the reader
4. Nagios setup
The Main nagios config file will require the following additional config
process_performance_data=1
host_perfdata_file=/path/to/host-perfdata.fifo
service_perfdata_file=/path/to/service-perfdata.fifo
host_perfdata_file_template=$HOSTNAME$\t$HOSTSTATEID$\t$HOSTOUTPUT$|$HOSTPERFDATA$
service_perfdata_file_template=$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATEID$\t$SERVICEOUTPUT$|$SERVICEPERFDATA$
host_perfdata_file_mode=w
service_perfdata_file_mode=w
host_perfdata_file_processing_interval=0
service_perfdata_file_processing_interval=0
5. Filesystem setup
Create FIFOs according to the paths you used for "host_perfdata_file" and "service_perfdata_file" Nagios config
6. Daemon Setup
I recommend running this daemon under Daemontools (http://cr.yp.to/daemontools.html). The run script would look like this:
-----
#!/bin/sh
exec > /dev/null
exec 2>&1
exec /usr/sbin/OCSP_daemon.pl -some_args
-----
Critical errors will be printed out to stderr (in the example above they are discarded).
Run the daemon alone or with "-h" to print the usage. You can have the daemon send data as fast as possible or at given intervals. If opting for intervals, you can also have it flush the data if the queue reach a certain size (the timer will also be reset).
OCSP_daemon.pl and OCHP_daemon.pl are the same minus the name change. TODO: Test if Nagios can be configured to write both host and service data to the same pipe. Will it work?
7. Comments?
Please send them to dermoth at aei.ca (me)
############################################################
Thomas
-----Original Message-----
From: nagios-devel-bounces at lists.sourceforge.net on behalf of Ethan Galstad
Sent: Thu 22-Feb-07 14:33
To: Gerd Mueller; Nagios Developers List
Subject: Re: [Nagios-devel] NSCA using PROCESS_FILE
Any takers (Thomas?) on writing a HOWTO on doing this? I was going to
write up some documentation on doing bulk transfers with NSCA and using
the perfdata files for data output. Since I'm busy with Nagios 3 docs,
this will have to wait a week or so.
If someone wants to write a HOWTO first, I'll ship them an
as-yet-unreleased new Nagios t-shirt that is sure to get me and anyone
who wears it in trouble with the NSA or the Department of Homeland
Security. :-)
Here's what I was going to writeup:
1. Use perfdata file to write passive check information to a file in the
format used by send_nsca
2. Rotate the perfdata file every 60 seconds
3. A cron job runs every minute and pipes the rotated perfdata file to
the send_nsca client.
Bam - bulk data transfer at 60 second intervals. This should help on
both the central and distributed servers. A better performance increase
will happen when the NSCA daemon uses the PROCESS_FILE command when it
receives bulk results from the send_nsca clients.
Gerd Mueller wrote:
> We are already using ocsp sweeper from nagiosexchange. (at Ton: we need ochp as well) This improves the performce. but we still have latencies upto 100 sec. :( So I would call this just a workaround.
>
> Gerd
> -- Ursprüngl. Mitteil. --
> Betreff: Re: [Nagios-devel] NSCA using PROCESS_FILE
> Von: "Thomas Guyot-Sionnest" <Thomas at zango.com>
> Datum: 22.02.2007 18:54
>
> If I were you I'd use Nagios ability to write performance data to a
> file/pipe for ohcp/oscp functionality.
>
> Send the data to a pipe and have a Perl (Or anything else you want) daemon
> read that pipe and spawn send_nsca processes. One good thing with that also
> is that you could send batch updates since send_nsca can receive multiple
> results in a single run.
>
> Thomas
>
>> -----Original Message-----
>> From: nagios-devel-bounces at lists.sourceforge.net
>> [mailto:nagios-devel-bounces at lists.sourceforge.net] On Behalf
>> Of Gerd Mueller
>> Sent: February 22, 2007 10:56
>> To: Nagios Developers List
>> Subject: Re: [Nagios-devel] NSCA using PROCESS_FILE
>>
>>
>> Am Dienstag, den 20.02.2007, 08:48 -0600 schrieb Ethan Galstad:
>>> Gerd Mueller wrote:
>>>> Hi list!
>>>>
>>>> Is there a nsca which supports already the Nagios3
>> external command
>>>> PROCESS_FILE? Or any suggestions how to use PROCESS_FILE for
>>>> inter-Nagios-communication with ohcp/oscp?
>>>>
>>>> Cheers,
>>>>
>>>> Gerd
>>> NSCA hasn't been modified to use the new PROCESS_FILE
>> command, but I'll
>>> start working on that in the next few weeks. Right now I'm
>>> concentrating on documentation.
>> I really need this new nsca feature. Inter-master-slaves communication
>> in our test environment (about 3000 hosts and livesystem will
>> have much
>> more hosts) via nsca causes the slaves' latency to grow massiv (up to
>> hours!). Whereas a slave with same hardware and same amount of checks
>> but without any ocsp/ochp does nearly nothing (latency < 1sec.!).
>>
>> I think the major bottleneck - the serial execution of ocsp/ochp still
>> exists in Nagios3. So Ton's comment on this
>> (http://altinity.blogs.com/dotorg/2006/11/caching_nsca_da.html) is
>> still true.
>>
>> I expect the new PROCESS_FILE option to avoid this bottleneck. The new
>> nsca client has to be fast enough without any slowing down the slave
>> itself while reading and caching. But I really would appreciate if the
>> main cause of the problem - the ocsp/ohcp executions - could be
>> deserialized.
>>
>> Let me now if I can support the development with testing, coding, ...
>>
>> Gerd
>>
Ethan Galstad,
Nagios Developer
---
Email: nagios at nagios.org
Website: http://www.nagios.org
-------------------------------------------------------------------------
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
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20070224/ca6701f6/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OCSP_daemon.pl
Type: application/x-perl
Size: 5433 bytes
Desc: OCSP_daemon.pl
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20070224/ca6701f6/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OCHP_daemon.pl
Type: application/x-perl
Size: 5430 bytes
Desc: OCHP_daemon.pl
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20070224/ca6701f6/attachment-0001.bin>
-------------- next part --------------
-------------------------------------------------------------------------
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
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel
More information about the Developers
mailing list