active checks vs. passive checks

Rick Mangus rick.mangus+nagios at gmail.com
Thu Mar 11 16:19:27 CET 2010


On Thu, Mar 11, 2010 at 8:19 AM, Richard Gliebe <richard.gliebe at fhv.at> wrote:
> On 3/11/10 2:27 PM Rick Mangus wrote:
>
> Hi Rick,
>
>> The checks are started by your server, nagios is not involved.  See
>> above comment re: cron.  Your scripts will need to know the service
>> name that they are updating on the nagios server, and almost nothing
>> else about your nagios config.  The messages sent by NSCA have the
>> format "$HOSTNAME\t$SERVICENAME\t$SERVICESTATEID\t$SERVICEOUTPUT|$PERFDATA"
>>  This gives the nagios server enough information to identify which
>> service on which host is being updated.
>
> OK, this means for me:
> on my app.server I don't need any nagios binaries like nagios-plugins,
> nagios.cmd, and so on.
>
> EXAMPLE: outside of our nagios server, there is a little linux box and
> some color printers attached on there network ;-)
> Now I want to check the color cartridges with snmp from the linux box in
> the outback.
>
> In Nagios there is already the host_check for the printer(s) and
> service_checks for the color cartridges defined with passive_check_enabled.
>
> Now I have to create as bash script to check the cartridges on the linux
> box, which will be run by hand, cron, at, ...
>
> and the result will be sent by NSCA to the nagios Server.
>
> My, maybe, last big question:
>
> which output do I have generate from my script for nagios?
>
> ... or ...
>
> do you have a simple example for me?


Here is a simple example.  I have a list of processes I want to make
sure are running, so I create a variable 'proc_names' with a list of
them, then:

host_name=`hostname`

for proc in $proc_names; do
   service_description=process_$proc
   if pidof $proc >> /dev/null; then
      SERVICESTATEID=0
      SERVICEOUTPUT="$host_name $proc process OK"
   else
      SERVICESTATEID=2
      SERVICEOUTPUT="$host_name $proc process needs attention"
   fi

#Send to Nagios
   echo -e "$host_name\t$service_description\t$SERVICESTATEID\t$SERVICEOUTPUT\n"
| /usr/local/nagios/bin/send_nsca -H $monitor_host1 -c
/usr/local/nagios/etc/send_nsca.cfg > /dev/null 2>&1
done

> This will be great and you will be welcome, if you plan a turn to
> austria ;-)
>

Careful!  I love to travel and I honestly don't know what country I'll
be in tomorrow evening.  :)  My bag is packed for somewhere tropical,
but I have standby tickets to anywhere.  ;)

>
>>> The results will be send via NSCA from the app.server to the nagios
>>> server. OK. this will be another story ;-)
>>>
>>
>> You have the right idea, here.
>>
>>> Oh my god, send me a flashlight ...
>>>
>>
>> It is pitch black. You are likely to be eaten by a grue.
>
> thats my cruel fate ;-)
>
> thanks in advance

Glad to help, or try, anyways.  :)

> Richard
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> 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
>

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
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