System monitoring regular expression

Moderator: crythias

Locked
ArielRauch
Znuny newbie
Posts: 40
Joined: 16 Mar 2011, 17:12
Znuny Version: 3.0.6

System monitoring regular expression

Post by ArielRauch »

Hi,
I have connected Nagios to OTRS via the system monitoring module without any problems.
Now I have another input source and I would like to use the "before postmaster" filter for it. It works, but I have some problems with the regular expression. Perhaps someone can help me out:
The relevant sentence in the source is either:
Webmetrics Connectivity Alert for KloutAPIProxy and more stuff (=> here I need to look for "Alert for" and filter out "KloutAPIProxy " for the service.)
The closing message is:
Webmetrics OK for KloutAPIProxy and more stuff (=> here I need to look for "OK for" and filter out "KloutAPIProxy " for the service.)

I need ONE regexp that filters out the service for both cases

The State will be of course either Alert or OK.

Some regexp expert to help me?

Thanks

Ariel
OTRS:ITSM 3.0.6 on Centos 5.5 with MySQL database connected to an Active Directory for Agents.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: System monitoring regular expression

Post by crythias »

Not quite sure if I am followin well, but this might work
Match: Webmetrics Connectivity Alert for (KloutAPIProxy|Queue2|Queue3)
Set: X-OTRS-Queue: [***]

Match: Webmetrics OK for (KloutAPIProxy|Queue2|Queue3)
Set: X-OTRS-Queue: [***]

You probably don't want to try to do something like (\w+) because it's possible you might have queues that don't match spelling, case, etc.
http://regexpal.com/
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
ArielRauch
Znuny newbie
Posts: 40
Joined: 16 Mar 2011, 17:12
Znuny Version: 3.0.6

Re: System monitoring regular expression

Post by ArielRauch »

Sorry my fault, I was not clear at all.
The service name is not always the same and I need him for the service field.
This can be easily achieved by putting him into round brackets. The state (alert or ok) which is the word before "for" must be also in round brackets (alert|ok) but the it will be selected instead of the service name.
Notvsure that this time I was clearer but I give it a try.
Thanks for the patience with me.

Ariel
OTRS:ITSM 3.0.6 on Centos 5.5 with MySQL database connected to an Active Directory for Agents.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: System monitoring regular expression

Post by crythias »

Why do you need one regex? What does "before postmaster" mean? Are you creating your own PostMaster Filter as a file?
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
ArielRauch
Znuny newbie
Posts: 40
Joined: 16 Mar 2011, 17:12
Znuny Version: 3.0.6

Re: System monitoring regular expression

Post by ArielRauch »

ok - I'll explain:
I am using the system monitoring module for Nagios. for this purpose I am using the "before postmaster filter" option.
In addition I have a customer where I need to poll a mailbox. As it works very similar to Nagios I thought I will "misuse" the "before postmaster filter" option in the system monitoring module for this.
In fact I already made it work nut the regular expression I used are not very strong. Actually I was looking for a solution where I can use the round brackets twise and decide which one shall be returned.

I know it is not very clear but I hope you understand.

Thanks again,

Ariel
OTRS:ITSM 3.0.6 on Centos 5.5 with MySQL database connected to an Active Directory for Agents.
Wolfgangf
Znuny ninja
Posts: 1029
Joined: 13 Apr 2009, 12:26
Znuny Version: 6.0.13
Real Name: Wolfgang Fürtbauer
Company: PBS Logitek GmbH
Location: Pinsdorf

Re: System monitoring regular expression

Post by Wolfgangf »

ArielRauch wrote: The relevant sentence in the source is either:
Webmetrics Connectivity Alert for KloutAPIProxy and more stuff (=> here I need to look for "Alert for" and filter out "KloutAPIProxy " for the service.)
The closing message is:
Webmetrics OK for KloutAPIProxy and more stuff (=> here I need to look for "OK for" and filter out "KloutAPIProxy " for the service.)

I need ONE regexp that filters out the service for both cases
could thisone help?

Code: Select all

.*(Alert|OK) for\s*(\w*).*
Produktiv:
OTRS 6.0.13/ ITSM 6.0.13
OS: SUSE Linux (SLES 12, Leap), MySql 5.5.x, 5.6.x
Windows 2012 AD Integration (agents and customers), Nagios integration (incidents, CMDB), Survey, TimeAccounting
ArielRauch
Znuny newbie
Posts: 40
Joined: 16 Mar 2011, 17:12
Znuny Version: 3.0.6

Re: System monitoring regular expression

Post by ArielRauch »

Wouldn't this one return alert or ok instead of the service?
OTRS:ITSM 3.0.6 on Centos 5.5 with MySQL database connected to an Active Directory for Agents.
Wolfgangf
Znuny ninja
Posts: 1029
Joined: 13 Apr 2009, 12:26
Znuny Version: 6.0.13
Real Name: Wolfgang Fürtbauer
Company: PBS Logitek GmbH
Location: Pinsdorf

Re: System monitoring regular expression

Post by Wolfgangf »

did you try? I assume the Service will be returned
Produktiv:
OTRS 6.0.13/ ITSM 6.0.13
OS: SUSE Linux (SLES 12, Leap), MySql 5.5.x, 5.6.x
Windows 2012 AD Integration (agents and customers), Nagios integration (incidents, CMDB), Survey, TimeAccounting
Locked