How to login in to http website and check the pages

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Ravikimt
Posts: 77
Joined: Tue Apr 03, 2018 12:02 pm

How to login in to http website and check the pages

Post by Ravikimt »

Hi All,

I need a help, I am not able to monitoring my website pages after login in to the website.
Can anyone help me here I can do this on nagios core.? Currently, I am using nagios core 4.3.2 version on my Ubuntu 16.04 LTS.?

Currently I am using this command.

./check_http -I www.abc.com -H www.abc.com -p 8000 -u /t/XYZSolutions/views/XYZSolutions/NewMenu -P "usernamefield=test&passwordfield=1234"

Can anybody correct me here If I am wrong.?
User avatar
eloyd
Cool Title Here
Posts: 2129
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: How to login in to http website and check the pages

Post by eloyd »

Without knowing more about your specific configuration or requirements, it's hard to say. It would help to know what error condition you are experiencing that makes you think it is not working.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
Ravikimt
Posts: 77
Joined: Tue Apr 03, 2018 12:02 pm

Re: How to login in to http website and check the pages

Post by Ravikimt »

My requirement is that I have to login into a website using my login credentials and after logging in to a website one page should come with some information but sometimes what does happen, It appears some blank page (Simple white page) without any information.

If I face such type of problem in future then I have to trigger an alert. This is my requirement.
Please let me know if you need more information regarding this.
Last edited by Ravikimt on Mon Apr 30, 2018 9:59 am, edited 1 time in total.
User avatar
eloyd
Cool Title Here
Posts: 2129
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: How to login in to http website and check the pages

Post by eloyd »

My first question is, are you truly going to www.abc.com or is that just an example?

Second, what happens when you go to a web browser and type in http://www.abc.com/t/XYZSolutions/views ... ns/NewMenu? Do you get a popup username/password prompt, or is two fields on the page that you have to enter? If it's two fields on the page, then this won't work for Nagios. Nagios can only authenticate with Basic WWW Auth (the popup window). If it's part of a form on the screen that you have to enter, then Nagios cannot process that and you will have to use some sort of synthetic web transaction monitoring tool like WebInject. This would probably be beyond the assistance you would get in the general support forum here.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: How to login in to http website and check the pages

Post by mcapra »

eloyd wrote:you will have to use some sort of synthetic web transaction monitoring tool like WebInject.
Also:
Selenium (I know the doc says "Nagios XI" but this is also applicable to Nagios Core)
And I wrote a really rough plugin that runs and parses CasperJS tests: https://github.com/mcapra/nagios-check_casperjs

But the main answer to this question if you're not using basic authentication is that you'll need some sort of third party integration beyond the standard Nagios plugins. If the site is using basic authentication, check_http can handle that:

Code: Select all

     -a, --authorization=AUTH_PAIR
        Username:password on sites with basic authentication
     -b, --proxy-authorization=AUTH_PAIR
        Username:password on proxy-servers with basic authentication
Former Nagios employee
https://www.mcapra.com/
Ravikimt
Posts: 77
Joined: Tue Apr 03, 2018 12:02 pm

Re: How to login in to http website and check the pages

Post by Ravikimt »

This www.abc.com just for an example.

Once I type this URL (This is not a exact url , I have modified the url ) http://www.abc.com/t/XYZSolutions/views ... ns/NewMenu? on web browser. I get a page with two fields username and password then I have to enter my credentials. Yes it's a part of the form

So I can't monitor this page right so can you please provide me some links for synthetic web transaction monitoring tool like WebInject so I can go through that it will be easy for me.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: How to login in to http website and check the pages

Post by mcapra »

The official WebInject documentation is reasonably good for getting started:
http://www.webinject.org/plugin.html
Former Nagios employee
https://www.mcapra.com/
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: How to login in to http website and check the pages

Post by cdienger »

The link provided by @mcapra includes an example on authenticating against a site. Let us know if you have any trouble setting the check up.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
Bryan Quesada
Posts: 6
Joined: Wed Nov 05, 2014 10:23 am
Location: Costa Rica
Contact:

Re: How to login in to http website and check the pages

Post by Bryan Quesada »

Example with curl

### Example POST Data

### send POST DATA, User Agent and redirs(with cookie)

[bryan@Tornado ~]$ curl -k -v -b cookie.txt -c cookie.txt --max-redirs 10 --data "username=user1&pass=user1234Q&profile=1" "https://sitea/login/" -A "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:59.0) Gecko/20100101 Firefox/59.0"
User avatar
eloyd
Cool Title Here
Posts: 2129
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: How to login in to http website and check the pages

Post by eloyd »

Which will still likely not work if the site doesn't use <form> data to process the login. AJAX, for instance, will fail this type of check, and there may be a page that has to be logged in to and then a second page to pull the appropriate results. Synthetic web transactions are really the only way to properly cover the bases.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
Locked