03-22-2010 06:46 AM
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
Solved! Go to Solution.
03-23-2010 02:24 PM
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
03-22-2010 09:07 AM
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.
03-22-2010 09:21 AM
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.
03-23-2010 01:06 AM
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
03-23-2010 08:58 AM
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?
03-23-2010 11:41 AM
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
03-23-2010 02:24 PM
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
03-31-2010 05:24 AM
Joe,
Thanks for your help with this.
Cheers
Kev
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