Remove constantly updating value from custom SNMP OID #3299
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adding a custom SNMP OID means having a different "expression " line each time the config is pulled. Add a rule to remove the expression value.
EEM code to generate the custom SNMP OID is:
event manager applet TotalNatTranslations
event timer watchdog time 300 maxrun 60
action 010 cli command "enable"
action 020 cli command "configure terminal"
action 030 cli command "do-exec show ip nat translations total"
action 040 regexp "^.+\s([0-9]+)" "$_cli_result" match total_translations
action 050 cli command "snmp mib expression owner nat name 1"
action 060 if $_regexp_result eq "1"
action 070 cli command "expression $total_translations"
action 080 else
action 090 cli command "expression 0"
action 100 cli command "exit"
action 110 end
The resulting configuration block is:
snmp mib expression owner nat name 1
description Total active translations
value type integer32
expression 1234
!
After this commit the resulting configuration block is:
snmp mib expression owner nat name 1
description Total active translations
value type integer32
expression
!
Pre-Request Checklist
rubocop --auto-correct
)rake test
)Description