<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>Re: [Nagios-users] Survey of Nagios.</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>Is it me or is using nagios to monitor itself a waste of effort. Consider this basic scenario:<BR>
<BR>
Nagios crashes.<BR>
   Nagios is therefore not running.<BR>
   Nagios is not executing -any- service checks.<BR>
   Nagios can not execute the check_nagios plugin.<BR>
   No one gets notified.<BR>
<BR>
<BR>
<BR>
--<BR>
Marc<BR>
<BR>
Sent from a very tiny wireless device with a very tiny unlit keyboard.<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: Pascal Miquet <p.miquet@hafiba.fr><BR>
To: Scott <lists.scott@themagicbox.net><BR>
CC: Nagios users <nagios-users@lists.sourceforge.net><BR>
Sent: Sat Nov 16 08:48:01 2002<BR>
Subject: Re: [Nagios-users] Survey of Nagios.<BR>
<BR>
This is OK I presume,<BR>
<BR>
But how should I take care of nagios notification, if I set  a service into nagios, and like to notify persons in charge of this service ?<BR>
Into the script we just checks the nagios running state.<BR>
Any idea ?<BR>
<BR>
Le sam 16/11/2002 à 10:30, Scott a écrit :<BR>
<BR>
Just to make an appendment to this, I noticed I had it in a test state<BR>
<BR>
while writing it... here is the actual working copy.. sorry about that<BR>
<BR>
folks.. enjoy<BR>
<BR>
<BR>
<BR>
#!/usr/bin/perl<BR>
<BR>
<BR>
<BR>
open PIDFILE, ("/path/to/nagios/var/nagios.lock");<BR>
<BR>
$pid = <PIDFILE>;<BR>
<BR>
close PIDFILE;<BR>
<BR>
@nag_stat = `ps -ax |grep -e $pid`;<BR>
<BR>
<BR>
<BR>
if (@nag_stat[0]) {<BR>
<BR>
        print "nagios running\n";<BR>
<BR>
} else {<BR>
<BR>
        system('printf "Nagios not running: replace this with external<BR>
<BR>
command\n"');<BR>
<BR>
}<BR>
<BR>
<BR>
<BR>
Scott said:<BR>
<BR>
> I think you could just check the pid file for a number and run it<BR>
<BR>
> against a ps -ax greping the pid, then notify if it doesnt exist..<BR>
<BR>
> sounds fairly simple and probably a good idea too... Nothing worse then<BR>
<BR>
> a network outage to find out that nagios isnt monitoring the network<BR>
<BR>
> anyway...<BR>
<BR>
><BR>
<BR>
> #!/usr/bin/perl<BR>
<BR>
><BR>
<BR>
> open PIDFILE, ("/path/to/nagios/var/nagios.lock");<BR>
<BR>
> $pid = <PIDFILE>;<BR>
<BR>
> close PIDFILE;<BR>
<BR>
><BR>
<BR>
> @nag_stat = `ps -ax |grep -e $pid`;<BR>
<BR>
><BR>
<BR>
> if (!@nag_stat[0]) {<BR>
<BR>
>         print "nagios running\n";<BR>
<BR>
> } else {<BR>
<BR>
>         system('printf "Nagios not running: replace this with external<BR>
<BR>
> command\n<BR>
<BR>
> "');<BR>
<BR>
> }<BR>
<BR>
><BR>
<BR>
> Somthing like this from cron would work nicely for that.. crude, yes,<BR>
<BR>
> works, yes also.. somebody probably has better perl skills than myself<BR>
<BR>
> that could ake this better but it would do what you are asking for<BR>
<BR>
> though.<BR>
<BR>
><BR>
<BR>
><BR>
<BR>
> Pascal Miquet said:<BR>
<BR>
>> Is there some stuff to check that nagios is still alive, and may be<BR>
<BR>
>> send an email.<BR>
<BR>
>> Doing this is tricky with nagios, I know.<BR>
<BR>
>> But I wonder, how admins could be informed that nagios is in a<BR>
<BR>
>> blocking state or is not active.<BR>
<BR>
>> Personaly, I think that a shell schedule by the anacron in an  hourly<BR>
<BR>
>> mode shoud be a good way, and then send Email and sms.<BR>
<BR>
>><BR>
<BR>
>> But the semantic question is how could we fetch the nagios settings to<BR>
<BR>
>> issue notifications ?<BR>
<BR>
>><BR>
<BR>
>> Any good idea, or link is welcome.<BR>
<BR>
>> Pascal Miquet<BR>
<BR>
><BR>
<BR>
><BR>
<BR>
><BR>
<BR>
><BR>
<BR>
><BR>
<BR>
> -------------------------------------------------------<BR>
<BR>
> This sf.net email is sponsored by: To learn the basics of securing  your<BR>
<BR>
> web site with SSL, click here to get a FREE TRIAL of a Thawte  Server<BR>
<BR>
> Certificate: <A HREF="http://www.gothawte.com/rd524.html">http://www.gothawte.com/rd524.html</A><BR>
<BR>
> _______________________________________________<BR>
<BR>
> Nagios-users mailing list<BR>
<BR>
> Nagios-users@lists.sourceforge.net<BR>
<BR>
> <A HREF="https://lists.sourceforge.net/lists/listinfo/nagios-users">https://lists.sourceforge.net/lists/listinfo/nagios-users</A><BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
-------------------------------------------------------<BR>
<BR>
This sf.net email is sponsored by: To learn the basics of securing<BR>
<BR>
your web site with SSL, click here to get a FREE TRIAL of a Thawte<BR>
<BR>
Server Certificate: <A HREF="http://www.gothawte.com/rd524.html">http://www.gothawte.com/rd524.html</A><BR>
<BR>
_______________________________________________<BR>
<BR>
Nagios-users mailing list<BR>
<BR>
Nagios-users@lists.sourceforge.net<BR>
<BR>
 <<A HREF="https://lists.sourceforge.net/lists/listinfo/nagios-users">https://lists.sourceforge.net/lists/listinfo/nagios-users</A>> <A HREF="https://lists.sourceforge.net/lists/listinfo/nagios-users">https://lists.sourceforge.net/lists/listinfo/nagios-users</A><BR>
<BR>
<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>