EXOS: UPM Script - port number in log message

  • 0
  • 1
  • Question
  • Updated 7 days ago
  • Answered
Today i play around with a UPM Script which refresh nodealias table after a port link down.
# Module upm configuration.
create upm profile clear-nodealias
create log message Starting_Script_clear-nodealias
clear nodealias port $EVENT.LOG_PARAM_0
create log message Finishing_Script_clear-nodealias

Here is the log output if the script runs successfully:
03/12/2018 18:35:43.95 <Info:System.userComment> Finishing_Script_clear-nodealias
03/12/2018 18:35:43.94 <Info:System.userComment> Starting_Script_clear-nodealias
03/12/2018 18:35:43.85 <Noti:UPM.Msg.upmMsgExshLaunch> Launched profile clear-nodealias for the event log-message
03/12/2018 18:35:43.85 <Info:vlan.msgs.portLinkStateDown> Port 19 link down
I want enhance the log message "Starting_Script_clear-nodealias" by the Port Number which part of nodealias table will be cleared.

So i try this:
create log message Starting_Script_clear-nodealias on port $EVENT.LOG_PARAM_0
But then UPM Scripts runs successful but this line was not written down to log file.

How can i achieve my goal ?
Photo of M.Nees

M.Nees, Embassador

  • 8,736 Points 5k badge 2x thumb

Posted 1 week ago

  • 0
  • 1
Photo of OscarK

OscarK, ESE

  • 7,482 Points 5k badge 2x thumb
The spaces in your log message makes the command wrong.
* Slot-1 SWTCORE1.2 # create log message test 123
%% Invalid input detected at '^' marker.
* Slot-1 SWTCORE1.3 # create log message "test 123"
* Slot-1 SWTCORE1.4 #

However, using a variable inside "" does not seem to work.

 Slot-1 SWTCORE1.5 # set var port "1:1"
* Slot-1 SWTCORE1.6 # show var port
* Slot-1 SWTCORE1.7 # create log message "test port $port"
* Slot-1 SWTCORE1.8 # sh log
03/13/2018 10:07:40.37 <Info:System.userComment> Slot-1: test port $port

Using _ instead of spaces and not use quotes makes it possible to use variables but is a bit ugly.
* Slot-1 SWTCORE1.14 # create log message test_port_$port
* Slot-1 SWTCORE1.15 # sh log
03/13/2018 10:10:35.50 <Info:System.userComment> Slot-1: test_port_1:1
Photo of M.Nees

M.Nees, Embassador

  • 8,736 Points 5k badge 2x thumb
Thanks for that advice - not nice but it works!

Photo of Grosjean, Stephane

Grosjean, Stephane, Employee

  • 11,998 Points 10k badge 2x thumb
you have to end your log message with a normal character to have it to work, for example:

EXOS-VM.6 # create log message "the port is $ports !"
EXOS-VM.7 # sh log
03/15/2018 15:16:34.18 <Info:System.userComment> the port is 1:1 !