Script to analyze trap message content and generate event

Started by CrUser, December 11, 2020, 04:48:52 PM

Previous topic - Next topic

CrUser

Hi,

I would ask for help with processing the content of the trap message.
The idea is that when receiving a trap message, I can use a script and expression filter to categorize some special events in accordance with the content of the message and create special events for them, and process all other traps that do not contain the required text in the message to the standard event creation process.
When I manage to get extracted events for such traps of special content then I can generate separate alarms via event policy and action scripts and send them for example via emails
If anyone has experience in writing such scripts and ways to do so please help.

best regards,
Tomislav

CrUser

Hi,

I may not have clearly defined the issue but I have managed to solve this message filtering problem in the meantime through Event processing policy.
I set up a script to filter by event content in a filtering script.
if ($event->message ~= "something to filter")
{
return true;
}

I used regular expresions to filter the content of the event and thus run server actions only for messages that contain post text.

For now, everything works so I hope I did it correctly

Tomislav