02-25-2020 03:10 AM - edited 02-25-2020 07:47 AM
Hello colleagues
Here is the part of the script, that i use:
event manager applet test777 authorization bypass
event cli pattern "testme" enter
action 1 info type routername
action 10 cli command "enable"
action 11 cli command "sh clock"
action 12 regexp "([0-9]+).([0-9]+).([0-9]+).*" "$_cli_result" match hour minute sec
action 13 set result "diag_$_info_routername-$hour:$minute:$sec"
action 14 set filename "$result.txt"
action 50 cli command "show interfaces po1 | append bootflash:$filename"
action 110 cli command "more bootflash:$filename | redirect tftp://xx.xx.xx.xx/$filename"
action 120 file delete bootflash:$filename
action 130 cli command "end"
The problem occurs in the step 110, comes an error:
022395: Feb 25 13:59:04: %HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: filename
022396: Feb 25 13:59:04: %HA_EM-3-FMPD_ERROR: Error executing applet test777 statement 110
Please advice, how i can transfer newly generated file to tftp by the script.
Solved! Go to Solution.
02-25-2020 07:49 AM
Problem solved with the help of patterns. For someone, who face the same problem - here is the solution:
action 80 cli command "delete bootflash:$filename" pattern "Delete.*"
action 80.1 cli command "bootflash:$filename" pattern "Delete.*"
action 80.2 cli command ""
02-25-2020 03:21 AM
action 14 set filename "$result.txt"
you need to use below format
action XX set filename "$_string_result.txt"
action XX puts "$filename"
02-25-2020 03:43 AM
Thank you
But how would that help with transfering file to tftp? The error is on the step 110.
02-25-2020 03:57 AM
ADDITION:
There was a problem in order, 110 executed before 12. Now the file transfers correctly, but there is error in deleting.
02-25-2020 07:49 AM
Problem solved with the help of patterns. For someone, who face the same problem - here is the solution:
action 80 cli command "delete bootflash:$filename" pattern "Delete.*"
action 80.1 cli command "bootflash:$filename" pattern "Delete.*"
action 80.2 cli command ""
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