Update the SNMP server location on IOS devices whose name does not
indicate that it is a console server, pstn gateway, or IPv6 device. It
is likely that you'll want to modify the script to add other location
specific information.
############################################################
Script:
SNMP location update
Script-Description:
Update the SNMP server location on IOS devices whose name
does not indicate that it is a console server, pstn gateway,
or IPv6 device. It is likely that you'll want to modify the
script to add other location specific information.
Script-Filter:
$Vendor eq "Cisco"
and $sysDescr like /IOS/
and $Name not like /.*(V|v)6.*/
and $Name not like /.*(console|Console|pstn).*/
#########################################################################
Action:
Show SNMP Location
Action-Description:
This command shows the information contained in the SNMP server
location field.
Action-Commands:
SET:$doit="yes"
show snmp location
Output-Triggers:
Update
Update SNMP Location LAN
Update SNMP Location WAN
#########################################################################
Trigger:
Update
Trigger-Description:
Make sure LAN or WAN don't already exist.
Trigger-Variables:
$snmpLocation "/(WAN|LAN|wan|lan|INTERNET|internet|Internet)/"
Trigger-Template:
[[$snmpLocation]]
Trigger-Commands:
SET:$doit="no"
#########################################################################
Trigger:
Update SNMP Location LAN
Trigger-Description:
Update the SNMP server location with LAN.
Trigger-Variables:
$snmpLocationLAN "/[\\w ]+/"
Trigger-Template:
[[$snmpLocationLAN]]
Trigger-Filter:
$doit eq "yes"
and ($Type eq "Switch-Router"
or $Type eq "Router")
and $Name not like /.*-(A|a)$/
Trigger-Commands:
config terminal
snmp-server location $snmpLocationLAN LAN
end
write memory
#########################################################################
Trigger:
Update SNMP Location WAN
Trigger-Description:
Update the SNMP server location with WAN.
Trigger-Variables:
$snmpLocationWAN "/[\\w ]+/"
Trigger-Template:
[[$snmpLocationWAN]]
Trigger-Filter:
$doit eq "yes"
and $Type eq "Router"
and ($Name like /.*-(A|a)$/
Trigger-Commands:
config terminal
snmp-server location $snmpLocationWAN WAN
end
write memory
#########################################################################