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

How to write an EEM (or Python) CLI Catchall? - Nexus 9000 - NXOS 10.2

David Albrecht
Level 1
Level 1

Hello,

As the title suggests, I am trying to write a simple EEM script to send all entered CLI commands to our syslog server. It appears that the variable you'd use in Catalyst (`$_cli_msg`) isn't supported in Nexus.

Here is what I have:

 

 

(config)# event manager applet logCLI
(config-applet)# description "Collect commands entered on CLI"
(config-applet)# event cli match "*"
(config-applet)# action 1.0 event-default
(config-applet)# action 1.1 syslog priority notifications msg "$_cli_msg"
                                                                     ^
% Invalid command at '^' marker.

 

 

I searched all over the web for the list of built-in variables available to the embedded event manager, and I've not been able to find anything conclusive.

I did find one suggestion in the forums to run the `show event manager event-types` command, which supposedly shows the names of the variables available to each event type. For the `cli` entry I see the following:

 

 

Name : cli
Description : EEM CLI command filter
Event Parameters : _syslog_msg
Publisher : CLI events publisher
Default Action : 

Name : cli
Description : EEM CLI command filter
Event Parameters : command
Publisher : CLI events publisher
Default Action : 

 

 

 

 

I've tried to use both `$_syslog_msg` and `$command` as the string to log, but the CLI doesn't take it.

I am also experienced in Python but I'm not familiar with the Cisco Python library. I was hoping to find some good quality API reference material for this library, but I didn't find that, either.

0 Replies 0