Xymon Mailing List Archive search

Hobbit, Net-snmp snmptrap,and HPOV

list Figaro Nicolas
Mon, 19 Sep 2005 17:23:05 +0200
Message-Id: <user-28d4b39cb94d@xymon.invalid>

There is an option to snmptrap (from net snmp) to send full OIDs, otherwise they are cut. Instead of "snmptrap -v 1", the options should be :
"snmptrap -v 1 -Of"

Otherwise only the end of the OID is sent. 
Nicolas Figaro
-----Message d'origine-----
De : David Gore [mailto:user-0ef10ea25696@xymon.invalid] Envoyé : lundi 19 septembre 2005 17:11
À : user-ae9b8668bcde@xymon.invalid
Objet : Re: [hobbit] Hobbit, Net-snmp snmptrap,and HPOV


David Gore wrote:
Coupe, Mark (ITD) wrote:
All,
I'm trying to push alarms from Hobbit to HPOV.  We have a custom
script that is invoking Netsnmp's snmptrap.  The snmp traps are >> reaching the HP Node Manager Event Browser correctly.  However, the OV >> operations trap condition is not recognizing the trap.  The trap is >> being displayed as "unmatched" in the Message Browser even though >> there is a condition set up for that specific trap.
When we look at the unmatched trap, it appears that the OID is not
being recognized and an '0' is inserted, for example instead of >> .1.3.6.1.4.1.7058.0.XX, we are seeing .0.0.XX.
Any guidance would be greatly appreaciated.
Thanks,
-Mark Coupe
I, and perhaps others would be interested in what precisely you are
doing?  Are you pushing all hobbit alarms from the hobbit server to
HPOV?
Sorry, I am HPOV ignorant, but we are interested in forwarding all the
hobbit alarms/alerts as SNMP traps to one of Concord's products.  I am > not to familiar with Concord's product either.  I just know the powers > that be would like to have snmp traps from all our monitored hosts.
In otherwords, I am interested in any system or methodology that > someone
has setup to forward alarms from the hobbit server to an SNMP server. > Any setups out there that someone is willing to share the details?
David
Here is Mark's script posted with permission:

SCRIPT

#!/bin/bash

#SVCCODES="disk:100,cpu:200,procs:300,svcs:350,msgs:400,conn:5
00,http:60
0,ftp:721,ssh:722,ssh1:722,ssh2:722,telnet:723,smtp:725,fping:
727,mq:729
,dns:800,pop2:809,pop-2:809,pop:810,pop3:810,pop-3:810,nntp:81
9,imap:843
,imap2:843,imap3:843,imap4:843,mrtg:850,swap:860,memory:870,sy
s:880,err:
890,test:901"

#Variables
#$OID - OID to be used without trailing value (.1.3.6.1.4.1.7058)(BB
default)
#$OIDTAIL - ending value of OID particluar to alarm type; determined by "case" statement #$MACHIP - IP address of device generating alarm; determined by hobbit #$BBHOSTNAME - hostname of device generating alarm; determined by the hobbit bb-hosts file #$BBSVCNUM - service code corresponding to the service being monitored; determined by hobbit configuration #$BBCOLORLEVEL - alarm level; determined by hobbit #$RECOVERED - '0' denotes alarm; '1' denotes recovery #$HPOV - the IP address of the destination HPOV server #TMPDIR - directory for location of temporary file necessary for sed of $MACHIP

###Start script ###
###
CHRONO=`date`
OID=.1.3.6.1.4.1.7058
#Put your own OV server IP address in the next line. HPOV=xxx.xxx.xxx.xxx TMPDIR=/home/hobbit/server/ext


case $BBSVCNUM in
100)    #Disk
         OIDTAIL=10
         ;;
200)    #CPU
         OIDTAIL=20
         ;;
300)    #Procs
         OIDTAIL=30
         ;;
350)    #Svcs
         OIDTAIL=40
         ;;
400)    #Msgs
         OIDTAIL=50
         ;;
500)    #Conn
         OIDTAIL=60
         ;;
600)    #Http
         OIDTAIL=70
         ;;
#OIDTAIL=80 (not assigned)
721)    #FTP
         OIDTAIL=90
         ;;
722)    #SSH
         OIDTAIL=100
         ;;
723)    #Telnet
         OIDTAIL=110
         ;;
725)    #SMTP
         OIDTAIL=120
         ;;
727)    #Fping
         OIDTAIL=130
         ;;
729)    #MQ
         OIDTAIL=140
         ;;
800)    #DNS
         OIDTAIL=150
         ;;
809)    #POP2
         OIDTAIL=160
         ;;
810)    #POP
         OIDTAIL=170
         ;;
819)    #NNTP
         OIDTAIL=180
         ;;
843)    #IMAP
         OIDTAIL=190
         ;;
850)    #MRTG
         OIDTAIL=200
         ;;
860)    #Swap
         OIDTAIL=210
         ;;
870)    #Memory
         OIDTAIL=220
         ;;
880)    #Sys
         OIDTAIL=230
         ;;
890)    #ERR
         OIDTAIL=240
         ;;
901)    #Test
         OIDTAIL=250
         ;;
esac

if [[ "$RECOVERED" = "0" ]]; then
         if [[ "$BBCOLORLEVEL" = "purple" ]]; then
                 OIDTAIL=$(($OIDTAIL + 1))
         elif [[ "$BBCOLORLEVEL" = "yellow" ]]; then
                 OIDTAIL=$(($OIDTAIL + 2))
         elif [[ "$BBCOLORLEVEL" = "red" ]]; then
                 OIDTAIL=$(($OIDTAIL + 3))
         fi
elif [[ "$RECOVERED" = "1" ]]; then
         BBCOLORLEVEL=green
fi

#Following line: reads Hobbit IP into temporary file
echo $MACHIP > $TMPDIR/tmpfile.txt

#Following lines: puts Hobbit 12 digit IP format in dotted decimal and removes any leading zeroes. MACHIP=`sed 's/\(...\)\(...\)\(...\)\(...\)/\1.\2.\3.\4/'
$TMPDIR/tmpfile.txt`
echo $MACHIP > $TMPDIR/tmpfile.txt
MACHIP=`sed -e 's/^00//' -e 's/^0//' -e 's/\.000/./' -e 's/\.00/./' -e 's/\.0/./' -e 's/\.000/./' -e 's/\.00/./' -e 's/\.0/./' -e 's/\.000/./' -e 's/\.00/./' -e 's/\.0/./' -e 's/\.\.\./.0.0./' -e 's/\.\./.0./' -e 's/\.$/.0/' $TMPDIR/tmpfile.txt`

#Following line: removes the temporary file
rm -f $TMPDIR/tmpfile.txt

#Following line: forwards the error message to HPOV as an SNMP message `snmptrap -v 1 -c mitcovo $HPOV "$OID" "$MACHIP" 6 $OIDTAIL ""`

echo "DATE: $CHRONO" >> /home/hobbit/server/ext/hpov-push.log
echo "snmptrap -v 1 -c public $HPOV "$OID" "$MACHIP" 6 $OIDTAIL "" " >> /home/hobbit/server/ext/hpov-push.log


END SCRIPT