nv-l
[Top] [All Lists]

Re: Sending Trap Variables to scripts

To: nv-l@lists.tivoli.com
Subject: Re: Sending Trap Variables to scripts
From: "CATALINA MARTINEZ" <CATALINA.MARTINEZ@tlc.state.tx.us>
Date: Mon, 10 Sep 2001 10:58:30 -0500
This is a MIME message. If you are reading this text, you may want to 
consider changing to a mail reader or gateway that understands how to 
properly handle MIME multipart messages.
To all, Below is a script that I wrote that will export the text name of a port 
from a Cisco 6509 switch. 

Scenerio: there are servers and other cisco devices connected to the 
6509switch. The script should only be executed if the portname is a cisco 
device. The devices do not have a naming pattern. 

What I was thinking of doing was: set up a smartset which will contain all 
servers and then if the port name is found in the smartset execute the script.

The trap is being sent by 6509 switch when one of its links goes down and the 
trap only have the name of the device and port number. Therefore, the script is 
executed to display the text name of the portname..

Question: can I query a smartset via a command line? I would like this script 
to execute if the "Portname" is not found in the smartset. Or is it easier to 
use a ruleset? Any suggestions?

#!/bin/ksh
##############################################
#The commands below will export window to workstatons
export DISPLAY=CMartinez:0.0
#In the line below, the / from the mod/port is replaced by a . period
port=`echo $2 | tr '/' '.'`
#The command below will do an snmpget for the name of the device
#Input variables are hostname and portnumber
portname=`/usr/OV/bin/snmpget $1 .1.3.6.1.4.1.9.5.1.4.1.1.4.$port`
#echo 'Port name =' ${portname##*:}
name=${portname##*:}
#the commands below will send and email and display popup window
echo $1 $name | mail -s "CORE DEVICE DOWN" catalina
/usr/OV/bin/ovxbeep -b 10 "$1 $name is DOWN"&
exit
To all, Below is a script that I wrote that will export the text name of a port from a Cisco 6509 switch.
 
Scenerio: there are servers and other cisco devices connected to the 6509switch. The script should only be executed if the portname is a cisco device. The devices do not have a naming pattern.
 
What I was thinking of doing was: set up a smartset which will contain all servers and then if the port name is found in the smartset execute the script.
 
The trap is being sent by 6509 switch when one of its links goes down and the trap only have the name of the device and port number. Therefore, the script is executed to display the text name of the portname..
 
Question: can I query a smartset via a command line? I would like this script to execute if the "Portname" is not found in the smartset. Or is it easier to use a ruleset? Any suggestions?
 
#!/bin/ksh
##############################################
#The commands below will export window to workstatons
export DISPLAY=CMartinez:0.0
#In the line below, the / from the mod/port is replaced by a . period
port=`echo $2 | tr '/' '.'`
#The command below will do an snmpget for the name of the device
#Input variables are hostname and portnumber
portname=`/usr/OV/bin/snmpget $1 .1.3.6.1.4.1.9.5.1.4.1.1.4.$port`
#echo 'Port name =' ${portname##*:}
name=${portname##*:}
#the commands below will send and email and display popup window
echo $1 $name | mail -s "CORE DEVICE DOWN" catalina
/usr/OV/bin/ovxbeep -b 10 "$1 $name is DOWN"&
exit




<Prev in Thread] Current Thread [Next in Thread>

Archive operated by Skills 1st Ltd

See also: The NetView Web