How can I have a log generated on a router incase of NAT POOL depletion using EEM
The show ip nat statistics command would return the percentage X of addresses used in a NAT pool.
In case the percentage X = or > 80% a logg should be triggered and if possible it has to send a small email notification if possible.
Has anyone done the scripting for this before. If so could you please me know.
Then this script should work. It hasn't been thoroughly tested, but it should send a syslog message when the NAT pool usage reaches a certain threshold. To install it you will first need to create a directory on flash called, for example, policies:
Then copy the script into that directory:
Router#copy tftp://18.104.22.168/nat-pool-pol.tcl flash:/policies
Then, you will need to set two EEM environment variables: nat_pool_name and nat_pool_threshold. For example:
event manager environment nat_pool_name hotspot
event manager environment nat_pool_threshold 80
Then you will need to tell EEM where to find user policies:
event manager directory policy flash:/policies
Then register the nat-pool-pol.tcl policy:
event manager policy nat-pool-pol.tcl type user
The policy will run every 60 seconds, and check the capacity of the specified NAT pool. If the pool's capacity is at or over the specified threshold, a syslog message will be sent.