EEM CLI patterns are not context sensitive

When writing EEM applets or policies that act on CLI commands, keep in mind that the pattern matching is not context sensitive. For example, if you want to disable the reload command and use the EEM applet …
event manager applet NoReload
 event cli pattern "reload" sync no skip yes
… you cannot enter the action x.y reload configuration command any more (or any other command that includes the string reload).

To distinguish the reload command from other appearances of the same string, use the ^reload pattern (reload occuring at the beginning of the line).

Trivia: this actually occured to me when I was testing the setup described in the December IP Corner article. Sometimes we have to learn the hard way :)

6 comments:

  1. Hi, I would like to know if EEM policy applet or TCL script able to use the following

    action cli command "telnet xxx.xxx.xxx.xxx"

    remote terminal and send action cli command to that remote terminal ?

    Thx
  2. In theory, it could be doable, but I need to test it in the lab to be sure.
  3. So hows the test in the lab ? Is it doable ? Because i have tried and it failed.
  4. So far, a failure ...
  5. EEM 3.0 has an enhanced cli event detector that allows you to specify the mode of the command. Unfortunately the mode values that you can use are not obvious and not documented. However, there is a hidden command to see the modes - 'show parser mode' - the name column lists the various parser modes. Since it's a hidden command, use it at your own risk.
  6. hi ivan,

    i am totally confuse in sync yes|no skip yes|no. what is the mean of sync and skip, when we use these keywords and what is the mean of yes and no. please help me
Add comment
Sidebar