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. Is it possible to use text from another SNMP attribute for the legend on Graphs?

Is it possible to use text from another SNMP attribute for the legend on Graphs?

Scheduled Pinned Locked Moved Support
3 Posts 2 Posters 40.5k 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.
  • C
    C
    ChrisC
    wrote on last edited by
    #1

    I am graphing a device via SNMP that has 4 power outputs.
    I am displaying the 4 outputs on 1 graph, which works fine, but the names in the Legend are the names of the attribute (ie. "Output 1 Watts" "Output 2 Watts".
    Is it possible to use the text string from another SNMP counter for each Legend entry instead?
    I know I could just rename each of the attributes that I am graphing, but I am trying to make this generic so I can use it as a template for other devices.

    Thanks for a great product! I have been watching the intro by Thomas Kirnac, and it looks great!

    1 Reply Last reply
    0
    • F
      F
      Filipp Sudanov
      wrote on last edited by
      #2

      You can use instance discovery mechanism - in this case DCI are created and their names can be used in graphs on Performance tab.

      • Create a script in script library, e.g.:
      instances = %{ }; // Create empty hash map
      
      instances[".1.1.1"] = "name_one";
      instances[".1.1.2"] = "name_two";
      
      return instances;
      
      • Create a DCI. In "General" tab in DCI properties there are two macros - {instance} and {instance-name}. E.g. ".1.1.1" from the script will go into {instance}, "name_one" into {instance-name}.

      • In "Performance" tab in DCI properties the situation is opposite - {instance} will be filled with "name_one" (this is so for some historical reasons, should be changed in some future releases).

      Now, when you do Poll->Instance discovery on a node (or wait when it would happen automatically), the script will be executed, values returned by this script will be used to create/update DCIs.

      The script in the above example returns hash map. It could also return an array, in that case {instance} would be taken from that array. In instance discovery filter script it's possible to modify or add {instance} and {instance-name}.

      return Instance(displayName: "name_one", name: ".1.2.3");
      

      Now wee need to get the legend name. This could be done either from that script in script library or from instance discovery filter script:

      transport = $node->createSNMPTransport();
      if (transport != null) {
        legend_name = SNMPGetValue(transport, ".1.2.3.4.1");
      }
      

      There are some examples in NXSL docs: https://www.netxms.org/documentation/nxsl-latest/


      Screenshot at 2021-08-24 13-46-52.png

      Screenshot at 2021-08-24 13-46-59.png

      Screenshot at 2021-08-24 13-55-55.png

      1 Reply Last reply
      0
      • C
        C
        ChrisC
        wrote on last edited by
        #3

        Thank you for the detailled reply.
        I will need to read it several times and then try it!

        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