cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1554
Views
0
Helpful
2
Replies

TCL script using EEM to append output to a file

Alex Zonnoorian
Level 1
Level 1

Hi,

 

I am trying to use a TCL script to append the output of some IPSLA statistics to a file on my server (my flash doesn't support the append function). The script is working on the first 1 or 2 executions, however after the second try the scripts keeps failing/aborting. wondering if anyone can help identify what the issue could be?

below is my script and error messages im seeing in the logs.

 

::cisco::eem::event_register_timer watchdog time 120

 

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) "terminal exec prompt timestamp"} _cli_result] {

    error $_cli_result $errorInfo

}

 

if [catch {cli_exec $cli1(fd) "sho ip sla statistics 110211345"} _cli_result] {

 

    error $_cli_result $errorInfo

 

}

 

set fd [open "ftp://xxxx:xxxxx@1.1.1.1/iplsa1.txt" "r"]

 

set contents [read $fd]

 

close $fd

 

append contents "\n$_cli_result"

 

set fd [open "ftp://xxxx:xxxxx@1.1.1.1/iplsa1.txt" "w"]

         

puts $fd $contents

 

close $fd

 

 

Apr 18 00:29:17.912 UTC: %HA_EM-6-LOG: tcl_iplsa1: Process Forced Exit- MAXRUN timer expired.
Apr 18 00:29:17.912 UTC: %HA_EM-6-LOG: tcl_iplsa1.tcl:     while executing
Apr 18 00:29:17.912 UTC: %HA_EM-6-LOG: tcl_iplsa1.tcl: "append contents "\n$_cli_result""
Apr 18 00:29:17.912 UTC: %HA_EM-6-LOG: tcl_iplsa1.tcl:     invoked from within
Apr 18 00:29:17.912 UTC: %HA_EM-6-LOG: tcl_iplsa1.tcl: "$slave eval $Contents"
Apr 18 00:29:17.912 UTC: %HA_EM-6-LOG: tcl_iplsa1.tcl:     (procedure "eval_script" line 7)
Apr 18 00:29:17.912 UTC: %HA_EM-6-LOG: tcl_iplsa1.tcl:     invoked from within
Apr 18 00:29:17.912 UTC: %HA_EM-6-LOG: tcl_iplsa1.tcl: "eval_script slave $scriptname"
Apr 18 00:29:17.912 UTC: %HA_EM-6-LOG: tcl_iplsa1.tcl:     invoked from within
Apr 18 00:29:17.912 UTC: %HA_EM-6-LOG: tcl_iplsa1.tcl: "if {$security_level == 1} {       #untrusted script
Apr 18 00:29:17.912 UTC: %HA_EM-6-LOG: tcl_iplsa1.tcl:      interp create -safe slave
Apr 18 00:29:17.912 UTC: %HA_EM-6-LOG: tcl_iplsa1.tcl:      interp share {} stdin slave
Apr 18 00:29:17.912 UTC: %HA_EM-6-LOG: tcl_iplsa1.tcl:      interp share {} stdout slave
Apr 18 00:29:17.912 UTC: %HA_EM-6-LOG: tcl_iplsa1.tcl: ..."
Apr 18 00:29:17.912 UTC: %HA_EM-6-LOG: tcl_iplsa1.tcl:     (file "tmpsys:/lib/tcl/base.tcl" line 50)
Apr 18 00:29:17.912 UTC: %HA_EM-6-LOG: v.tcl: Tcl policy execute failed: 
Apr 18 00:29:17.912 UTC: %HA_EM-6-LOG: tcl_iplsa1.tcl: Process Forced Exit- MAXRUN timer expired.

2 Replies 2

Alex Zonnoorian
Level 1
Level 1

Im assuming that the maxrun timer is timing out when the script is opening and writing to the file.

How can I increase the MAXRUN timer?

 

 

figured it out.

 

added: ::cisco::eem::event_register_timer watchdog time 120 maxrun 500