09-17-2021 05:23 AM
Hi Community,
I am trying to get an eem applet running that calls a python script in guestshell. So far so good.
But the python script expect two arguements and these arguments should be variables which are generate by the eem applet:
event manager applet SEND-TO-CMDB event none action 1.00 cli command "enable" action 1.01 cli command "show platform | i ^Chassis type:" action 2.00 regexp "^Chassis type\s*:\s*(.*)" $_cli_result match pid action 4.00 cli command "show ver | i ^Processor board ID" action 5.00 regexp "^Processor board ID\s*\s*(.*)" $_cli_result match serial_num action 6.00 cli command "guestshell run python3 /flash/guest-share/cmdb_request.py $serial_num $pid"
Every single part is working well. The applet gets PID and serialnumber. I can call the python script via cli command.
But the python script in combination with the eem variables ($serial_num $pid) isn't working.
It seems that the values in the varibles weren't passed to the python script.
What is my fault. I would be verry thankful for a hint.
Greets
Sebastian
09-17-2021 05:48 AM
One comment which could be helpful...
When I print out action 6.00 and execute the guestshell command manually it works.
Only in combination with guestshell cli command my applet doesn't work.
Thanks Sebastian
09-17-2021 06:20 AM
Not that is parsed the variable i guess :
look at some example :
09-19-2021 09:53 PM
Thank you for your reply @balaji.bandi .
I looked ath the examples and found this one: "Adding a Python Script in an EEM Applet". This exapmle also uses a parsed argument like mine in the same way. But unfortunately mine doesn't work.
I tihin you are right and the varibale isn't parsed, but I have no idea why.
I am very thankful for any further hint.
Sebastian
09-19-2021 11:20 PM
Hello,
is this the full EEM config ? At first glance, it looks like you might have to declare the environment variables below. I will do some testing...
event manager environment pid
event manager environment serial_num
09-20-2021 12:14 AM
Hi George,
thank you for the hint.
Yes, this is the full EEM config. I added the environment variables to the config. Unfortunately without success.
I read a lot of documents about EEM but I couldn't find any details about how to parse variblaes to a python script called vi EEM.
In BBs link (see some Post further up) there is an example "Adding a Python Script in an EEM Applet" that also doesn't work on my ISR.
I am testing on an ISR4331/K9 running IOS XE 17.3.3.
In the meantime it feels like I found a bug.
Maybe there some more further hints from the community.
Thanks
Sebastian
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide