Hi,
I've created a Server Command under Object Tools that calls a bash script stored locally on the NetXMS server and passes the the %OBJECT_IP_ADDR% variable to the script. The script is very basic and looks something like this:
#!/bin/bash --
/usr/bin/do_something $1
echo `date +"%Y-%m-%d %T : "` Something done on device $1 >> script.log
I can run this script manually and the expected output is in the log file and the expected action is completed.
If I run this script using the created Server Command Object Tool, the script is executed but what I see in the log is:
date_and_time: Something done on device BJECT_IP_ADDR
Is there a way to pass the %OBJECT_IP_ADDR% variable to a Server Command Object Tool?
I also get "OBJECT_NAME" in a server script using %OBJECT_NAME% in the Object Tools.
Update:
I saw this in admin guide:
QuoteAction, file download, local command, and URL tool types allows macro substitution.
Actually it's an error in documentation. For server commands macros are expanded on server side, and you should use event processing macros (https://www.netxms.org/documentation/adminguide/event-processing.html#macros-for-event-processing (https://www.netxms.org/documentation/adminguide/event-processing.html#macros-for-event-processing)).
I can confirm that. When I use "%n" in server command it's expanded to nodes name. Thank's
That fixed it for me. Thanks much.