Filtering Script on Event Processing Policy request value from other dci

Started by Sash, October 05, 2023, 03:31:53 PM

Previous topic - Next topic

Sash

Hi all,

I have a Event Processing Policy which send me an Alarm If a Networkinterface has more than 5 Errors / min. 
Now I want to filter that a Alarm is only generated when the Interface is not on halfduplex mode.

For both I have set a DCI.

Unfortunally I have no Idea how I can match the other DCI in the Filterscript...

Some Ideas?

Thanks a lot.


Filipp Sudanov


In event processing policy you can use a filter script like this:
ifName = $dci->instance;
if (ifName == null or ifName == "") return false;

dciDescription = "Port Speed auf " . ifName;
portSpeed = GetDCIValueByDescription($node, dciDescription);

if (portSpeed->contains("HD")) return false;

return true;


$dci->instance will work if your DCIs are created by instance discovery, otherwise you might need to get the interface name by parsing description.

Alternative approach could be to use script threshold on your network error DCIs - that script could also get value of port speed DCI and generate threshold violation event only when both conditions are met. This way you would have less events (which also consume resources as they are stored in the DB).

Feel free to ask if you need more script examples.



Sash

Hi Filipp,

sorry for the late response. Thanks for the example.

I use it now in Threshold Script.
The Script

1 dciDescription = "Port Speed auf 1/1/3";
2 portSpeed = GetDCIValueByDescription($node, dciDescription);
3
4 if (portSpeed->contains("HD")) return true;
5
6 return false;

is working - but everytime I restart the NetXMS Server I get an Error about the Script:

Script (DCI::xxx - xxx::10165::12568::ThresholdScript) execution error: Error 14 in line 4: Function or operation argument is not an object

Where´s my Misstake?

Thanks for your Help.





Filipp Sudanov

Yes, threshold script is a better place for this.

If you open hint in editor of threshold script, you'll see:
$1 current DCI value;
$2 threshold value;
$dci this DCI object;
$isCluster true if DCI is on cluster;
$node current node object (null if DCI is not on the node);
$object current object.

So you can use $1 instead of GetDCIValueByDescription($node, dciDescription);, this would give you current value of the DCI.

GetDCIValueByDescription() actually gets previously collected value, when server starts, values for frequently collected DCIs are not cached from database to memory, that's would explain script error.

Sash

Hi Filipp.

thanks for your reply.

$1 is current DCI value - this is matched to the "Eingehende Fehlerrate" DCI - but I need the value from the "Port Speed auf x/x/x"
So I can´t use $1 in this script.

DCI Template:



Data Collection in Node:




right?


Filipp Sudanov

Looks like some screenshots are missing.
But a question regarding your text - may be you can just use your threshold script right on "Port Speed auf x/x/x" DCI?