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. Undocumented operators?

Undocumented operators?

Scheduled Pinned Locked Moved Support
4 Posts 3 Posters 23.4k 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.
  • K
    K
    KarlMCS
    wrote on last edited by
    #1

    Good evening,

    I have noticed these two operators which aren't in the documentation and would like some clarification on their use.

    One of them is a single dot.  Based on usage, it appears to be used to concatenate strings?  From the Wiki page Script Example: Read SNMP Value From Node:

    value = SNMPGetValue(transport, ".1.3.6.1.2.1.1.1.0");
    if (value == null)
    {
        println "Failed to issue SNMP GET request";
        return 2;
    }
    else
    {
        println "System description: " . value; // This dot
        return 0;
    }
    

    The other one is this which I've seen in a number of places, including the built-in scripts: ->  Example from Filter::AgentOrSNMP:

    return $1->isAgent || $1->isSNMP;
    

    I can see that it's referencing the capabilities of the node, but when I try to do this, the script fails, and NetXMS logs an event with description "error 15 in line 5: uknown object's attribute."  On this one, I'm trying to filter out some printers and a few other devices with SNMP that I don't want it to discover.  What I was going for on the line causing the error is return true for a device that has SNMP, and also is either running spanning-tree or is a router.  Maybe there's a better way to do this.  It's my first attempt.

    As best I can figure, $1->isSNMP returns true if the discovered node $1 has that capability, but I couldn't find this -> operator in the documentation.

    // Select any device running the NetXMS agent,
    // or any node with SNMP that matches criteria.
    
    if ($1->isAgent) {exit 1;}
    if ($1->isSNMP && ($1->isSTP || $1->isRouter)) {exit 1;}
    exit 0;
    

    Thanks

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

      "." is indeed string concatanation.

      It's shown and explained (along with others base NXSL concepts) here:
      https://wiki.netxms.org/wiki/UM:NetXMS_Scripting_Language_(NXSL)

      "->" is used to access members of an object
      (attributes or functions)

      You can find more details here:
      https://wiki.netxms.org/wiki/NXSL_Class_Reference

      "error 15 in line 5: uknown object's attribute." means that the object you are referencing doesn't have the member you specified.

      1 Reply Last reply
      0
      • K
        K
        KarlMCS
        wrote on last edited by
        #3

        Okay, thanks for that info.  I can see from https://wiki.netxms.org/wiki/NXSL:Node that isRouter is a node attribute, but isSTP is not...  I put that in based on what I saw in the below image.  I see most of those things are available attributes, but not isSTP.  I'll have to try another approach.

        I can probably accomplish what I need to do for the moment based on the driver or sysDescription attributes, but for future reference, can I pull SNMP values from the newly discovered node like this and use it to filter them?  https://wiki.netxms.org/wiki/Script_Example:_Read_SNMP_Value_From_Node


        NetXMS_isSTP.png

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

          Hi,

          we somehow missed isSTP flag. Just added it to node class, will be available in 2.2.3 release.

          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