Quantcast
Channel: THWACK: All Content - Network Configuration Manager
Viewing all articles
Browse latest Browse all 6057

Anyone know a command to remove any snmp-server host without having to specify the ip?

$
0
0

Trying to build a remediation script that will remove any and all unwanted snmp-server hosts without having to specify the ip address (such as by wildcarding it or using place holders instead of the actual ip).

 

Say I have: "snmp-server host 1.1.1.1" and "snmp-server host 2.2.2.2" in my device

 

I want to remove "snmp-server host 2.2.2.2" while also writing the script to remove any snmp that is different (so it will also knock out 1.1.1.1 but that's okay since my next line adds only that in). Say for some reason "snmp-server host 3.3.3.3" is in the device. I don't want to have to write out the command "no snmp-server host 3.3.3.3" as I feel there might be a wildcard or placeholder technique to remove all of them and it would be more efficient.

 

Also,  I have tried techniques such as using config block start/end to make the necessary changes when an snmp-server host is wrong. This works to change and remove wrong snmp-server hosts, however I run into problems when a device has no snmp-server host already in place and I want the same rule/remediation to fix the problem. I think this is because the device does not see a start so decides to not insert in the script even though its alerting me that it is not there, not sure why it would offer to alert me and then not offer a way to fix it. Any thoughts?

 

So at the end of the day one technique I can't remediate when the line is absent from the start and the other technique I can't remove the snmp-server hosts without being specific. I know I can do this in two rules but my manager did not like that, so I am trying to find a way to build it into one. Any help would be great.


Viewing all articles
Browse latest Browse all 6057

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>