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. Value from dci table to event template?

Value from dci table to event template?

Scheduled Pinned Locked Moved Support
4 Posts 2 Posters 33.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.
  • H
    H
    Hanfelt
    wrote on last edited by
    #1

    Is there any possibility to get a value to event template other than the instance one.
    It returns the row but you cannot use this in the event template like %column:ColumName or %row:ColumName??

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

      In all places where macros are supported you can use %[script_name] macro. Script with specified name should be in script library. In that script you can access table value (it will be object of class table - https://www.netxms.org/documentation/nxsl-latest/#class-table) and get value of specific cell from it.

      When developing your script, you can run it via Execute Script on the node where you have your table DCI. However, there's a difference - when script is ran automatically on threshold violation, variables $event, $dci will be set - you can use these to get parameters of event or id of the DCI. When running via Execute Script, these variables will not be set, so you need to modify your script slightly.

      Here's a brief example:

      //t = GetDCIValue($node, $dci.id); // for use in script called on threshold violation
      t = GetDCIValue($node, 13741); // for testing - use via Execute Script on node
      
      //row = $event.getParameter(4); // for use in script called on threshold violation
      row = t.findRowIndexByInstance("/sys"); // for testing
      
      return t.get(row, 1);
      

      You can give some more information, what exactly cell of your table you want to extract, then I can give some more examples.

      1 Reply Last reply
      0
      • H
        H
        Hanfelt
        wrote on last edited by
        #3

        I might have been overthinking this issue.

        I think its enough to have this in the event template:

        Nginx certificate will expire in 14 days for: %<instance> on server %n

        %<instance> is the certificate name in my case
        and %n is the node or object name in netxms.

        Thank you so much for the input though.

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

          In many cases it's better to use regular DCIs and instance discovery to automatically creation and removal of them.

          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