snmp scripts
SolarWinds Professional Plus has this feature or if you are good you can write the script yourself if you familiar with snmp. Here is a sample:
#!/opt/CSCOcwh/bin/expect --
#
# File: cswcmd (Cisco switch command, derived from ciscocmd)
#
# Author: Darin Davis, darin_davis@ins.com
# Date: 2 October 1998
# Update: 1 March 1999
# Desc: Connects to Cisco switch and runs a single user-specified command.
# If user provides an enable password, the command is run in
# enable mode, otherwise the command is run in user mode.
#
# We know the command is done when we see the prompt ('(enable)'
# enable mode). Unfortunately, there is no standard character
# to indicate the user mode prompt. Typically, the prompt is
# set to the switch hostname, but there is no guarantee the user
# mode prompt will agree with DNS. So, the user must manually
# verify that the hostname given to cswcmd resolves in DNS or
# /etc/hosts, and matches the user mode prompt.
#
# Input: user-specified command line parameters
# Output: stdout
# Usage: See usage().
#################
### VARIABLES ###
#################
# set defaults
set swtch "switch.acme.com"
set prompt ""
set login_passwd "2easy"
set enable_passwd "2easy"
set cmd "nop"
set reason "" ;# holds reason why telnet won't start
###################
### SUBROUTINES ###
###################
################################
# login to switch
################################
proc login {} {
global login_passwd
expect "assword:"
send "$login_passwd\r"
# check for invalid login password
expect {
"assword:" {
puts "Invalid login password. Exiting."
exit 1
}
" " { }
default { }
}
}
################################
# enter enable mode
################################
proc enable {} {
global enable_passwd
send "en\r"
expect "assword:"
send "$enable_passwd\r"
# check for invalid enable password
expect {
"(enable)" { }
default {
puts "Invalid enable password. Exiting."
exit 2
}
}
}
################################
# display program usage statment
################################
proc usage {} {
puts "\nUsage:\n"
puts " cswcmd hostname_or_ip -l login_pw \[-e enable_pw\] \"cmd\"\n"
puts " If an enable password is supplied, the \"cmd\" is run in enable"
puts " mode. Otherwise, the \"cmd\" is run in user mode.\n"
puts " NOTE: \"cmd\" *must* be enclosed in double quotes.\n"
exit 3
}
#################
### MAIN CODE ###
#################
### process command line parms ###
# if provides minimum number of args
if { $argc > 3 } {
set swtch [lindex $argv 0]
# ensure we got "-l"
if { [lindex $argv 1] != "-l" } {
usage
}
# save login password
set login_passwd [lindex $argv 2]
} else { usage } # didn't get minimum number of args
# if user didn't provide enable pw
if { $argc == 4 } {
# save command
set cmd [lindex $argv 3]
} else {
# if user provided an enable pw
if { $argc == 6 } {
# ensure we got "-e"
if { [lindex $argv 3] != "-e" } {
usage
}
# save enable password
set enable_passwd [lindex $argv 4]
# save command
set cmd [lindex $argv 5]
} else { usage } # user gave wrong num of parms
}
### determine prompt ###
regsub {\..+$} $swtch "" prompt ;# note unqualified hostname
# optionally set enable mode prompt
if { $argc == 6 } {
set prompt "(enable)"
}
#puts "prompt = $prompt"
#puts "swtch = $swtch"
#puts "login_passwd = $login_passwd"
#puts "enable_passwd = $enable_passwd"
#puts "cmd = $cmd"
#exit
### login to switch ###
#set timeout 20 ;# allow some extra time to
# get results
# make sure telnet launched OK
if [ catch "spawn telnet $swtch" reason ] {
puts "Couldn't telnet to $swtch ($reason)"
exit 4
}
# make sure we got connected
expect {
"Connected" { }
default {
puts "Couldn't connect to $swtch. Exiting."
exit 5
}
}
# login to switch
login
# enter enable mode if necessary
if { $argc == 6 } {
enable
}
send "$cmd\r" ;# execute command
# view all pages of output
while {1} {
expect {
"$prompt" { # saw last page of processes
break ;# so we're done
}
"More--" { # have another page to view,
send " " ;# so view it
}
default {
puts "Couldn't find prompt '$prompt'. Exiting."
exit 6
}
}
}
send "exit\r"
#puts "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"