12-17-2018 07:56 PM
Hi All,
I'm updating an existing script to look for a Syslog entry and based on a match, proceed or exit. I can't seem to get this working and am looking for some guidance. Script works without Actions 1.0 to 1.8 but with Actions 1.0 to 1.8 fails to match on the CLI_Result
event manager applet reset_cellular_connection
event track 12 state down maxrun 86400
action 1.0 syslog priority informational msg "Wait period of 240 seconds for Check_Cellular_LTE_Connection script to run"
action 1.1 wait 240
action 1.2 cli command "enable"
action 1.3 cli command "show log | include Safeguard"
action 1.4 wait 5
action 1.5 regexp "%HA_EM-6-LOG: Check_Cellular_LTE_Connection: Safeguard" "$_cli_result" match Safeguard
action 1.6 syslog msg "$regexp_result"
action 1.7 if $_regexp_result eq "0" goto 2.0
action 1.8else if $_regexp_result eq "1" goto 9.1
action 2.0 syslog priority informational msg "Power cycling modem"
action 3.0 cli command "enable"
action 4.0 cli command "config terminal"
action 5.0 cli command "service internal"
action 6.0 cli command "end"
action 7.0 cli command "test cellular 0/0/0 modem-power-cycle"
action 7.1 wait 600
action 7.2 cli command "show track 12"
action 7.3 regexp "Boolean OR is Down" "$_cli_result" match Down
action 7.4 syslog msg "Verify if theres an ICMP Response, loop & reset again if ICMP Echo Fails"
action 7.5 if $_regexp_result eq "1" goto 7.0
action 7.6else if $_regexp_result eq "0" goto 7.7
action 7.7 syslog priority informational msg "Modem Reset restored connection & ICMP-Echo-Reply Received"
action 8.0 cli command "config terminal"
action 9.0 cli command "no service internal"
action 9.1 cli command "end"
action 9.2 cli command "exit"
12-20-2018 12:56 AM
Hi there,
Have you tried putting the match statement in brackets:
action 1.5 regexp "(%HA_EM-6-LOG: Check_Cellular_LTE_Connection: Safeguard)" "$_cli_result" match Safeguard
cheers,
Seb.
12-20-2018 06:04 PM
Hi Seb,
I couldn't remember if I have tried the Action in that format, but in testing now, the script passes through to Action 1.6 and then Action 2.0 which is not the desired result given the syslog entry exists.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide