Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
New Member

EEM help - cli_result

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.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Cisco Employee

EEM help - cli_result

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

Cisco Employee

EEM help - cli_result

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.

7 REPLIES
Cisco Employee

EEM help - cli_result

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

New Member

EEM help - cli_result

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.

Cisco Employee

EEM help - cli_result

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?

New Member

EEM help - cli_result

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#

Cisco Employee

EEM help - cli_result

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.

New Member

EEM help - cli_result

Thanks heaps Joseph! All setup

New Member

and how change above script

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"

636
Views
0
Helpful
7
Replies
CreatePlease to create content