cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
6173
Views
20
Helpful
17
Replies

EEM regexp exclude word

fractal90
Level 3
Level 3

hi, please tell me two points:

1. I want to exclude a word in eem via regexp, for example there is a line:

sh run | i hostname
hostname test-router

i need to select everything except "hostname" and "router"

doing so:

action 112 regexp "(!?hostname|-router)" "$_cli_result" name

but it doesn't work because eem swears at the "?" and it is removed

2. how to make a delay in EEM, let's say it should trigger on "event track 10 state down" I just want him to wait 3 minutes after he fixes it and then run all the necessary commands

17 Replies 17

Change action 0030 to this line and variable $octet3and4 will contain the value of the last two octets.  action 0040 is not needed.  

action 0030 regexp "([0-9]+\.[0-9]+\.([0-9]+\.[0-9]+))" $_cli_result match WANIP octet3and4

 

 

Hello,

 

not sure if the second part of your question has already been answered:

 

--> 2. how to make a delay in EEM, let's say it should trigger on "event track 10 state down" I just want him to wait 3 minutes after he fixes it and then run all the necessary commands

 

The line:

 

action x wait 180

 

would delay the execution of the script, depending on where that line is placed in the script.

thought about the proposed a little, apparently the best option would be the following

if the line "% TRACK-6-STATE: 10 ip sla 10 reachability Up -> Down" appears in syslog, then turn on the countdown, if the line "% TRACK-6-STATE: 10 ip sla 10 reachability does not appear in syslog in 5 minutes Down-> Up "then further check the mac address on the port and send the letter

 

though I'm still thinking how to portray it