Display custom value in the Alarm event text.

Started by cserzs, November 15, 2023, 11:00:53 AM

Previous topic - Next topic

cserzs

Hi All,

Is it possible to pass a custom value from the DCI to the event processing?
e.g. There is a DCI element that queries the state (value) of a device input. If this polled value exceeds  the configured threshold range, an event is generated based on the rules set in the Threshold section of DCI. For this event, I would like to add the name of the device input (value in string format), which I request from the device via SNMP using DCI's Transformation script. I would like to display this string value in the text of the alarm event.

Thanks in advance for any solutions or ideas.

Filipp Sudanov

Hi!

Simplest would be to store this in DCI's comment, and since recently we have %D macro that resolves to that comment, but the problem is that editing that comment from NXSL (e.g. in transformation script) is not currently possible. But we will add that at some point.

Currently you can use custom attributes on node to store such information, e.g. if DCI's tranformation script has
$node->setCustomAttribute("DCI_DESC_".$dci->name, 123);
this will update a custom attribute.

Then in script library you can have e.g. GetDciDescFromCustomAttribute script with the following:
return $node->getCustomAttribute("DCI_DESC_" . $dci->name);

And now in event's message you can have %[GetDciDescFromCustomAttribute] macro that would call above script and will get value of the custom attribute.

cserzs

Hi Filipp, Thank you very much for your support.