Reply

NetMRI Script to clean up bad SNMP strings

Posts: 80
2758     0

Just wanted to share my CCS script for the forums.  Say you have lots of devices with old snmp community strings and a new one that you want to use.  This will go through and make sure the new community string has been added.  Then it will go back through and remove the old ones.

 

Susan

 

It's attached - netmri scriptfortheforum.txt

Highlighted

Re: NetMRI Script to clean up bad SNMP strings

Adviser
Posts: 410
2758     0

Here is one that will find anything and remove it Smiley Happy

 

Script-Filter:
$vendor eq "Cisco" and $sysdescr like /IOS/

########################################################################
Action:
Config SNMP

Action-Commands:
SET: $updatemade = "no"
sh run | inc snmp-server
#snmp-server community public RO
#snmp-server community infoblox RW
#snmp-server community sifbaksh RO

Output-Triggers:
Parse Output
########################################################################
Trigger:
Parse Output

Trigger-Variables:
$snmpcom string

Trigger-Template:
snmp-server community [[$snmpcom]] (RO|RW)

Trigger-Commands: { $updatemade eq "no"}
DEBUG:config t

Trigger-Commands:
DEBUG:no snmp-server community $snmpcom
SET: $updatemade = "yes"

###########################################

Action:
Add New Community

Action-Commands:{ $updatemade eq "yes"}
DEBUG:snmp-server community infoblox RW
DEBUG:snmp-server community sifbaksh RW
DEBUG:end
DEBUG:wr mem

Action-Commands:{ $updatemade eq "no"}
DEBUG:config t
DEBUG:snmp-server community infoblox RW
DEBUG:snmp-server community sifbaksh RW
DEBUG:end
DEBUG:wr mem

Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh

Re: NetMRI Script to clean up bad SNMP strings

Posts: 80
2759     0

True, but I only wanted to remove the SNMP strings on some devices where the new one was in place.  The rest I wanted to keep as is Smiley Happy

Showing results for 
Search instead for 
Do you mean 

Recommended for You