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.
How to monitor URL availability by login in to it.
-
matson-itops
- Posts: 133
- Joined: Wed Nov 18, 2015 11:19 pm
Re: How to monitor URL availability by login in to it.
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.
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/
https://www.mcapra.com/
Re: How to monitor URL availability by login in to it.
Thanks again, @mcapra! 
@matson-itops, let us know if mcapra answered your question.
@matson-itops, let us know if mcapra answered your question.
Be sure to check out our Knowledgebase for helpful articles and solutions!