Re: problem with submit_check_result

Stanley Hopcroft <[email protected]> Thu, 12 Dec 2002 10:45:39 +1100
Newsgroups gmane.network.netsaint.user
Message-ID <[email protected]>
 Dear Sir,

I am using passive service check results to handle traps from snmptrapd
and submit them to Netsaint 0.0.7 and Nagios 1.0.

The difference may be that I am not using NCSA: my snmptrapd and 
Nag/Netsaint are on the same (single monitor) host.

Are you using distributed monitoring ?

If not, then you don't need send_ncsa.

Here is one of my trap handlers

# Given a FQDN, get the short name of the host as it is setup in 
NetSaint
hostname="unknown"
case $host in
        10.0.0.222)
            hostname="Foundry1500"
            ;;
        localhost)
            # FIXME.
            # Testing only.
            hostname="Foundry1500"
            ;;
esac
        
# Get severity level (OK, WARNING, UNKNOWN, or CRITICAL) and plugin 
output based on trape type

state_OK=0
state_UNKNOWN=3
state_WARNING=1
state_CRITICAL=2

 
echocmd="/bin/echo"
CommandFile="/usr/local/nagios/var/rw/nagios.cmd"
 

state=state_UNKNOWN
output="No output"

case $1 in

        # newRoot (potential topology change since BPDUs aren't being 
received from old root)
        1)
            service_desc="Topology change: New root of spanning tree 
trap"
            output="Failed. Potential problem since STP has computed new 
root"
            state=$state_CRITICAL
            ;;

        # newRoot reset (Bogon OID. This bogus trap lets us reset a 
Fault state.)
        # Yes it's dumb but I didn't know better then.
        1111)
            service_desc="Topology change: New root of spanning tree 
trap"
            output="Ok. Spanning Tree Protocol computed the same old 
root again. Boring."
            state=$state_OK
            ;;

esac


# get the current date/time in seconds since UNIX epoch
datetime=`date +%s`
 
# create the command line to add to the command file
cmdline="[$datetime] 
PROCESS_SERVICE_CHECK_RESULT;$hostname;$service_desc;$state;$output"
 
# append the command to the end of the command file
`$echocmd $cmdline >> $CommandFile`

Mainly this is taken from the Nag/Netsaint docs for Integrating Net-SNMP 
with Netsaint/Nagios and the Net-SNMP docco.

If you have a distributed set up (ie more than one Netsaint host) then 
its harder to debug

Please post again if this is the case.

Yours sincerely.



-- 
------------------------------------------------------------------------
Stanley Hopcroft
------------------------------------------------------------------------

'...No man is an island, entire of itself; every man is a piece of the
continent, a part of the main. If a clod be washed away by the sea,
Europe is the less, as well as if a promontory were, as well as if a
manor of thy friend's or of thine own were. Any man's death diminishes
me, because I am involved in mankind; and therefore never send to know
for whom the bell tolls; it tolls for thee...'

from Meditation 17, J Donne.


-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility 
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/