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. Auto bind and auto apply script

Auto bind and auto apply script

Scheduled Pinned Locked Moved Support
6 Posts 3 Posters 16.2k 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.
  • T
    T
    testos
    wrote on last edited by
    #1

    Hello again.

    I am trying to prove automatic template application and automatic node binding to containers based on filters (node name begins with "FG100A") and do not work none of these filters:
     

    sub main()
    {
    return left($1,6) = "FG100A" ? 1 : 0;
    }

    sub main()
    {
    return left($node,6) = "FG100A" ? 1 : 0;
    }

    sub main()
    {
    return left($node,6) = "FG100A" ? $node : 0;
    }

    What is wrong?
    Thanks in advanced

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

      Hello!

      You should use == for compare operation. = is an assignment operation.

      For example:

      a = 1
      

      means "assign value 1 to variable a"

      and

      a == 1
      

      means "test if variable's value is 1".

      Second error is that $node variable is an object, and you need to compare it's name attribute. To access it, use

      $node->name
      

      And compare always returns 1 or 0, so you can omit ? 1 : 0 part and simply use

      left($node->name,6) == "FG100A"
      

      So, correct script will looks like

      sub main()
      {
         return left($node->name, 6) == "FG100A";
      }
      

      Best regards,
      Victor

      1 Reply Last reply
      0
      • T
        T
        testos
        wrote on last edited by
        #3

        Ok. Thanks for the explanation.  😉
        Now it complete auto bind/apply. But it takes a few minutes. Is there any parameter in server configuration that I can setting to make it faster?

        ...$node variable is an object, and you need to compare it's name attribute.

        What other attributes for $node object? Some other usefull objects->attributes for auto bind/apply operations?

        Best regards.

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

          Hi!

          Auto bind/apply occurs during configuration polls. You can force configuration poll for specific node from console (via Poll -> Configuration menu), or decrease interval between configuration polls by changing server's parameter ConfigurationPollingInterval.

          Attributes of node object:

          name Node name
          id Object identifier
          status Node status (0 = Normal, 1 = Warning, 2 = Minor, 3 = Major, 4 = Critical, 5 = Unknown, 6 = Unmanaged)
          ipAddr Node primary IP address (as text string, like 10.2.1.4)
          isAgent Agent presense flag: 1 if NetXMS agent present on node, 0 if not
          isSNMP SNMP support flag: 1 if SNMP is supported by node, 0 if not
          isBridge Bridge flag: 1 if node is bridge or switch, 0 if not
          isRouter IP router flag: 1 if node is Ip router (can forward IP packets), 0 if not
          isPrinter Printer flag: 1 if node detected to be a network printer, 0 if not
          isCDP CDP (Cisco Discovery Protocol) support flag: 1 node supports CDP, 0 if not
          isSONMP SONMP (SynOptics Network Management Protocol) support flag: 1 node supports SONMP, 0 if not
          isLLDP LLDP (Link Layer Discovery Protocol) support flag: 1 node supports LLDP, 0 if not
          snmpVersion SNMP version used for communication with node's SNMP agent
          snmpOID SNMP object ID
          agentVersion NetXMS agent version (as string, like 0.2.26)
          platformName Platform name, as returned by NetXMS agent (for example, windows-i386)

          Best regards,
          Victor

          1 Reply Last reply
          0
          • ?
            ?
            possamai
            wrote on last edited by
            #5

            is this scripting stuff documented somewhere? Because I can't find it..
            i'm trying to figure out how it works, but it's tough to find resources about auto bind filters etc. etc.

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

              Hi!

              There are documentation chapter about scripting language itself, and reference for all functions. However, writing transformation and filtering script are not covered. I'll try to add additional information on this topic to documentation.

              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