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. NXSL: Alarms by node

NXSL: Alarms by node

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

    I need a little assistance on how to use nxsl to pull all alarms from a node.  Any help would be appreciated.

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

      Something like that:

      for(a : $object->alarms)
      {
      	println(a->message);
      }
      

      List of alarms is an attribute of any object, not only node - it could be container, subnet, sensor... That's why I am using $object->alarms in the example, but if the object you are querying is a node, you can use $node->alarms

      Documentation it's here: https://www.netxms.org/documentation/nxsl-latest/#class-netobj

      1 Reply Last reply
      0
      • M
        M
        mem16421
        wrote on last edited by
        #3

        Thank you, I wasn't very detailed with my question.  What I am trying to figure out if a script runs I can pull alarms from a node, but from any node I choose.  So in a script how would I say clear alarms from 192.168.1.1 and it would switch to that node and run the commands.  Do I need to use like GetObject or something like that?  I am not a coder (clearly) but my struggle is understanding how to be in the correct context/object to run class commands

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

          Yes, you have to get node object first. Global variables $node and $object refer to current node. You can use function FindObject to get other objects. This function accepts either object ID or name. For example, if you want to print alarms for node named "netxms-server":

          node = FindObject("netxms-server");
          for(a : node->alarms)
          {
          	println(a->message);
          }
          

          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