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. How to call a script from "instance-name" ?

How to call a script from "instance-name" ?

Scheduled Pinned Locked Moved Support
5 Posts 3 Posters 32.7k 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.
  • L
    L
    Luis Montaño
    wrote on last edited by
    #1

    Hello everyone, do you know how can I call a script from a dci description?
    for example, this is the description of a dci: TrafficIN %{script:getIfNameByName({instance-name})}
    this is my script:
    scriptName:getIfNameByName
    sub getIfName(netString)
    {
        if (length(netString) > 0)
        array a;
        a [length(netString)];
        a = SplitString(netString, " ");
        return (a [
                          (a->size)-1
                      ]
                  );
    }
    return getIfName($1);
    how can I call that script and send "instance-name" as parameter?

    1 Reply Last reply
    0
    • T
      T
      Tursiops
      wrote on last edited by
      #2

      It looks to me as if what you are trying to do should probably be done in the instance discovery filter script, rather than via attempting to call a script within the DCI description?

      1 Reply Last reply
      0
      • L
        L
        Luis Montaño
        wrote on last edited by
        #3

        Yes your point is valid but I know that is possible, if I change the script and return any value, It appears on dci description.
        I would like to know how to do it.

        1 Reply Last reply
        0
        • T
          T
          Tursiops
          wrote on last edited by
          #4

          Sounds like {instance-name} is not being interpreted prior to calling the script.
          Maybe add some trace commands to your script, e.g. something like this:

          trace(0,"Instance Name: ".$1);
          

          Then check your server logs and see what is being returned: Nothing? Literally "{instance-name}"? Something else?

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

            Hi,

            {instance-name} is a placeholder which is replaced only during instance discovery. You can set it's value by returning third element from instance filter script, like this:

            return %(true, "this will became instance", "this will became instance name");

            Best regards,
            Victor

            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