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