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. Transformations Scripts for table DCI

Transformations Scripts for table DCI

Scheduled Pinned Locked Moved Support
6 Posts 3 Posters 36.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
    Christian021
    wrote on last edited by
    #1

    Hi,

    NetXMS is a very good programm, i think.
    I´ve the following problem with transformation scripts of table dci´s: For example i have a dci named voltage. In this DCI there are three colums: description (string), voltage (integer) and the status (string).
    Unfortunally the voltage is with factor 1000 and the status is orgininal an integer (f. ex. 3 = is okay)
    Now I want to transform the voltage to the real value (1200 to 1,2) and the status value to an status text (3 = OK).
    I have transformation scrips for "simple" parameters - they are working. But they don´t work with table dci.
    So I want to ask for help and for an example. Thanks a lot.

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

      Hi!

      It could looks like following:

      idxVoltage = $1->getColumnIndex("VOLTAGE");
      idxStatus = $1->getColumnIndex("STATUS");
      
      for(i = 0; i < $1->rowCount; i++)
      {
         $1->set(i, idxVoltage, $1->get(i, idxVoltage) / 1000);
         if ($1->get(i, idxStatus) == 3)
         {
            $1->set(i, idxStatus, "OK");
         }
      }
      

      Best regards,
      Victor

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

        Hi Victor,

        thank you so much. I guess, I never match the solution for my problem by myself...
        Your solution works fine.

        1 Reply Last reply
        0
        • A
          A
          andrey--k
          wrote on last edited by
          #4

          I try to do same.
          But result is not set correctly (snmp value is set in place of calculated value).
          Screenshot in attach.
          transformation script:

          Percnt = getColumnIndex("StorageUsedPercent");
          Used = getColumnIndex("hrStorageUsed");
          Size = getColumnIndex("hrStorageSize");
          for (i = 0; i < $1->rowCount; i++)
          {
          if ( $1->get(i, Used) > 0 && $1->get(i, Size) > 0 )
          {
          $1->set(i, Percnt, ($1->get(i, Used) / $1->get(i, Size) * 100) );
          }
          else
          {
          $1->set(i, Percnt, 0 );
          }
          

          Also I have noticed, that there are no any notification if table colums set not right.

          How to set Dummy column?


          TableGeneral.PNG

          TableColumns.PNG

          TableTransform.PNG

          TableThresholds.PNG

          TableResult.PNG

          1 Reply Last reply
          0
          • A
            A
            andrey--k
            wrote on last edited by
            #5

            Aditionaly template in attach.


            netxms-snmpTable-storage.xml

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

              Hi!

              getColumnIndex is a method of Table class, so you should use it as $1->getColumnIndex in transformation script, like you do with get method.

              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