How to monitor URL availability by login in to it.

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
matson-itops
Posts: 133
Joined: Wed Nov 18, 2015 11:19 pm

How to monitor URL availability by login in to it.

Post 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.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

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

Post 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.
Former Nagios employee
https://www.mcapra.com/
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

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

Post by lmiltchev »

Thanks again, @mcapra! :)

@matson-itops, let us know if mcapra answered your question.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked