Question about using the NSCA addon

Mattias Ryrlén mattias.ryrlen at op5.com
Fri Jan 16 12:53:54 CET 2009


On Thu, 2009-01-15 at 12:13 -0700, Matthew Tice wrote:
> I'm interested in using the nsca addon - but only the daemon.  I
> thought I could just open an tcp connection to the daemon and send my
> update manually:

You can setup a netcat listener on your nagios host, create a script
similar to this and start it (in a screen session)

#!/bin/bash
CommandFile="/usr/local/nagios/var/rw/nagios.cmd"
while true;do
        nc -k -l 1234 >> ${CommandFile}
done


then you can do a simple script to be run by cron on your client host

could look something like this: (it works i have a solution like this)

#!/bin/bash
hostname="mydummyhost"
plugindir="/usr/local/nagios/libexec"
nagioshost="destination-server"
netcat_port="1234"

OUTPUT=`${plugindir}/check_ping -H ${nagioshost} -w 3000.0,80% -c
5000.0,100% -p 5`
ALIVE=$?

if [ ${ALIVE} = 0 ]; then
NAME[0]="Load"
CHECK[0]="${plugindir}/check_load -w 15,10,5 -c 30,25,20"

NAME[1]="Swap"
CHECK[1]="${plugindir}/check_swap -w 20% -c 10%"

NAME[2]="Root Partition"
CHECK[2]="${plugindir}/check_disk -w 20% -c 10% -p / -m"

NAME[3]="Zombie Procs"
CHECK[3]="${plugindir}/check_procs -w 5 -c 10 -s Z"

i=0
for num in $(seq 0 $((${#CHECK[@]} - 1)))
do
    OUTPUT=`${CHECK[$num]}`
    STATE=$?

    echo "[`date +%s`] PROCESS_SERVICE_CHECK_RESULT;${hostname};
${NAME[${i}]};${STATE};${OUTPUT}"|nc ${nagioshost} ${netcat_port}

    i=${i}+1
done
fi


Vänliga hälsningar / Best Regards
Mattias Ryrlén

__________________________
op5 AB
Första Långgatan 19
SE-413 27 Göteborg
Mobil: +46 735-17 70 99
Support: +46 31-774 09 24
www.op5.com


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
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