[c-nsp] Cisco IOS XR event manager run

Mohammad Khalil eng_mssk at hotmail.com
Tue Apr 7 03:46:24 EDT 2015


Hi

I have did the below

username EEMUSER
 group root-system
 group cisco-support
 secret cisco

aaa authorization eventmanager default local

event manager directory user policy disk0:/usr/
event manager policy test.tcl username EEMUSER persist-time infinite

I tried to write a script that will only display the show bgp summary when I run it , but it seems not working

::cisco::eem::event_register_none

namespace import ::cisco::eem::*
namespace import ::cisco::lib::*

set commands [ list \
  "sh bgp summary"\
  ]

action_syslog priority info msg "test.tcl was triggered"

action_syslog priority notice msg "Opening CLI..."
if [catch {cli_open} result] {
     action_syslog priority info msg "Error: $result : $errorInfo"
     error $result $errorInfo
} else {
     action_syslog priority info msg "OK"
     array set cli $result
}

#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

Thanks in advance

BR,
Mohammad

> 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 08:23:47 +0200
> 
> On Mon, 2015-04-06 at 15:17 +0300, Mohammad Khalil wrote:
> > The user is created with the correct privileges and the policy is
> > registered
> > 
> > RP/0/RSP0/CPU0:ASR9K#event manager run backup.tcl
> > Mon Apr  6 15:15:47.956 EET
> > Could not run backup.tcl: policy is not registered
> 
> Don't know about XR but in plain IOS a policy can only be registered for
> one trigger type, and running manually is a trigger type. So you need
> the policy to contain:
> 
>   ::cisco::eem::event_register_none tag "Run manually"
> 
> in the top if it's to be run manually.
> 
> When debugging I use the above line and then change only that line (and
> re-register the policy) to put it in production.
> 
> -- 
> Peter
> 
> 
 		 	   		  


More information about the cisco-nsp mailing list