[Check_mk (english)] Need help in using RegEx in Check_MK Active HTTP

Hi Andreas,
Hope you can help me in my problem in using Active HTTP monitoring and regex for expected content.

Im monitoring a Rest service URL that returns a json format values and i need to check if theres a string “status”=“1”.

I tried even the simplest status but it’s not working and encountering pattern not found error.

Regards,
Anton

Notice of Confidentiality

This email contains confidential material prepared for the intended addressees only and it may contain intellectual property of Willis Towers Watson, its affiliates or a third party. This material may not be suitable for, and we accept no responsibility for,
use in any context or for any purpose other than for the intended context and purpose. If you are not the intended recipient or if we did not authorize your receipt of this material, any use, distribution or copying of this material is strictly prohibited
and may be unlawful. If you have received this communication in error, please return it to the original sender with the subject heading “Received in error,” then delete any copies.

You may receive direct marketing communications from Willis Towers Watson. If so, you have the right to opt out of these communications. You can opt out of these communications or request a copy of Willis Towers Watson’s privacy notice by emailing
unsubscribe@willistowerswatson.com.

This e-mail has come to you from Willis Towers Watson US LLC

Hi Andreas,

I tried this command and it’s working

check_http -H -u -S -v -r ‘.success.

But when I apply it in the Check_MK WATO, it says “Pattern Not Found”

image001.jpg

Regards,

Anton

···

From: BarroquilloJr, Anton (Taguig City)
Sent: Thursday, August 08, 2019 3:05 PM
To: ‘Andreas Döhler’ andreas.doehler@gmail.com
Subject: RE: Need help in using RegEx in Check_MK Active HTTP

Thanks Andreas for the response.

Rest response is

{“success”:“1”,“response_code”:“101”,“skin_file”:“/doc/LIF/mobskin.txt”,“projected_benefits”:0,“investment_overview”:“1”,“transaction_overview”:“0”,“unit_price_history”:“1”,“member_status”:“AC”,“epa_userid”:"
“,“session_id”:“a4d2550e9ae32c66478044520dad4ba4”,“error_message”:”“,“currency”:“GBP”,“welcome_message”:“Welcome,\nMrs Demo”,“heading”:“Home”,“logout”:“Logout”,“download”:“Last Data Downloaded”,“date_format”:“0”,“up_heading”:“Unit Price History”,“up_text”:“Tap
here for Unit Price History”,“service_message”:”",“upgrade”:0}

I’ve tried this command and this setting, but still didn’t work.

check_http -H -u -S -v -r .success.

Regards,

Anton

From: Andreas Döhler [mailto:andreas.doehler@gmail.com]
Sent: Thursday, August 08, 2019 4:00 AM
To: BarroquilloJr, Anton (Taguig City) Anton.BarroquilloJr@willistowerswatson.com
Subject: Re: Need help in using RegEx in Check_MK Active HTTP

Hi Anton,

you are sure that the REST response is inside the body?

The two options to search for strings is -d for header strings and -s for body strings and nothing is working?

status will not work - it should be enough to search for status without the two *

Or you can try to use .status. as real regular expression but then you must use the -r command line option.

Best regards

Andreas

Am Mi., 7. Aug. 2019 um 19:33 Uhr schrieb BarroquilloJr, Anton (Taguig City) Anton.BarroquilloJr@willistowerswatson.com:

Hi Andreas,
Hope you can help me in my problem in using Active HTTP monitoring and regex for expected content.

Im monitoring a Rest service URL that returns a json format values and i need to check if theres a string “status”=“1”.

I tried even the simplest status but it’s not working and encountering pattern not found error.

Regards,
Anton

Notice of Confidentiality

This email contains confidential material prepared for the intended addressees only and it may contain intellectual property of Willis Towers Watson, its affiliates or a third party. This material may not be suitable for, and we accept no responsibility for,
use in any context or for any purpose other than for the intended context and purpose. If you are not the intended recipient or if we did not authorize your receipt of this material, any use, distribution or copying of this material is strictly prohibited
and may be unlawful. If you have received this communication in error, please return it to the original sender with the subject heading “Received in error,” then delete any copies.

You may receive direct marketing communications from Willis Towers Watson. If so, you have the right to opt out of these communications. You can opt out of these communications or request a copy of Willis Towers Watson’s privacy notice by emailing
unsubscribe@willistowerswatson.com.

This e-mail has come to you from Willis Towers Watson US LLC

Hi Anton,

your configuration should work. The option “Regular expression to expect in content” should create the command line option “-r”.

You can have a look at your generated core configuration. Inside your HTTP service got to the line “Service check command”.

There you should find something like this “check_mk_active-http!‘-I’ ‘$_HOSTADDRESS_4$’ ‘-u’ ‘/test/check_mk/login.py’ ‘-r’ ‘.login.’”

Now you have all the command line options and can test if it is also working manually.

Best regards

Andreas

image001.jpg

···

Am Di., 13. Aug. 2019 um 13:03 Uhr schrieb BarroquilloJr, Anton (Taguig City) Anton.BarroquilloJr@willistowerswatson.com:

Hi Andreas,

        I tried this command and it’s working
                    check_http -H <hostname> -u <RestURL> -S -v -r '.*success.*'
        But when I apply it in the Check_MK WATO, it says “Pattern Not Found”

Regards,

Anton

From: BarroquilloJr, Anton (Taguig City)
Sent: Thursday, August 08, 2019 3:05 PM
To: ‘Andreas Döhler’ andreas.doehler@gmail.com
Subject: RE: Need help in using RegEx in Check_MK Active HTTP

Thanks Andreas for the response.

Rest response is

{“success”:“1”,“response_code”:“101”,“skin_file”:“/doc/LIF/mobskin.txt”,“projected_benefits”:0,“investment_overview”:“1”,“transaction_overview”:“0”,“unit_price_history”:“1”,“member_status”:“AC”,“epa_userid”:"
“,“session_id”:“a4d2550e9ae32c66478044520dad4ba4”,“error_message”:”“,“currency”:“GBP”,“welcome_message”:“Welcome,\nMrs Demo”,“heading”:“Home”,“logout”:“Logout”,“download”:“Last Data Downloaded”,“date_format”:“0”,“up_heading”:“Unit Price History”,“up_text”:“Tap
here for Unit Price History”,“service_message”:”",“upgrade”:0}

I’ve tried this command and this setting, but still didn’t work.

check_http -H -u -S -v -r .success.

Regards,

Anton

From: Andreas Döhler [mailto:andreas.doehler@gmail.com]
Sent: Thursday, August 08, 2019 4:00 AM
To: BarroquilloJr, Anton (Taguig City) Anton.BarroquilloJr@willistowerswatson.com
Subject: Re: Need help in using RegEx in Check_MK Active HTTP

Hi Anton,

you are sure that the REST response is inside the body?

The two options to search for strings is -d for header strings and -s for body strings and nothing is working?

status will not work - it should be enough to search for status without the two *

Or you can try to use .status. as real regular expression but then you must use the -r command line option.

Best regards

Andreas

Am Mi., 7. Aug. 2019 um 19:33 Uhr schrieb BarroquilloJr, Anton (Taguig City) Anton.BarroquilloJr@willistowerswatson.com:

Hi Andreas,
Hope you can help me in my problem in using Active HTTP monitoring and regex for expected content.

Im monitoring a Rest service URL that returns a json format values and i need to check if theres a string “status”=“1”.

I tried even the simplest status but it’s not working and encountering pattern not found error.

Regards,
Anton

Notice of Confidentiality

This email contains confidential material prepared for the intended addressees only and it may contain intellectual property of Willis Towers Watson, its affiliates or a third party. This material may not be suitable for, and we accept no responsibility for,
use in any context or for any purpose other than for the intended context and purpose. If you are not the intended recipient or if we did not authorize your receipt of this material, any use, distribution or copying of this material is strictly prohibited
and may be unlawful. If you have received this communication in error, please return it to the original sender with the subject heading “Received in error,” then delete any copies.

You may receive direct marketing communications from Willis Towers Watson. If so, you have the right to opt out of these communications. You can opt out of these communications or request a copy of Willis Towers Watson’s privacy notice by emailing
unsubscribe@willistowerswatson.com.

This e-mail has come to you from Willis Towers Watson US LLC

Notice of Confidentiality

This email contains confidential material prepared for the intended addressees only and it may contain intellectual property of Willis Towers Watson, its affiliates or a third party. This material may not be suitable for, and we accept no responsibility for,
use in any context or for any purpose other than for the intended context and purpose. If you are not the intended recipient or if we did not authorize your receipt of this material, any use, distribution or copying of this material is strictly prohibited
and may be unlawful. If you have received this communication in error, please return it to the original sender with the subject heading “Received in error,” then delete any copies.

You may receive direct marketing communications from Willis Towers Watson. If so, you have the right to opt out of these communications. You can opt out of these communications or request a copy of Willis Towers Watson’s privacy notice by emailing
unsubscribe@willistowerswatson.com.

This e-mail has come to you from Willis Towers Watson US LLC