NetXMS Support Forum

English Support => General Support => Topic started by: Spheron on June 25, 2015, 01:51:13 PM

Title: Filtering Script in EventProcessing
Post by: Spheron on June 25, 2015, 01:51:13 PM

Hello @all,

i'd like to implement a filtering script in event processing:

-----
if ($event->message like "*ERP Basis System*"){
  return false; // Match rule
}
return true;
-----

Event processing should only throw a alarm, if there is NOT the text "ERP Basis System" in the message text of the event. How can/must i use wildcards in filtering scripts?

Thanks for helping me...

Greets
Marco
Title: Re: Filtering Script in EventProcessing
Post by: Victor Kirhenshtein on June 25, 2015, 02:44:40 PM
Hi,

in matching scripts true means "match" and false means "do not match".

Best regards,
Victor


Title: Re: Filtering Script in EventProcessing
Post by: Spheron on June 25, 2015, 05:39:41 PM

Thanks for the reply. I understand this.

But i think that the code from above is false. Can i use "*" als wildcard in filtering code? Is the script above functional in NetXMS?
Title: Re: Filtering Script in EventProcessing
Post by: Spheron on June 26, 2015, 03:16:08 PM

I found a solution myself. I'm using following filter script in events to filter the message text with wildcards:

if($event->message ~= "(.*)ERP Basis System(.*)") return false;
else return true;

Greets
Marco