Passive service checks via NSCA and requir ed check command defini tion

Ralph.Grothe at itdz-berlin.de Ralph.Grothe at itdz-berlin.de
Mon Aug 8 14:51:36 CEST 2005


Hello Paul,


> -----Original Message-----
> From: nagios-users-admin at lists.sourceforge.net
> [mailto:nagios-users-admin at lists.sourceforge.net]On Behalf Of
Paul L.
> Allen
> Sent: Monday, August 08, 2005 1:51 PM
> To: nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] Re: Passive service checks via NSCA 
> and required
> check command defini tion
> 
> 
> Ralph.Grothe at itdz-berlin.de writes: 
> 
> > I came up with the following hack that seems to be working
well,
> > but I'm unsure if this was also the officially "supported"
way
> > since I haven't found this point being treated in the doc.
> 
> I think it's in the docs, somewhere.  But, IIRC, it's a bit 
> of a pain to
> find. 


What is IIRC?  (you don't mean release candidate 2, do you?)
Where would I find it?


> 
> > After having searched the libexec dir for appropiate sounding
> > plug-ins I came accross
> > check_dummy, which I thought was for cases like this.
> > (the help screen of check_dummy wasn't too revealing about
its
> > intended usage, as usual)
> 
> It can be used in cases like this. 
> 
> > Thus I defined this in checkcommands.cfg 
> > 
> > # Placeholder for Passive Checks 
> > 
> > define command {
> >     command_name        passive-check-pad
> >     command_line        $USR1$/check_dummy 0 "won't do active
> > checks"
> > }
> 
> > I have the passive check feeding the Nagios FIFO every hour
by a
> > cronjob from the remote host. 
> > 
> > Looking at the Nagios webinterface everything seems to be
working
> > perfectly, but I have this sneaking suspicion that I missed 
> something.
> 
> You have missed something. :) 
> 
> Turn off the cron job.  Nagios will be blissfully unaware and 
> return OK
> for the service even if the service is down.

Disabling the cronjob on the remote host?
I can't imagine how the feed should work then.
Could you explain?


SSHing from my Nagios server to the nsca-enabled remote host


$ ssh saz at samos crontab -l
# Passive NSCA Check of HP Virtual Array for nagios @ daisy
07 00-23 * * * /usr/local/nagios/libexec/check_hpva.sh nsca
>/dev/null


Maybe I have to explain.
The script check_hpva.sh I first had written as a mere plug-in
run via check_nrpe.

Because I wanted to give NSCA a try and I found it a bit silly to
check the Virtula Array's state
every 5 mins. or so, I thought turning it into a NSCA script.
To this end I only needed to add a few lines and made the
distinction by an extra parameter it takes 
(i.e. nsca if run as NSCA script, no arg if run as NRPE)


Here's how it works invoked as nsca

[nagios at daisy:~/etc]
$ ssh saz at samos /usr/local/nagios/libexec/check_hpva.sh
nsca;sleep 5;tail -1 ~nagios/var/rw/nagios.cmd 

1 data packet(s) sent to host successfully.
[1123505316]
PROCESS_SERVICE_CHECK_RESULT;samos;samos-hpva-state;0;OK:  HP
Virtual Array "va" on samos FRU State OK, failed: none



>  The text of the 
> check result
> will be different, so if you look carefully you'll be able to 
> tell that
> check_dummy is returning OK rather than the passive check 
> returning OK,

So far I could read the status line as what got written to the
FIFO above.
What difference do you mean?


> but most people just check that everything is green without 
> reading the
> text. 
> 
> At the very least you should call check_dummy with 3 rather 
> than 0 so that
> it returns an unknown state.

I will change to UNKNOWN.


>  You may also find it useful to 
> replace it
> with a simple shell script that prints "Passive check is 
> stale" and exits
> with 3 so that you can distinguish between Unknown being 
> returned by the
> passive check and Unknown because the passive check is stale. 
>  Again, the
> fact that the check_dummy output differs from the passive 
> check output when
> the passive check is unknown will let you distinguish between 
> the two but
> life is a little simpler if the text makes it clear what the 
> problem is. 

Yes, I should also change it that way.


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list