Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
New Member

SNMP OID to get active static NAT number of a router

Hello,

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  1.3.6.1.4.1.9.10.77.1.2.3.0.

But il does not work for one-to-one active NAT translations.


Does anyone have a solution to get that ?

Thanks

Julien

Everyone's tags (4)
7 REPLIES
Cisco Employee

Re: SNMP OID to get active static NAT number of a router

Hi Julien,

I believe you refer to the cnatAddrBindNumberOfEntries OID?

1.3.6.1.4.1.9.10.77.1.2.1

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.

From:

http://tools.cisco.com/Support/SNMP/do/BrowseOID.do?local=en&translate=Translate&objectInput=1.3.6.1.4.1.9.10.77.1.2.1#oidContent

New Member

Re: SNMP OID to get active static NAT number of a router

Hi Raphael,

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 ...

Cisco Employee

Re: SNMP OID to get active static NAT number of a router

Hi Julien,

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:

http://forums.cisco.com/eforum/servlet/EEM?page=eem&fn=script&scriptId=1741

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 1.3.6.1.2.1.90.1.2.1.1.3.5.99.105.115.99.111.7.99.117.115.116.111.109.49

New Member

Re: SNMP OID to get active static NAT number of a router

Thanks for your response.

It indeed seems to be the only solution.

New Member

Can someone help us on this,

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,

Dardan

New Member

There are at least two

IOS-XE supports the SNMP MIB since 3.15 version

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 1.3.6.1.2.1.90.1.2.1.1.3.3.110.97.116.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

New Member

Re: SNMP OID to get active static NAT number of a router

Please, show full script

How work with script ?!

snmp agent request OID and run execute that script ?!

8241
Views
15
Helpful
7
Replies
CreatePlease to create content