[c-nsp] Cisco IOS XR event manager run

Mohammad Khalil eng_mssk at hotmail.com
Tue Apr 21 09:05:28 EDT 2015


I want to show something (for example show interface x | inc rate) and then append that to a file on TFTP server and I have a cron every 5 minutes

> Date: Tue, 7 Apr 2015 11:01:03 +0200
> From: thomas.braun at flashstudy.de
> To: eng_mssk at hotmail.com; peter at rathlev.dk
> CC: cisco-nsp at puck.nether.net
> Subject: Re: [c-nsp] Cisco IOS XR event manager run
> 
> Hi,
> 
> add following action:
> action 3.0 puts $_cli_result
> 
> 
> and you need to change your command to:
> event manager run TEST
> 
> 
> 
> Regards
> Thomas
> 
> 
> 
> Am 07.04.15 um 10:44 schrieb Mohammad Khalil:
> > The script ran without any errors but no output appeared
> > Even with Cisco IOS , am trying just to display certain output and run the script using the event manage run command
> > 
> > event manager applet TEST
> >  event none
> >  action 1.0 cli command "enable"
> >  action 1.2 cli command "show ip interface brief"
> > 
> > R1#event manager run MSSK
> > R1#
> > 
> > No output appears , what should I do in order for the output to be displayed on the screen?
> > 
> > Thanks
> > 
> > 
> >> Subject: Re: [c-nsp] Cisco IOS XR event manager run
> >> From: peter at rathlev.dk
> >> To: eng_mssk at hotmail.com
> >> CC: cisco-nsp at puck.nether.net
> >> Date: Tue, 7 Apr 2015 10:02:14 +0200
> >>
> >> On Tue, 2015-04-07 at 10:46 +0300, Mohammad Khalil wrote:
> >>> #Run cmds
> >>> foreach cmd $commands {
> >>>      action_syslog priority info msg "Executing: $cmd"
> >>>      set result [ cli_exec $cli(fd) $cmd ]
> >>>      action_syslog priority info msg $result }
> >>>
> >>> RP/0/0/CPU0:XR1#event manager run test.tcl
> >>> Tue Apr  7 13:43:44.488 EET
> >>> RP/0/0/CPU0:Apr  7 13:43:45.768 : tclsh[65816]: %HA-HA_EEM-6-ACTION_SYSLOG_LOG_INFO : test.tcl: test.tcl was triggered
> >>> RP/0/0/CPU0:Apr  7 13:43:45.768 : tclsh[65816]: %HA-HA_EEM-5-ACTION_SYSLOG_LOG_NOTICE : test.tcl: Opening CLI...
> >>> RP/0/0/CPU0:Apr  7 13:43:47.318 : tclsh[65816]: %HA-HA_EEM-6-ACTION_SYSLOG_LOG_INFO : test.tcl: OK
> >>> RP/0/0/CPU0:Apr  7 13:43:47.318 : tclsh[65816]: %HA-HA_EEM-6-ACTION_SYSLOG_LOG_INFO : test.tcl: Executing: sh bgp summary
> >>> RP/0/0/CPU0:Apr  7 13:43:48.048 : tclsh[65816]: %HA-HA_EEM-6-ACTION_SYSLOG_LOG_INFO : test.tcl: sh bgp summary
> >>>
> >>> No output appears
> >>
> >> Actually, some output appeared. It seems the first line of $result,
> >> which is the command itself, is echoed back to you. So it's probably
> >> because action_syslog doesn't handle multi-line messages.
> >>
> >> You could try splitting the result:
> >>
> >> foreach cmd $commands {
> >>   action_syslog priority info msg "Executing: $cmd"
> >>   set result_lines [ split [ cli_exec $cli(fd) $cmd ] "\n" ]
> >>   foreach line $result_lines {
> >>     action_syslog priority info msg $line
> >>   }
> >> }
> >>
> >> -- 
> >> Peter
> >>
> >>
> >>
> >  		 	   		  
> > _______________________________________________
> > cisco-nsp mailing list  cisco-nsp at puck.nether.net
> > https://puck.nether.net/mailman/listinfo/cisco-nsp
> > archive at http://puck.nether.net/pipermail/cisco-nsp/
> > 
> 
 		 	   		  


More information about the cisco-nsp mailing list