Nagios checking Exchange URL (login required)
Nagios checking Exchange URL (login required)
Hello All,
I have somewhat of an odd request. To begin we are running Nagios XI 5.5.7 and NSClient++ 5.3.
On our Exchange frontend servers I need to monitor this address https://SERVER/ews/exchange.asmx/wssecurity. Browsing to this address prompts for a login and brings you to a XML page. When that happens all is working. If the XWL page does not load I need to restart the MSExchangeServicesAppPool.
So I need a script/plugin that points to that address, inputs logins info and check XML page.
I apologize for the odd request but any help on talking this will be greatly appreciated.
Thank you
Ryan
I have somewhat of an odd request. To begin we are running Nagios XI 5.5.7 and NSClient++ 5.3.
On our Exchange frontend servers I need to monitor this address https://SERVER/ews/exchange.asmx/wssecurity. Browsing to this address prompts for a login and brings you to a XML page. When that happens all is working. If the XWL page does not load I need to restart the MSExchangeServicesAppPool.
So I need a script/plugin that points to that address, inputs logins info and check XML page.
I apologize for the odd request but any help on talking this will be greatly appreciated.
Thank you
Ryan
Re: Nagios checking Exchange URL (login required)
A very important question; How is it prompting for a login? Is it using basic authentication? Some sort of form based authentication?RyanMule wrote:this address prompts for a login
The check_http plugin supports basic authentication via the -a argument:
Code: Select all
-a, --authorization=AUTH_PAIR
Username:password on sites with basic authentication
Code: Select all
-e, --expect=STRING
Comma-delimited list of strings, at least one of them is expected in
the first (status) line of the server response (default: HTTP/1.)
If specified skips all other status line logic (ex: 3xx, 4xx, 5xx processing)
Code: Select all
-d, --header-string=STRING
String to expect in the response headers
Code: Select all
-s, --string=STRING
String to expect in the content
...
-l, --linespan
Allow regex to span newlines (must precede -r or -R)
-r, --regex, --ereg=STRING
Search page for regex STRING
-R, --eregi=STRING
Search page for case-insensitive regex STRING
--invert-regex
Return CRITICAL if found, OK if notIf you're having to navigate forms-based authentication, I'd recommend the following documentation (specifically the bit about the "web transaction" wizard):
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Doesn't strike me as oddRyanMule wrote: I apologize for the odd request
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: Nagios checking Exchange URL (login required)
Hello Mcapra,
Thank you for the quick response!
Yes... I missed that key part... It is form based authentication, so it does complicate it a bit.
I am not looking for anything specific in the XML document just as long as is generated.
This is all great information! I have some work to do and I will provide an update asap
Thank you!
Thank you for the quick response!
Yes... I missed that key part... It is form based authentication, so it does complicate it a bit.
I am not looking for anything specific in the XML document just as long as is generated.
This is all great information! I have some work to do and I will provide an update asap
Thank you!
mcapra wrote:A very important question; How is it prompting for a login? Is it using basic authentication? Some sort of form based authentication?RyanMule wrote:this address prompts for a login
The check_http plugin supports basic authentication via the -a argument:In terms of answering the "did the XML page generate" question, hoo boy there's a lot of options starting with checking response codes (200, 400, 503, etc)Code: Select all
-a, --authorization=AUTH_PAIR Username:password on sites with basic authenticationChecking response headers (Content-Type, XSS, etc):Code: Select all
-e, --expect=STRING Comma-delimited list of strings, at least one of them is expected in the first (status) line of the server response (default: HTTP/1.) If specified skips all other status line logic (ex: 3xx, 4xx, 5xx processing)Checking body contents (specific XML key/value pairs maybe?):Code: Select all
-d, --header-string=STRING String to expect in the response headersReally depends on the specific site, but check_http can cover an awful lot of ground by itself assuming basic auth is the authentication mechanism.Code: Select all
-s, --string=STRING String to expect in the content ... -l, --linespan Allow regex to span newlines (must precede -r or -R) -r, --regex, --ereg=STRING Search page for regex STRING -R, --eregi=STRING Search page for case-insensitive regex STRING --invert-regex Return CRITICAL if found, OK if not
If you're having to navigate forms-based authentication, I'd recommend the following documentation (specifically the bit about the "web transaction" wizard):
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Doesn't strike me as oddRyanMule wrote: I apologize for the odd requestLogin checks are super handy for multiple reasons.
Re: Nagios checking Exchange URL (login required)
If it is using form based authentication you will need to use the check_http -P option:
You will need to URL encode the data:
https://www.urlencoder.org/
You will need to work with your application developers to determine what POST data you need to submit such as username/pass/etc.
Something like this may work:
Code: Select all
-P, --post=STRING
URL encoded http POST datahttps://www.urlencoder.org/
You will need to work with your application developers to determine what POST data you need to submit such as username/pass/etc.
Something like this may work:
Code: Select all
/usr/local/nagios/libexec/check_http -H SERVER -f follow -u '/ews/exchange.asmx/wssecurity' --method=POST -P 'username=USER&password=PASS&loginButton=' -s 'TEXT TO SEARCH FOR' -S -p 443 --sni-
optionstechnology
- Posts: 234
- Joined: Thu Nov 17, 2016 11:26 am
Re: Nagios checking Exchange URL (login required)
FYI: I came across a very similar issue and resolved by monitoring the IIS AppPool itself with check_iis -
https://exchange.nagios.org/directory/P ... ol/details
https://exchange.nagios.org/directory/P ... ol/details
Re: Nagios checking Exchange URL (login required)
Glad to hear you found another plugin that seems to work. Are we good to lock this one up?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Nagios checking Exchange URL (login required)
Thank you ssax!
I will look into this option as well.
I will look into this option as well.
ssax wrote:If it is using form based authentication you will need to use the check_http -P option:
You will need to URL encode the data:Code: Select all
-P, --post=STRING URL encoded http POST data
https://www.urlencoder.org/
You will need to work with your application developers to determine what POST data you need to submit such as username/pass/etc.
Something like this may work:
Code: Select all
/usr/local/nagios/libexec/check_http -H SERVER -f follow -u '/ews/exchange.asmx/wssecurity' --method=POST -P 'username=USER&password=PASS&loginButton=' -s 'TEXT TO SEARCH FOR' -S -p 443 --sni
Re: Nagios checking Exchange URL (login required)
Yes, this can be locked for now.
cdienger wrote:Glad to hear you found another plugin that seems to work. Are we good to lock this one up?
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Nagios checking Exchange URL (login required)
LockingRyanMule wrote:Yes, this can be locked for now.
cdienger wrote:Glad to hear you found another plugin that seems to work. Are we good to lock this one up?