Pinging from an EEM applet

A while ago one of my readers wanted to perform an extended ping from an EEM applet. For whatever reason the extended ping syntax wasn’t good enough for him, so I told him to use the pattern parameter of the action cli command EEM applet statement.

Here’s the final result … ugly, but working:

event manager applet ping
event none sync yes
action 100 cli command "enable"
action 101 cli command "ping" pattern "[ip]"
action 102 cli command "ip" pattern "address"
action 103 cli command "10.10.10.10" pattern "count"
action 104 cli command "5" pattern "size"
action 105 cli command "100" pattern "seconds"
action 106 cli command "2" pattern "commands"
action 107 cli command "y" pattern "interface"
action 108 cli command "20.20.20.20" pattern "service"
action 109 cli command "0" pattern "header"
action 110 cli command "no" pattern "data"
action 111 cli command "no" pattern "pattern"
action 112 cli command "0xABCD" pattern "Verbose"
action 113 cli command " " pattern "size"
action 114 cli command "n"

5 comments:

  1. What's wrong with doing all in a one line command?
    e.g. ping 10.10.10.10 source 20.20.20.20 repeat 5 size 100 timeout 2 data ABCD
    Anyway, nice applet, the question is can you make it partially interactive? such as predefining everything else except the ping destination and the repeat count, for example?
    I mean, the user only types ping, then it prompts for IP and amount, all the rest is implicit...
  2. I also couldn't figure that out ... well I was not trying hard ;) Will do a post on an interactive version, it's quite doable with EEM 3.0.
  3. Hi - TOS is missing - that's a point (maybe available in 15?!) . Maybe he's using clns ping.. also a point :-)
  4. because there are some versions not supporting the extended ping in one line command.
    thanks IVAN for you HELP.
  5. That must be a switch, right? Can't image a router having decent EEM (with "pattern" keyword) and not having one-line ping.
Add comment
Sidebar