02-27-2014 10:52 PM
Hi looking for some help with my EEM script to check sip-ua register status
See below
event manager applet checksipregister
description applet to do a show run command to check SIP registration. If not registered, a critical syslog will be created. Runs every 300 seconds.
event timer watchdog time 300
action 1 cli command "show sip-ua register status | include no"
action 2 string length "$_cli_result"
action 3 if $_string_result gt 10
action 4 syslog priority critical msg "SIP status is not registered. Please check service."
action 5 end
Output of commands
When trunk is down
ef-dc-vgw02-r2c6#show sip-ua register status | i no
99051000229971 -1 86 no
When trunk is up
(no output)
Without pipe
ef-dc-vgw02-r2c6#show sip-ua register status
Line peer expires(sec) registered P-Associ-URI
================================ ========== ============ ========== ============
99051000229971 -1 239 yes
unfortuently the script keeps sending triggering when the trunk is up.
Solved! Go to Solution.
02-28-2014 07:08 AM
You likely want to do this:
event manager applet checksipregister
event timer watchdog time 300
action 1.0 cli command "enable"
action 2.0 cli command "show sip-ua register status | include no"
action 3.0 regexp "[0-9]+.*no" $_cli_result
action 4.0 if $_regexp_result eq 1
action 5.0 syslog priority critical msg "SIP status is not registered. Please check service."
action 6.0 end
03-03-2014 02:59 AM
You need to add:
event manager session cli username USER
Where USER is a user authorized to run all of the CLI commands in this applet.
02-28-2014 07:08 AM
You likely want to do this:
event manager applet checksipregister
event timer watchdog time 300
action 1.0 cli command "enable"
action 2.0 cli command "show sip-ua register status | include no"
action 3.0 regexp "[0-9]+.*no" $_cli_result
action 4.0 if $_regexp_result eq 1
action 5.0 syslog priority critical msg "SIP status is not registered. Please check service."
action 6.0 end
03-02-2014 02:54 PM
Thanks Joseph,
I gave that one a try however it didn't trigger, is it becouse of the - in the output?
Thanks for your help.
03-02-2014 05:17 PM
No. It works for me in local testing. Are you sure you copied the regular expression correctly? What does "debug event manager action cli" report when the applet runs?
03-02-2014 09:08 PM
Thanks for the reply, see results from the debug.
ef-dc-vgw02-r2c6#
*Mar 3 15:57:21: %HA_EM-6-LOG: checksipregister : DEBUG(cli_lib) : : CTL : cli_open called.
*Mar 3 15:57:21: %HA_EM-6-LOG: checksipregister : DEBUG(cli_lib) : : OUT : ef-dc-vgw02-r2c6#
*Mar 3 15:57:21: %HA_EM-6-LOG: checksipregister : DEBUG(cli_lib) : : IN : ef-dc-vgw02-r2c6#enable
*Mar 3 15:57:21: %HA_EM-6-LOG: checksipregister : DEBUG(cli_lib) : : OUT : % Authorization failed.
*Mar 3 15:57:21: %HA_EM-6-LOG: checksipregister : DEBUG(cli_lib) : : OUT :
*Mar 3 15:57:21: %HA_EM-6-LOG: checksipregister : DEBUG(cli_lib) : : OUT : ef-dc-vgw02-r2c6#
*Mar 3 15:57:21: %HA_EM-6-LOG: checksipregister : DEBUG(cli_lib) : : IN : ef-dc-vgw02-r2c6#show sip-ua register status | include no
*Mar 3 15:57:22: %HA_EM-6-LOG: checksipregister : DEBUG(cli_lib) : : OUT : ef-dc-vgw02-r2c6#
*Mar 3 15:57:22: %HA_EM-6-LOG: checksipregister : DEBUG(cli_lib) : : CTL : cli_close called.
*Mar 3 15:57:22: tty is now going through its death sequence
Perfomed by me
ef-dc-vgw02-r2c6#show sip-ua register status | include no
99051000229971 -1 83 no
ef-dc-vgw02-r2c6#
03-03-2014 02:59 AM
You need to add:
event manager session cli username USER
Where USER is a user authorized to run all of the CLI commands in this applet.
03-03-2014 04:18 PM
Thanks heaps Joseph! All setup
09-05-2016 05:08 AM
and how change above script ,to send the router to wr and reload if 1 SIP account is missing in "sh sip-ua register status"
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