Page 1 of 1

How to monitor URL availability by login in to it.

Posted: Thu Aug 09, 2018 6:17 am
by matson-itops
Hi Team,

We got a requirement to monitor a URL "http://10.103.11.34:8080/online/onlineLogin.jsp" by "Login with Username and Password".
If any login error, it should send an alert us, Please help us to achieve this.

Re: How to monitor URL availability by login in to it.

Posted: Thu Aug 09, 2018 8:17 am
by mcapra
It would depend on exactly how the page/application is handling logins.

I would suggest first trying to write this as a web transaction with WebInject since this has the most seamless integration with Nagios XI:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf

Assuming it's an HTML form that references some sort of POST action, you can use check_http to POST directly to the login page. However, most modern web forms will have CSRF tokens to prevent this.

An alternative which can work around CSRF tokens would be to use a proper web driver framework like Selenium. There's official integration docs for Nagios XI available here:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf

I've also written a small Python based plugin that can interpret CasperJS tests if you don't want something as heavy as Selenium. I meant to do a write-up on Nagios XI integration, but haven't gotten around to it:
https://github.com/mcapra/nagios-check_casperjs

Frankly, CasperJS is probably the most lightweight and versatile option since Nagios XI already ships with PhantomJS. However, it requires you to know some intimate details about web back/front ends to get the full use out of it. You can use something like Resurrectio to record a test and export it to CasperJS, but it's not always perfect.

TL;DR there's options. It depends on the specifics of the login page.

Re: How to monitor URL availability by login in to it.

Posted: Thu Aug 09, 2018 10:58 am
by lmiltchev
Thanks again, @mcapra! :)

@matson-itops, let us know if mcapra answered your question.