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. instance discovery and calculating disk used percentage - qnap snmp

instance discovery and calculating disk used percentage - qnap snmp

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

    Hi looking for a bit of assistance of where i'm going wrong trying to calulated used % on logical qnap drives via snmp.

    the qnap snmp has used and total snmp but not %.

    Have the following

    parameter

    .1.3.6.1.4.1.24681.1.4.1.1.1.2.3.2.1.4.{instance}

    Transformation

    sub main()
    {
    diskfree = GetDCIValueByName($node,SNMPGetValue(transport,".1.3.6.1.4.1.24681.1.4.1.1.1.2.3.2.1.4.".$1));
    disksize = GetDCIValueByName($node,SNMPGetValue(transport,".1.3.6.1.4.1.24681.1.4.1.1.1.2.3.2.1.3.".$1));
    return (100*(diskfree/disksize));
     }

    instance discovery
    snmp walk
    .1.3.6.1.4.1.24681.1.4.1.1.1.2.3.2.1.1

    Let me know where i'm going wrong or if something is missed happy to build this in to the qnap template once working and share.

    Thanks

    1 Reply Last reply
    0
    • jdowneyJ
      jdowneyJ
      jdowney
      wrote on last edited by
      #2

      I managed to get this working just need a few tweeks as sometime receive 0 randomly. Any ideas welcome.

      Description - QNAP - Storage - Disk - Logical - available {instance-name} (%)

      parameter
      .1.3.6.1.4.1.24681.1.4.1.1.1.2.3.2.1.3.{instance}

      Transformation
      // We are originally querying the actual volume size. This is required for
      // calculation and to have an instance to work with.
      volumeSize = $1;

      // Obtain the actual instance we're after. The last octet in the OID. Result will be stored in $1.
      $dci->name match "^.*\.([0-9]+)$";
      // Build OID to use to obtain space used
      oid = ".1.3.6.1.4.1.24681.1.4.1.1.1.2.3.2.1.4." .$1;

      // Connect to node via SNMP
      transport = CreateSNMPTransport($node);
      if (transport == null)
      return false; // node does not support SNMP or transport cannot be created

      // Obtain matching used space to calculate usage in %, which we can actually alert on.
      volumefree = SNMPGetValue(transport, oid);
      if (volumefree == null)
      return false;

      return format(int64(volumefree) / volumeSize * 100,1,2);

      1 Reply Last reply
      0
      • S
        S
        sarangtc
        wrote on last edited by
        #3

        The concatenation operator is ".." not "." so in the above script it should be

        oid = ".1.3.6.1.4.1.24681.1.4.1.1.1.2.3.2.1.4." ..$1;
        

        or else you will get an error

        1 Reply Last reply
        0
        • Z
          Z
          Tatjana Dubrovica
          wrote on last edited by
          #4

          @jdowney said in instance discovery and calculating disk used percentage - qnap snmp:

          I managed to get this working just need a few tweeks as sometime receive 0 randomly. Any ideas welcome.

          You can add trace command to trace data to server log when incorrect data is obtained. Like:
          trace(1, "Incorrect value");

          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