07-20-2010 12:19 PM
Hi,
Strange problem, that I am sure is being caused by me.
Basically trying to run an advanced Compliance mgmt job, looking for a set of pre-requisites (this is working) and then removing all non compliance SNMP community strings from a sample device.
I use two lines for this removal
- snmp-server community [#!testR[OW]mon#] [#.*#] [#.*#]
- snmp-server community [#!SNMP#] [#.*#] [#.*#]
From what I see, this should remove all snmp-server communities from a device other than "testROmon", "testRWmon" and "SNMP". Obvious caveat is that they would all need to have two words after this (in this case, these are ro or rw and an ACL).
When I run this it seems to try and remove twice as many snmp community strings as there actually are on the device config? So I guess the core questions are: -
1) Does the above look sound and would it do what I think
2) Does the Compliance management engine parse the entire config independantly for each line of the above and hence explain why I am getting more removals than I would expect or is there a problem somewhere?
Any help on this appreciated as its driving me nuts
Solved! Go to Solution.
07-20-2010 01:10 PM
I think you probably want:
- [#snmp-server community (?!testR[OW]mon |SNMP ).*#]
07-20-2010 01:10 PM
I think you probably want:
- [#snmp-server community (?!testR[OW]mon |SNMP ).*#]
07-20-2010 02:30 PM
Thanks Joseph,
Any chance of breaking the last bit down for me? What does the | and the ? do.
07-20-2010 02:49 PM
It's a negative lookahead assertion that checks to make sure that a community string is not either of those two patterns. It will remove lines like:
snmp-server community public RO
07-20-2010 02:55 PM
Thanks Joseph,
So if I also wanted to remove all SNMP traps bar: -
snmp-server host 10.10.10.x (where x is any ip in the last octet)
From a device, would I use
- [#snmp-server host (!#10\.10\.10\..*#).#]
Or doesn't this make sense?
07-20-2010 04:24 PM
No, the pattern would be:
- [#snmp-server host (?!10\.10\.10\..*)#]
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide