Monitor webpage with embedded dynamic content on a webpage

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
sguederian
Posts: 3
Joined: Fri Feb 14, 2020 12:32 pm

Monitor webpage with embedded dynamic content on a webpage

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

Re: Monitor webpage with embedded dynamic content on a webpa

Post 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.
Former Nagios employee
https://www.mcapra.com/
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: Monitor webpage with embedded dynamic content on a webpa

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
sguederian
Posts: 3
Joined: Fri Feb 14, 2020 12:32 pm

Re: Monitor webpage with embedded dynamic content on a webpa

Post 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.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Monitor webpage with embedded dynamic content on a webpa

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
sguederian
Posts: 3
Joined: Fri Feb 14, 2020 12:32 pm

Re: Monitor webpage with embedded dynamic content on a webpa

Post by sguederian »

Ok, Ill try again
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: Monitor webpage with embedded dynamic content on a webpa

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked