I try to get by SNMP the number of active one-to-one NAT translations of a 3825 router.
I only find the way to get the number of active PAT translations with the OID 184.108.40.206.220.127.116.11.18.104.22.168.0.
But il does not work for one-to-one active NAT translations.
Does anyone have a solution to get that ?
I believe you refer to the cnatAddrBindNumberOfEntries OID?
This object maintains a count of the number of entries that currently exist in the cnatAddrBindTable. Which is the table holding information about the currently active NAT BINDs.
The OID you specify (cnatAddrBindNumberOfEntries) seems to be useful to get the number of NAT declared in the config.
I try to get the numbers of effective active translations, the value you get from the "show ip nat statistics" command (here 202) :
Total active translations: 202 (1 static, 201 dynamic; 201 extended)
This value seems not to be available by SNMP ...
I have done some search and found (internally) that this counter is not supported, there was an enhancement request filed to have it but it's not in the pipe so I don't believe it will be any time soon. The "workaround" explicitly specify to use the CLI command...
However, if you are running a 3800 series with a recent IOS version, I believe you may have support for EEM scripts and custom SNMP MIBs. A good workaround for you might be to use the following script:
Check the TCL file header for an example on how to configure it, you'll need to specify all the variables needed among which those two:
event manager environment match_cmd show ip nat stat
event manager environment match_pattern .*Total active translations: ([0-9]+) .*
The value of the counter should appear in 22.214.171.124.126.96.36.199.188.8.131.52.184.108.40.206.220.127.116.11.18.104.22.168.109.49
Can someone help us on this, please? The link for the script is not available any more.
We've been trying a lot, with a lot of devices and IOS versions, but always encounter some issue/problem.
Thank you in advance,
And there are at least two methods for a manipulating expression-MIB
1) With EEM Tcl script (The right way)
I.e this Tcl script: Cli Value 2 Snmp Expr MIB
2) With EEM CLI applet (Simple, but potentially can conflict with other EEM applets).
Below lab config (Use at your own risk!):
1. Create expression owner
snmp mib expression owner nat name 1
description Total active translations
value type integer32
2. EEM applet
Every 10 minutes the applet sets the total number of translations to expression MIB.
The SNMP OID for pullig 22.214.171.124.126.96.36.199.188.8.131.52.184.108.40.206.1.49
How to calculate OID: Custom MIB (page10)
no event manager applet test
event manager applet test
event timer watchdog time 600 maxrun 60
action 010 cli command "enable"
action 030 cli command "configure terminal"
action 040 cli command "do-exec show ip nat translations total"
action 090 regexp "^.+\s([0-9]+)" "$_cli_result" match total_translations
action 100 cli command "snmp mib expression owner nat name 1"
action 110 if $_regexp_result eq "1"
action 120 cli command "expression $total_translations"
action 130 else
action 140 cli command "expression 0"
action 150 cli command "exit"
action 160 end