Page 1 of 1

Monitor webpage with embedded dynamic content on a webpage

Posted: Fri Feb 14, 2020 12:45 pm
by sguederian
Hello,

We have a webpage that displays embedded dynamic charts that we need to monitor to make sure they are always up.

I am able to use the check_form_plugin and check for a specific word on the webpage but Nagios is only able to find words on the "main" webpage, which is good to make sure the main page is up (which we are doing) but not the embedded chart (which also does have words that are selectable so therefore should be searchable).

Is there a way (maybe another plugin) I can use to monitor and make sure those charts are up ?

My developers said if I am able to check to see if the "http class" is loaded, then we know the chart is loaded.

Thank you,
Serge

Re: Monitor webpage with embedded dynamic content on a webpa

Posted: Fri Feb 14, 2020 1:22 pm
by mcapra
sguederian wrote:My developers said if I am able to check to see if the "http class" is loaded, then we know the chart is loaded.
Not 100% sure what they mean by this.

If you just want to see if the content of an HTTP page contains an object with class="http", check_http can do that:

Code: Select all

# /usr/local/nagios/libexec/check_http -H www.basicwebsiteexample.com -s 'class="js-webfont"'
HTTP OK: HTTP/1.1 200 OK - 93221 bytes in 0.574 second response time |time=0.574059s;;;0.000000 size=93221B;;;0
# /usr/local/nagios/libexec/check_http -H www.basicwebsiteexample.com -s 'class="some-other-class"'
HTTP CRITICAL: HTTP/1.1 200 OK - string 'class="some-other-class"' not found on 'http://www.basicwebsiteexample.com:80/' - 93221 bytes in 0.573 second response time |time=0.572554s;;;0.000000 size=93221B;;;0
Your Nagios XI installation should have the check_http plugin available, and some configuration wizards if what I've shared above looks like Greek to you:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf

If you're following the Website URL configuration wizard, you can provide a string or regex to match on the page that you're checking.

Re: Monitor webpage with embedded dynamic content on a webpa

Posted: Fri Feb 14, 2020 1:47 pm
by mbellerue
Hi sguederian, welcome to the forum!

In this case, it may be helpful to see the source code of the page from your browser's perspective. If you can load the page, right click, view source, dump the code into a text file, and send it to me, that would be great. Also if you could include a screenshot of what the page looks like. That way I will be able to line up the code and the screenshot.

If you don't want to post it publicly, you can PM it to me.

Re: Monitor webpage with embedded dynamic content on a webpa

Posted: Fri Feb 14, 2020 2:41 pm
by sguederian
Thanks mbellerue,

The page I am trying to monitor requires a login first. It is https://analytics.bcaresearch.com/chart ... 9_05_13_c1

I don't think I can use check_http in this case because it is expecting a hostname only.

I can't seem to PM you to give you more details... if you let me know how I can PM you, I can send you a dump of the code.

Thanks.

Re: Monitor webpage with embedded dynamic content on a webpa

Posted: Fri Feb 14, 2020 3:08 pm
by benjaminsmith
Hello @squederian,
I can't seem to PM you to give you more details... if you let me know how I can PM you, I can send you a dump of the code.
Try sending this once more, I believe you need at least 2 posts to be able to send a PM.

Benjamin

Re: Monitor webpage with embedded dynamic content on a webpa

Posted: Mon Feb 17, 2020 1:44 pm
by sguederian
Ok, Ill try again

Re: Monitor webpage with embedded dynamic content on a webpa

Posted: Mon Feb 17, 2020 3:28 pm
by mbellerue
Okay I received the PM, and I've been looking at the page source. But in the page source, the string your devs said should be there does not seem to show up. That may be the problem that Nagios is running into. Do you know if the content is embedded via JavaScript? I know we've talked to a couple other people who have had issues with some JavaScript heavy pages.