Page 1 of 1

Re: [Nagios-devel] NSCA using PROCESS_FILE

Posted: Fri Mar 02, 2007 4:59 am
by Guest
This is a multi-part message in MIME format.
--------------030102090007080507080405
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

On 01/03/07 10:27 AM, Gerd Mueller wrote:
>> Whats the better Situation ?
>> 200 sec Service Latency or waiting 20 secs for data ?
>
> With ocsp_sweeper reading the pipe every second I never got a latency
> problem even with 3500 hosts.

Hi Gerd,

Hasn't you requested a ochp_sweeper as well?

I just made my daemon poll as many fifos as you like. You can now have
one daemon to process both OCHP and OCSP pipes. The command usage is
well documented if you run it with the -h switch. I quickly updated the
howto draft as well:


############################################################

Piped OCP 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. Make them read-write by
nagios user (can be skiped if you run OCP_daemon as root):

chgrp nagios /path/to/host-perfdata.fifo
chmod 660 /path/to/host-perfdata.fifo
chgrp nagios /path/to/service-perfdata.fifo
chmod 660 /path/to/service-perfdata.fifo

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 setuidgid nagios /usr/sbin/OCP_daemon \
-f /path/to/host-perfdata.fifo,/path/to/service-perfdata.fifo \
-n -H -c -r 1
-----

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).

7. Comments?

Please send them to [email protected] (me)

############################################################

Thomas

--------------030102090007080507080405
Content-Type: text/plain;
name="OCP_daemon"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="OCP_daemon"

#!/usr/bin/perl
# OCP_daemon - Obsessive Compulsive Host/Service Processor daemon for Nagios
#
# Copyright (C) 2007 Thomas Guyot-Sionnest
# Original code Copyright (C) 2006, 2007 Mark Steele
# http://www.control-alt-del.org/code
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
use Event:

...[email truncated]...


This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]