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. Transformation script and $dci object

Transformation script and $dci object

Scheduled Pinned Locked Moved Support
4 Posts 2 Posters 11.0k 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.
  • T
    T
    tuomar
    wrote on last edited by
    #1

    Hi,

    I try use (or get) current dci name on the transformation script, but i get error message:
    Error 14 in line 8: Function or operation argument is not an object

    Script line:
    dciName = $dci->name;

    My Netxms version is 1.2.14

    Rgs
     TM

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

      Hi!

      Just test it, and it works as expected. Can you please show full script?

      Best regards,
      Victor

      1 Reply Last reply
      0
      • T
        T
        tuomar
        wrote on last edited by
        #3

        Hi,

        Sorry, that was my mistake.
        Parameter what i need to get is description (http://wiki.netxms.org/wiki/NXSL:DCI).

        I created a dummy dci (parameter: Dummy, Origin: Internal, Data Type: string) and here are my simple test scripts:

        sub main()
        {
         dciName = $dci->name;
         return dciName;
        }

        When i click test button it shows error, but when script is "running on the server" the last value tab (and history) shows dummy.

        sub main()
        {
         dciName = $dci->description;
         return dciName;
        }

        When i click test button it shows error, but when script is "running on the server" the last value tab (and history) shows dci description.

        sub main()
        {
         nodeName = $node->name;
         return nodeName;
        }

        When i click test button it shows node name.

        Many thanks for your quick reply.

        Here is a long story and full script ...and sorry my bad english 🙂

        I try build dashbord that shows network statistic (eg. uplinks traffic (bytes/sec), port usage (%), router cpu usage, jne.) or network "heatmap". Users that can see this dashboard does not need see any other data on the devices.

        First at all i created "readonly" user that only have rights to the one dashboard, but then i get errors that user does not have nesessary rights to read the dci data. So next i give read right to Device container and now dashboard works ok, but user see too much data on devices (and can do snmp walk).
        I didn't found any option to give rights to only read dci data, so now i try create dummy object that have nesessary dcis.

        I hope that there is is a another way to do this kind of dashboard, so any tips/ideas are more than wellcome  😄

        This is script and now it works, but if i click test button i get error.

        sub main()
        {
        //Custom attribute "source_node"
        value_sourceNode = GetCustomAttribute($node, "source_node");

        //DCI description, it will need to be same as dci what we want read
        dciDescription = $dci->description;

        value_SourceObject = FindNodeObject($node, value_sourceNode);
        value_DCIid = FindDCIByDescription(value_SourceObject, dciDescription);
        value_DCIdata = GetDCIValue(value_SourceObject, value_DCIid);
        return value_DCIdata;
        }

        Rgs
         TM

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

          Hi!

          Currently there are no other way to show dashboard without giving read access to nodes where data is collected, so your approach is absolutely right.

          As for the script, it's actually a bug - in test mode $dci variable is not set. I'll fix it in the next 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