Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. Server Command Object Tool %OBJECT_IP_ADDR%

Server Command Object Tool %OBJECT_IP_ADDR%

Scheduled Pinned Locked Moved Support
5 Posts 3 Posters 18.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    M
    mcc
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • Dani@M3TU
      Dani@M3TU
      Dani@M3T
      wrote on last edited by
      #2

      I also get "OBJECT_NAME" in a server script using %OBJECT_NAME% in the Object Tools.

      Update:
      I saw this in admin guide:

      Action, file download, local command, and URL tool types allows macro substitution.

      1 Reply Last reply
      0
      • V
        V
        Victor Kirhenshtein
        wrote on last edited by
        #3

        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).

        1 Reply Last reply
        0
        • Dani@M3TU
          Dani@M3TU
          Dani@M3T
          wrote on last edited by
          #4

          I can confirm that. When I use "%n" in server command it's expanded to nodes name. Thank's

          1 Reply Last reply
          0
          • M
            M
            mcc
            wrote on last edited by
            #5

            That fixed it for me. Thanks much.

            1 Reply Last reply
            0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            Powered by NodeBB Contributors
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups