Basic traceroute EEM script (for hop-by-hop network analysis)

I'd like to do a hop-by-hop analysis by running a traceroute script that runs on an interval (say every 5-15 minutes) and puts output to a file.
The goal is to let the script run for a day, and see what kind of hop changes might occur over time, and also monitor for any latency increase or packetloss at certain times of day (peak hours).
If I used an EEM script to do a basic traceroute from one endpoint of the network to a server in the core (for instance), this could show how a client's path may be impacted during peak hours.
I'd want the output stored in a file on the router's flash disk, and then I'd have to find some way to parse and analyze the output later (not sure how I'd do that, perhaps with excel or another diff-like program).

Something like this should work for you.  In config mode, specify three EEM environment variables:
event manager environment traceroute_timer 600
event manager environment traceroute_target 10.1.1.1
event manager environment traceroute_file flash:/traceroute.txt
Then register this EEM Tcl policy:
::cisco::eem::event_register_timer watchdog time $traceroute_timer
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*
array set arr_einfo [event_reqinfo]
if [catch {cli_open} result] {
    error $result $errorInfo
} else {
    array set cli1 $result
if [catch {cli_exec $cli1(fd) "enable"} _cli_result] {
    error $_cli_result $errorInfo
if [catch {cli_exec $cli1(fd) "traceroute $traceroute_target"} _cli_result] {
    error $_cli_result $errorInfo
set fd [open $traceroute_file a]
puts $fd [clock format [clock seconds]]
puts $fd $_cli_result
close $fd
# Close open cli before exit.
catch {cli_close $cli1(fd) $cli1(tty_id)} result

Similar Messages

  • Basic SQL query scripts for SAP B1

    hi guys,
    do you have any documents, guides or reference links regarding basic SQL query scripts for SAP B1?
    thanks and have a nice day!
    blake p.

    Hi
    You can also check SBONotes.com.
    For sql understanding , you can search in websearch - tsql and it will pop up with informations you need.
    You can also refer to forum once you understand the basic techniques
    Hope this helps
    Bishal

  • Auto Email on event - EEM script for NxOS

    I generated EEM script for Duplicate IP address detection, but i do not know how to trigger email in NxOS.
    event manager environment emailto "[email protected]"
    event manager applet Duplicate_IP
      description "Detect Duplicate IP and Send Trap"
      event syslog pattern "%ARP-2-DUP_SRC_IP"
      action 1.0 snmp-trap strdata "Duplicate IP Detected on Host $hostname"
      action 2.0 cli sh logg last 100
      action 3.0 event-default
    Somebody know how to trigger email. There is no good document on EEM email triggering mechanism.

    Not sure if this would work in NxOS but I think it would go something like this;
    Specify the action of sending a short e-mail when the EEM applet is triggered via the event syslog pattern you already have defined:
         Router(config-applet)#  action label mail server server-address to to-address from from-address subject subject body body-text
    Remember to define the EEM environment variables first when setting up the applet as follows:
       event manager environment  _email_server
       event manager environment  _email_to
       event manager environment  _email_from

  • NX-OS EEM script for SVI

    Hello, 
    I'm looking for a simple eem script for enabling an SVI if its goes down. we have some issue is NX-OS running 6.0.2.(1) where we occure a SVI down for itself.
    Regard
    Adil

    Unfortunately, this is not possible on NX-OS.  EEM on NX-OS is EEM by name only.  The feature is very different than it is on IOS.  What you could do is use an IOS box as a proxy.  That is, send a trap using EEM from your NX-OS box, then have IOS do the telnet to the other NX-OS box to perform the necessary commands.

  • Need EEM script for write mem config details.

    Looking for an EEM script that will send an email of config details when a write mem is performed.  
    Any help would be appreciated as i'm new to EEM.

    Something like this could work:
    event manager applet email-write-mem
    event cli pattern "^(write memory|write|copy running-config startup-config)*$" sync no skip no
    action 0.5 info type routername
    action 1.0 mail from [email protected] to [email protected] server 10.1.1.1 subject "Write mem on $_info_routername" body "A write mem was done on $_info_routername"

  • How to shut no shut interface of switch using(EEM) Script for 3560 switch

    Dear community experts,
    I'm new for creating scripting for EEM and below is my situation, need your support.
    Present I'm using 3560 switch, one of  the switch port(FA0/1) has added  Cisco Access point(PoE), actually what happening daily this Access point getting struct when I'M doing the switch port (FA0/1) shut  then no shut it is working fine .
    So my question is i need script, that should continuously ping the IP off the Access point if the IP will drop 4 packets the switch do shut  and then no shut for that I need the script, Please help me.
    if it is not possible please provide the batch file, which will ping the particular IP if 4 packet drops it will telnet the switch and go to the interface do shut no shut 
    Note: 
    instead of mentioned 3560, I mentioned 2960 now corrected it  please provide the script.

    This should work:
    ip sla 1
     icmp-echo 10.10.10.1
     frequency 15
    ip sla schedule 1 life forever start now
    ip sla enable reaction-alerts
    ip sla reaction-configuration 1 react timeout action-type trapOnly threshold-type consecutive 4
    event manager applet reset-ap
     event ipsla operation-id 1 reaction-type timeout
     action 1.0 cli command "enable"
     action 2.0 cli command "config t"
     action 3.0 cli command "int fa0/1"
     action 4.0 cli command "shut"
     action 5.0 cli command "no shut"
     action 6.0 cli command "end"

  • EEM Scripting for error and drop counters

    Hi,
    We want to check the following counters for drops every 5 minutes and generate an alarm if a certain threshold of errors (example: increment of 100 in the error/drop counters in the last 5 minutes) is overcome:
    My sample script is inline, i'm missing how to parse and generate the alarm if the threshold is surpassed:
    Example command:
    SPLAB_7600_3#remote command module 4 show platform hardware drops | include Selene|drp                
    ------ Selene 0 Channel 0 ------
    Selene Ingress Drop Counters Ch[0]
    Selene Egress Drop Counters Ch[0]
        egr_tot_fifo_drp_ctr                          25
    Selene Drop Counters
    ------ Selene 1 Channel 0 ------
    Selene Ingress Drop Counters Ch[0]
    Selene Egress Drop Counters Ch[0]
    Selene Drop Counters
    Best Regards,
    Afonso
    ::cisco::eem::event_register_timer watchdog time $check_interval nice 1
    # EEM policy to monitor a internal counters
    # August 2012, Cisco Systems
    # Copyright (c) 2012 by cisco Systems, Inc.
    # All rights reserved.
    namespace import ::cisco::eem::*
    namespace import ::cisco::lib::*
    # 2. Execute the counter show commands
    if [catch {cli_open} result] {
        error $result $errorInfo
    } else {
        array set cli1 $result
    if [catch {cli_exec $cli1(fd) "enable"} result] {
        error $result $errorInfo
    if [catch {cli_exec $cli1(fd) "cisco"} result] {
        error $result $errorInfo
    # - - - - - -  Interface error counters
    if [catch {cli_exec $cli1(fd) "remote command module x show platform hardware selene np-idx 0 counters | include drop"} result] {
            error $result $errorInfo
    set egr_drp_ctr $result
    #- Parsing and conditional programming for the generation of traps based on the drop value extracted from the show command
    action_syslog priority info msg "Counter Alarm"
    #Exit
    if [catch {cli_exec $cli1(fd) "end"} result] {
        error $result $errorInfo

    I believe this is what you are looking for:
    set egr_drp_ctr $result
    expr {$egr_drp_ctr + 100} sumof
    if {$egr_drp_ctr >= $sumof}
        puts "Alarm"
    It may need correction on the syntax , but thats the logic.

  • EEM script for SUP failover notification

    Hello All- From this thread: https://supportforums.cisco.com/thread/2059622?tstart=0, I have a need for a script which parses the output of show redundancy state, and preferably emails me the result. We are using both 6500s with SUP720/MSFC3, and 4500s with SUP II+ & SUP V.
    Many thanx in advance
    -michael

    Exactly what do you want parsed out of this output?  That is, what do you want emailed to you?

  • Need Help with EEM script for monitoring Rx and Tx load on Link

    Hello,
    I'm trying to implement a script, which monitors the Tx and Rx Load on the Link and sends a syslog in case the load is exceeded 200 mark (i.e If Rx or Tx load > 200)
    I have implemented the following script. But it is not giving the required results.
    event manager applet test
    event interface name Tunnel111 parameter rxload entry-val 200 entry-op gt entry-val-is-increment true poll-interval 5000
    action 1.0 syslog msg "Increase Load On the Link"
    I'm trying to monitor the load on Tunnel 111 which is mapped to WAN interface.
    Router (Cisco 2821) has following IOS
    c2800nm-advipservicesk9-mz.124-25g.bin

    Hello Joseph,
    As per your suggestion, we made some changes in our script and the following script is working fine. Its giving the required syslogs when the load is exceeded.
    event manager applet test
    event interface name Tunnel111 parameter txload entry-val 200 entry-op gt entry-val-is-increment false poll-interval 5
    action 1.0 syslog msg "Increased Load On the Link"
    Your prompt assistance is really appriciated.

  • Eem scripting for IP SLA

    I am trying to extract the numerical value from the followng using Embedded event manager(TCL Scripting)
    i also have SLA probes running between 2 connected routers
    sho ip sla statistics | sec SD Jitter
    So i write the the following
    conf ter
    event manager applet STAT
    event none  sync yes
    action 1 cli command "enable"
    action 2  cli command "sho ip sla stat | sec SD Jitter"
    action 3 regexp  " [0-9]+ " $_cli_result result
    action 4 puts "$result"
    However it produces result
    *Mar 27 16:42:08.806: %HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: result
    *Mar 27 16:42:08.806: %HA_EM-3-FMPD_ERROR: Error executing applet STAT statement 4
    pls clarify

    Does the "show ip sla stat | sec SD Jitter" show any output with numbers?   If not, then the result variable will not be populated.   Try adding line 2 below into your applet so if there is not a match it will not produce an error.
    event manager applet STAT
    event none  sync yes
    action 1 cli command "enable"
    action 2 set result "No match"
    action 3  cli command "sho ip sla stat | sec SD Jitter"
    action 4 regexp  " [0-9]+ " $_cli_result result
    action 5 puts "$result"

  • I need to have furhter options on my VI(for HP 8712B RF Network Analyser)

    Hi,
    I've downloaded the HP 871Xb driver for Labview 6.0 from the NI website that also had a getting started vi which has the basic data acquisition features. I also had a look at the other vi's provided but those too didn't have the features I'm looking for.
    I want my vi to have options like Amplifier->(Transmission / Reflection / Power) menu. Also an Averaging menu with Average On/Off and Average Factor options. Also a source menu where I can choose the Number of Points. Also it should have Log mag/Lin mag/SWR/phase/real/imaginary/impedence magnitude options.
    None of the VI's provided by the driver had these options.
    Is there anyway I could program a VI with these options. Or better
    yet, is there any place I could download a VI with these options already available.
    Thanks,
    Kunal.

    Hi Kunal,
    The fastest way to get a solution for your problem is to write those features by yourself. You can look into the manual for that instrument and contact the instrument manufacturer for some help.
    You can submit a request to add all the features that you want in that driver on our website as well. If you want to do so then go to:
    http://www.ni.com/devzone/idnet/other.htm
    There are some other websites listed on this page where you can look for a driver of your interest.

  • Help with EEM TCL / CLI scripting for re-direction/wccp counters

    Being new with EEM scripting I wanted to see if I was on the right track and get some help to finish my idea.
    Our problem I am trying to fix is our remote sites utilize pairs of Cat3650's for some routing and WCCP redirection.  We are encountering ACL denial issues causing slow down and access issues.  The fix for the issue we remove the WCCP service groups to break peering with our wan optimizers and re-insert the configuration thus re-establishing peering and restoring service.
    My idea is to use a TCL scipt on a watchdog timer to parse the "sh ip wccp | inc denied (or unassign)" output for denial and unassignable error counters.  If a counter is found I wanted to create a syslog message that would then kick off a simple EEM CLI script to remove the service groups, wait 10 seconds, then re-add the service groups.  Please point me in the right direction if I am off track as I am not sure if I can use the EEM CLI for all this or since I want to retreive specific info from the sh ip wccp output if I do need to utilize TCL.  I am also unsure if the "total denied" ascii string pulled via the "sh ip wccp | inc denied" will cause issues when attempting to just pull the counter information.
    sh ip wccp | inc Denied Red
            Total Packets Denied Redirect:       0
            Total Packets Denied Redirect:       0
    Script thus far :
    TCL
    if [catch {context_retrieve "EEM_WCCP_ERROR_COUNTER" "count"} result] {
    set wccpcounter 0
    } else {
    set wccpcounter $result
    } if [catch {cli_open} result] {
    error $result
    } else {
    array set cli $result
    } if [catch {cli_exec $cli(fd) "show ip wccp | incl Denied"} result] {
    error $result
    } else {
    set cmd_output $result
    set count ""
    catch [regexp {receive ([0-9]+),} $cmd_output} ignore count]
    set count
    set diff [expr $count - $wccpcounter]
    if {$diff != 0} {
    action_syslog priority emergencies msg "WCCP counters showing incremental Denied packet counts"
    if [catch {cli_close $cli(fd) $cli(tty_id)} result] {
    error $result
    context_save EEM_WCCP_ERROR_COUNTER count
    CLI
    event manager applet WCCP_COUNTER_WATCH
    event syslog priority emergencies pattern "WCCP counters showing incremental Denied packet counts"
    action 001 cli command "enable"
    action 002 cli command "config t"
    action 003 cli command "no ip wccp 61"
    action 004 cli command "no ip wccp 62"
    action 005 wait 10
    action 006 cli command "ip wccp 61"
    action 007 cli command "ip wccp 62"
    action 008 wait 15
    action 009 cli command "clear ip wccp"
    action 010 cli command "end"
    Thanks for all the help

    This won't work as EEM cannot intercept its own syslog messages.  However, I'm not sure why you need this form of IPC anyway.  Why not just make the Tcl script perform the needed CLI commands?
    And, yes, you could use all applets here.  But since you've written the hard stuff in Tcl already, it might be best just to add the missing calls to reconfigure WCCP to that script.

  • I lock my phone on the imminent Mwinyi Is it possible to Open to be held on all the networks in return for material I hope to respond Thanks

    I lock my phone on the imminent Mwinyi Is it possible to Open to be held on all the networks in return for material I hope to respond Thanks

    Your English in unintelligible.
    Can you post in your native language?

  • Most Basic EEM Script to Send E-mails

    I have read through various blogs and Cisco posts and still cannot seem to get this to work.  I am simply trying to get the router to send the "show ip int br" info via e-mail from a G-Mail account to a G-Mail account.  I am wondering if this is unsupported because G-mail uses TLS/SSL and different ports and I can't seem to defined this anywhere.  Can anyone confirm?
    I manually run the EEM script via "event manager run IPAddressNotify".  I have made sure that the router can ping "smtp.gmail.com" (IE IP reachability and name-lookups are successful). 
    event manager environment _email_to [email protected]
    event manager environment _email_server gmailusername:[email protected]
    event manager environment _email_from [email protected]
    event manager applet IPAddressNotify
    event none
    action 1.0 info type routername
    action 1.5 cli command "enable"
    action 2.0 cli command "show ip int br"
    action 8.0 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Router reload - IP Address info for $_info_routername" body "$_cli_result"
    action 9.0 syslog msg "E-mail was sent"

    Joseph,
    Thanks for the info!  This is perfect.  Can you verify that my logic is clear, just so I know I am interpreting this correctly.
    Right now, my IOS version does NOT support the "secure" and "port" parameters for EEM.  Since G-Mail does NOT support unencrypted SMTP (verified), there is no way that I can use EEM or TCL to e-mail myself messages.  Correct?
    When you state that my username cannot have an '@' in it, is this referring to the 'from' field which would be "[email protected]"? Or, is this referring to the 'server' field which would be "gmailusername:[email protected]".  Luckily, Google lets me authenticate by specifying 'gmailusername', rather than '[email protected]'.  This should work then correct?

  • Dynamic Scripting for Call Center Surveys

    Hi All,
    I need to create dynamic scripting for Call Centres. Any idea how dynamic scripting can be done.
    Thanks a lot.
    Amiga

    Hi Raja,
    Basically, there should be a provision to create/modify a transaction and questions based on the response provided. So if a question is asked in a survey and the response is "Yes", the next question should be different to the one for a "No" answer. Similarly there should be a provision to create actions based on responses.
    Hope this makes it a bit clearer.
    Thanks
    Amiga

Maybe you are looking for

  • Please help: PPC Tiger 10.4.11, dock crashes after security update 2008-008

    I had no problems so far, everything worked great on my iBook G3 PPC 700Mhz 10.4.11 till I installed the latest Apple Security Update 2008-008 through Software Update in System Preferences. After restarting my system is gone crazy. The dock crashes l

  • Submitted PDF file renamed on submission.

    Hi all, I've created a form through designer which is used with our Companys IT Helpdesk system. In the form I have used a regular button with a click event to submit the form through either Adobe Reader or Pro. The filename is Company New Starter Ap

  • Firefox won't open in Windows 8.1 after latest update failed to install

    Latest update for firefox failed to install. Now, when I try to open firefox, I get the hourglass circle and then....Nothing. Check the processes and it is showing as a background process, but not doing anything. No error message, no crash alert. So,

  • Multiple source file for applet??

    When I first started writing my applet I only had one scourecode file so I wouldn't get any file finding problems... but now my file is gething to lagre ~1700 lines so I now I wanto stripe it down to sevral file and so I did... I have the files in a

  • Error in Query Activation from Business Content

    Hi Gurus, I'm having problems when I'm activating Query 0FIGL_VC1_Q0001 (Financial Statement and P&L: Actual/Actual Comparison) under Virtual Cube (0FIGL_VC1). Everytime I activate it, it displays these errors 1. Error when activating element 2GXNYXW