[c-nsp] EEM applet, any way to substitute "hostname"?

Peter Rathlev peter at rathlev.dk
Fri Apr 8 06:42:45 EDT 2011


When writing an EEM applet, is there any way to substitue e.g. the
hostname into "action cli" commands?

We currently use a configuration like this to gather data on high CPU
load:

 rmon event 10 log description "5 second avg. CPU > 90%" owner lau
 rmon event 11 log description "5 second avg. CPU < 70%" owner lau
 rmon alarm 10 lsystem.56.0 5 absolute rising-threshold 90 10 falling-threshold 70 11 owner lau
 !
 event manager session cli username "lau"
 !
 event manager applet Copy-CPU-usage-on-busy-CPU-rising
  event syslog pattern "the value of lsystem.56.0 exceeded"
  action 1.0 cli command "enable"
  action 1.1 cli command "show processes cpu sorted | redirect tftp://192.0.2.10/stash/HOSTNAME-cpu-rising.txt"
  action 2.0 syslog msg "CPU stats copied to tftp://192.0.2.10/stash/"
 !

This works fine, but since we like to have the hostname embedded in the
uploaded file we have to have a seperate script per device. This doesn't
scale well, so a way of substituting the hostname would be nice.

A "real" TCL script could do this, but it would be somewhat more
configuration, and something that couldn't just exist in running-config.

Suggestions for other ways of accomplishing the task are more than
welcome. :-)

-- 
Peter




More information about the cisco-nsp mailing list