cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1393
Views
0
Helpful
7
Replies

EEM to monitor the status of a http get

kevinhobson2000
Level 1
Level 1

Hi,

I am investigating whether it is possible to get EEM to monitor a ip sla for the http status code in a http get.  See blow:

GM12060#sh ip sla monitor operational-state 5
Entry number: 5
Modification time: *13:40:50.532 UTC Mon Mar 22 2010
Number of Octets Used by this Entry: 2656
Number of operations attempted: 1
Number of operations skipped: 0
Current seconds left in Life: Forever
Operational state of entry: Active
Last time this entry was reset: Never
Connection loss occurred: FALSE
Timeout occurred: FALSE
Over thresholds occurred: FALSE
Latest RTT (milliseconds): 76
Latest operation start time: *13:40:50.536 UTC Mon Mar 22 2010
Latest operation return code: OK
Latest DNS RTT: 35
Latest TCP Connection RTT: 17
Latest HTTP time to first byte: 41
Latest HTTP Transaction RTT: 24
Latest HTTP Status: 302
Latest HTTP Message Size: 807
Latest HTTP Entity-Body size: 218

What i would like to do is get EEM to stop the SLA when the HTTP status changes to 404.

I have looked at the ip sla EEM command and it doesnt allow you to monitor this attribute.


Is this even possible?

Thanks


Kev

1 Accepted Solution

Accepted Solutions

You could use a simple timer applet to parse the output of "show ip sla stat 5 details" and look for the result code:

event manager applet check-ipsla

event timer watchdog time 60

action 001 cli command "enable"

action 002 cli command "show ip sla stat 5 details"

action 003 regexp "Latest HTTP Status: 404" $_cli_result

action 004 if $_regexp_result eq 1

action 005 cli command "config t"

action 006 cli command  "no ip sla schedule 5"

action 007 cli command "end"

action 008 syslog msg "Stopping IP SLA collector 5 as latest HTTP response code was 404"

action 009 end

View solution in original post

7 Replies 7

yjdabear
VIP Alumni
VIP Alumni

Since it appears EEM applets cannot parse CLI output ("event cli pattern" only handles CLI input), an EEM script sees necessary if the approach is to react to any potential "404" pattern appearing in the "sh ip sla monitor operational-state 5" output.

Joe Clarke
Cisco Employee
Cisco Employee

It is possible, but given that you need to execute "show ip sla monitor" you definitely do not have EEM 3.0 yet.  Therefore, you will need to do this in an EEM Tcl policy.  I can provide an example if you want.

Hi Joe,

Yes i have looked it up in the feature navigator and it didnt come in untill 12.4(22).


Would this do it?

Also if you could provide me with a example script that would help thanks as i am a mere novice when it comes to tcl scripting.

Thanks

Kev

Yes, 12.4(22)T.  That includes EEM 3.0, and would open the door for a programmatic applet (i.e. without Tcl).  You could still accomplish what you want now, but it would require Tcl.  Would you like a Tcl example, or are you considering an upgrade?

Hi Joe,

I have 12.4(24T) on a test router but i couldnt see anything under the event ipsla command that did what i require.

Im thinking it will have to use an if statement.

Would this be along the right lines?

Thanks

Kev

You could use a simple timer applet to parse the output of "show ip sla stat 5 details" and look for the result code:

event manager applet check-ipsla

event timer watchdog time 60

action 001 cli command "enable"

action 002 cli command "show ip sla stat 5 details"

action 003 regexp "Latest HTTP Status: 404" $_cli_result

action 004 if $_regexp_result eq 1

action 005 cli command "config t"

action 006 cli command  "no ip sla schedule 5"

action 007 cli command "end"

action 008 syslog msg "Stopping IP SLA collector 5 as latest HTTP response code was 404"

action 009 end

Joe,

Thanks for your help with this.

Cheers


Kev

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: