oxidized icon indicating copy to clipboard operation
oxidized copied to clipboard

Remove constantly updating value from custom SNMP OID

Open syn-bit opened this issue 4 months ago • 1 comments

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

  • [ ] Passes rubocop code analysis (try rubocop --auto-correct)
  • [ ] Tests added or adapted (try rake test)
  • [ ] Changes are reflected in the documentation
  • [ ] User-visible changes appended to CHANGELOG.md

Description

syn-bit avatar Oct 09 '24 11:10 syn-bit