Thanks Mike,

Excellent. I'm pretty sure that solves my problems, knowing how it works. Thank 
you for explaining.

However, just out of curiosity... :)
I already had a quick look at the source (too quick I guess), but I sure didn't 
catch that the subject was also used to extract state (or anything).
I guess I just took for granted that if I specify three specific lines to find 
"Host, Service and State" somewhere in the mail, those were all that was needed 
and used. No need to look only at the subject or body.

But is it looking at both the subject *and* the body?

...
my @SubjectLines...
...
my @BodyLines...
...

I can't say that I fully understand the code (at all), but how does it know 
which one to use?
If the Host, Service and State are "well-defined" (with the regexp), and no 
match is found in the subject, should it not just continue to the body?

Thanks a lot.

--
/Sune T.

From: otrs-boun...@otrs.org [mailto:otrs-boun...@otrs.org] On Behalf Of James 
Michael DuPont
Sent: 23. marts 2012 20:20
To: User questions and discussions about OTRS.
Subject: Re: [otrs] SystemMonitoring regexp failure


Sune T.,
you can call me mike, my full name is james michael, but everyone calls me me 
mike.

Lets look at the source for for how the regex is used :

In the source code ;Kernel/System/PostMaster/Filter/SystemMonitoring.pm
you will see that it parses the state from the mail.
# Try to get State, Host and Service from email subject
    my @SubjectLines = split /\n/, $Subject;
    for my $Line (@SubjectLines) {
        for (qw(State Host Service)) {
            if ( $Line =~ /$Self->{Config}->{ $_ . 'RegExp' }/ ) {
                $Self->{$_} = $1;

Then when the state is extracted, it is matched :
 if ( $Self->{State} =~ /$Self->{Config}->{CloseTicketRegExp}/ ) {
where the default regex is  CloseTicketRegExp => 'OK|UP'

Then the state of the ticket is stet to the state named, and specified by 
CloseActionState which defaults to  'closed successful',

So if you use 0, then you would have to have 0 in the subject of the mails. If 
you want to specify a different state, you need to set the name of that state 
in CloseActionState.

I hope this helps explain how the system monitoring is used. Let me know if you 
have any more questions.

mike
On Fri, Mar 23, 2012 at 7:35 PM, Sune T. Tougaard 
<s...@lyngsoesystems.com<mailto:s...@lyngsoesystems.com>> wrote:
Thanks Mike/James,

However, "0" is exactly what i'm looking for, to see if the host is up.

I have an "OTRSNumState" that can be either 0, 1, 2, 3, 4 or 5.
0 is meant to close, while the rest is meant to create a new (or append to 
existing) ticket.
Hmm, perhaps I could just try putting some other text there, instead of the 0. 
I control both systems, so I can put anything I like.
I'll try that instead of looking for numbers.

Thanks for your input, makes me think again. :)

--
/Sune T.

From: otrs-boun...@otrs.org<mailto:otrs-boun...@otrs.org> 
[mailto:otrs-boun...@otrs.org<mailto:otrs-boun...@otrs.org>] On Behalf Of James 
Michael DuPont
Sent: 23. marts 2012 15:09
To: User questions and discussions about OTRS.
Subject: Re: [otrs] SystemMonitoring regexp failure

Hi there,

According to your mail you have
> 'CloseTicketRegExp' => '0',

You are going to need some regex to match if the host is up.

For example, the standard is  :

    CloseTicketRegExp => 'OK|UP',

That means OK or UP will mark the server as back online.

See also the documentation, it names this as the default value.

Let me know if that helps,
mike

--
James Michael DuPont
Custom Engineering/Research & Development

OTRS AG
Norsk-Data-Straße 1
D-61352 Bad Homburg

T: +49 (0) 9421 56818 0<tel:%2B49%20%280%29%209421%2056818%200>
F: +49 (0) 9421 56818 18<tel:%2B49%20%280%29%209421%2056818%2018>
I: http://www.otrs.com/

Geschäftssitz: Bad Homburg, Amtsgericht Bad Homburg, HRB 10751, USt-Nr.: 
DE256610065
Aufsichtsratsvorsitzender: Burchard Steinbild, Vorstand: André Mindermann 
(Vorsitzender), Christopher Kuhn


---------------------------------------------------------------------
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs



--
James Michael DuPont
Custom Engineering/Research & Development

OTRS AG
Norsk-Data-Straße 1
D-61352 Bad Homburg

T: +49 (0) 9421 56818 0
F: +49 (0) 9421 56818 18
I: http://www.otrs.com/

Geschäftssitz: Bad Homburg, Amtsgericht Bad Homburg, HRB 10751, USt-Nr.: 
DE256610065
Aufsichtsratsvorsitzender: Burchard Steinbild, Vorstand: André Mindermann 
(Vorsitzender), Christopher Kuhn

---------------------------------------------------------------------
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs

Reply via email to