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. Todays dumb question *** solved ***

Todays dumb question *** solved ***

Scheduled Pinned Locked Moved Support
7 Posts 2 Posters 99.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.
  • P
    P
    paul
    wrote on last edited by
    #1

    What am I doing wrong here? - the OR is not working in Automatic Bind Rules.
    left($node->name,4) == "rawd" || left($node->name,4) == "rawq";

    These on their own work. left($node->name,4) == "rawd"; and left($node->name,4) == "rawq";  but not when I add the OR (or what I thing is the OR).

    my understanding is based on this:
    https://www.netxms.org/documentation/adminguide/data-collection.html#instance

    Can anyone point me in the direction of where any of this is in any doco?

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

      I am assuming this line is only part of your full script? Otherwise, the or statement doesn't really do anything.
      If you want to bind a node to a container based on name starting with rawd or rawq, you will have to add a "return" in front of your line, so that the result of your OR statement is actually used.
      Alternatively you can also use

      return $node->name ~= "^raw[dq]";
      
      1 Reply Last reply
      0
      • P
        P
        paul
        wrote on last edited by
        #3

        I told you it was a dumb question!!

        It is confusing because auto bind asks for a script - but it accepts code as well - which is just one part of what is confusing.

        From a solution perspective - fantastic - it works perfectly!! I use it not in a script - just using it "as is"

        As much as I think netxms is fantastic, some basic tutorials that demonstrate the syntax and basic script functionality would be a great benefit to those new to netxms.

        Another example of something that I should be able to do better. My Windows container uses the following auto bind but I would rather just search for Windows in sysDescription - but I do not know the name of that variable at a netxms level and I do not know the syntax for "contains". I tried like, but that did not work.

        So todays dumb question

        What is wrong with return $node->sysDescription  like "Windows";

        The server has these two attributes in Object view:
        System Description=Hardware: Intel64 Family 6 Model 79 Stepping 1 AT/AT COMPATIBLE - Software: Windows Version 6.2 (Build 9200 Multiprocessor Free)
        SNMP Object ID=.1.3.6.1.4.1.311.1.1.3.1.2

        For my Windows container:
        works
        return $node->snmpOID == ".1.3.6.1.4.1.311.1.1.3.1.2";

        does not work
        return $node->sysDescription  like "Windows";


        when is a script not a script.png

        1 Reply Last reply
        0
        • P
          P
          paul
          wrote on last edited by
          #4

          Todays answer - add the wild card!!.

          return $node-> sysDescription like "*Windows*";

          Thanks Victor:
          https://www.netxms.org/forum/configuration/snmp-traps-handling/msg4957/#msg4957

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

            The following pages might be useful for scripting:
            For the node object, there's documentation on attributes here: https://wiki.netxms.org/wiki/NXSL:Node (for class reference, see https://wiki.netxms.org/wiki/Category:NXSL_Class_Reference)
            Comparison operators are documented here: https://wiki.netxms.org/wiki/UM:NetXMS_Scripting_Language_(NXSL)#Comparison_Operators
            Function Reference (not sure how up to date that is in regards to new functions): https://wiki.netxms.org/wiki/NXSL_Function_Reference

            1 Reply Last reply
            0
            • P
              P
              paul
              wrote on last edited by
              #6

              I had a look at those links however many of the items do not have an example - especially the ones I want.

              My latest dumb question - how do I match on rawd or RAWD ?

              imatch instead of of ~=

              1 Reply Last reply
              0
              • P
                P
                paul
                wrote on last edited by
                #7

                yep - imatch works 🙂

                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