Page 1 of 2
Monitoring a website and expected content
Posted: Wed Mar 28, 2018 10:28 am
by emartine
I am trying to monitor the Nagios XI main web page content.
I can log in as the nagios test user I created and I am expecting it to read the content "Nagios XI" as it shows up on the main page. See attached.
My understanding from the check that is running via the wizards is that the check runs as follows:
/usr/local/nagios/libexec/check_http -H servername -s "Nagios XI" -f ok -I <serverIP> -u "/nagiosxi/" -S -p 443 -a "<username>:<password>"
Unfortunately the response I get back is:
/usr/local/nagios/libexec/check_http -H servername -s "Nagios XI" -f ok -I <serverIP> -u "/nagiosxi/" -S -p 443 -a "<username>:<password>"
HTTP CRITICAL: HTTP/1.1 302 Found - string 'Nagios XI' not found on '
https://servername:443/nagiosxi/' - 629 bytes in 0.175 second response time |time=0.174792s;;;0.000000 size=629B;;;0
Am I doing this right? Perhaps this isn't the best way to monitor website content?
The reason for doing this is to ensure that the main page shows what is expected and not just availability.
Re: Monitoring a website and expected content
Posted: Wed Mar 28, 2018 10:47 am
by scottwilkerson
302 is a redirection
change -f ok to -f follow
Re: Monitoring a website and expected content
Posted: Wed Mar 28, 2018 1:48 pm
by emartine
Awesome the follow works. This commands logs in as the test account I created but does it log out? If it doesn't... how can I make it log out?
Re: Monitoring a website and expected content
Posted: Wed Mar 28, 2018 2:31 pm
by scottwilkerson
It's only "logged in" in the sense that XI would remember the user if you sent the cookie back, since you aren't storing the cookie, you are essentially logged out, nothing else to do.
Re: Monitoring a website and expected content
Posted: Wed Apr 04, 2018 10:05 am
by emartine
Thank you for that info. How would I monitor a web page that is flash based? Is that possible?
Re: Monitoring a website and expected content
Posted: Wed Apr 04, 2018 10:16 am
by emartine
Scott. I sent you a PM.
Re: Monitoring a website and expected content
Posted: Wed Apr 04, 2018 2:15 pm
by scottwilkerson
send response in PM, but the gist was the page being monitored didn't use Basic Authentication so the command as being used would not work. May have to build a complex check using the Web Transaction Wizards, or something more complicated
Re: Monitoring a website and expected content
Posted: Thu Apr 05, 2018 10:46 am
by emartine
I used the web transaction wizard and ensured that the stanzas were closed. But there still appears to be an issue.
There is a line that says could not find ParserDetails.ini in /usr/lib64/perl5/XML/SAX
./webinject.pl -c filename_config.xml
Starting WebInject Engine...
-------------------------------------------------------
could not find ParserDetails.ini in /usr/lib64/perl5/XML/SAX
Test: filename_test.xml - 1
Login page
Passed HTTP Response Code Verification (not in error range)
TEST CASE PASSED
Response Time = 0.907 sec
-------------------------------------------------------
Test: filename_test.xml - 2
Sign in
Passed HTTP Response Code Verification (not in error range)
TEST CASE PASSED
Response Time = 0.853 sec
-------------------------------------------------------
Start Time: Thu Apr 5 10:36:56 2018
Total Run Time: 1.816 seconds
Test Cases Run: 2
Test Cases Passed: 2
Test Cases Failed: 0
Verifications Passed: 2
Verifications Failed: 0
Is there a way to verify that the check is working correctly?
Re: Monitoring a website and expected content
Posted: Thu Apr 05, 2018 11:39 am
by scottwilkerson
This looks correct.
emartine wrote:There is a line that says could not find ParserDetails.ini in /usr/lib64/perl5/XML/SAX
you may just need to re-install the package
emartine wrote:
Is there a way to verify that the check is working correctly?
Best way I can think of is have it test for something that shouldn't exist and see if it fails one of the steps, or give it bad credentials and it should fail the login
Re: Monitoring a website and expected content
Posted: Thu Apr 05, 2018 4:30 pm
by emartine
Even with credentials reworded all tests pass.