Monitoring Javascript HTML pages from plugin

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Post Reply
wneville
Posts: 60
Joined: Wed Mar 31, 2021 3:35 pm

Monitoring Javascript HTML pages from plugin

Post by wneville »

Hello,

Is there an official plugin that monitors webpages running Javascript HTML? I am looking to monitor about 700 urls for my colleagues. When I run check_http on these URLs, they return 200 OK regardless of the URL extension and the body says "You need to enable JavaScript to run this app."

For example, one of the URL extensions is .../summary/11 - the returned HTML says:

Code: Select all

   
    <title>Workflows</title>
  </head>
  <body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>
    <!--
      This HTML file is a template.
      If you open it directly in the browser, you will see an empty page.

      You can add webfonts, meta tags, or analytics to this file.
      The build step will place the bundled scripts into the <body> tag.

      To begin the development, run `npm start` or `yarn start`.
      To create a production bundle, use `npm run build` or `yarn build`.
    -->
(note: when I open this page in a browser, it loads content; it is not an empty page)

When I enter ..../summary/bad-extension, I get the same HTML response - I am not sure why the bad-extension URL isn't giving a 404

Could I use the webinject script for this? I am not positive but I think this might be deprecated? Any other insights into how I might monitor the content of these pages, or accurately retrieve HTTP status codes, is greatly appreciated.
User avatar
lgute
Posts: 118
Joined: Mon Apr 06, 2020 2:49 pm

Re: Monitoring Javascript HTML pages from plugin

Post by lgute »

Hi @wneville, thanks for reaching out.

This post may help you, viewtopic.php?t=62069
Please let us know if you have any other questions or concerns.

-Laura
wneville
Posts: 60
Joined: Wed Mar 31, 2021 3:35 pm

Re: Monitoring Javascript HTML pages from plugin

Post by wneville »

Thanks Laura,

Unfortunately I'm not sure if either solution from the other forum thread will work here. From the post you linked: "webinject doesn't run the javascript on the page, you can post and read returned information but it won't run the javascript." Not only this but the URLs I am looking to monitor are deployed within a VPC which appears to be blocking webinject :(

Selenium was the alternative suggested, I don't think it is possible to deploy NCPA to the VPC so I might be out of luck
User avatar
jmichaelson
Posts: 120
Joined: Wed Aug 23, 2023 1:02 pm

Re: Monitoring Javascript HTML pages from plugin

Post by jmichaelson »

You may want to have a look at something like Cypress (https://www.cypress.io/). Its similar to Selenium, in that its a web testing framework. I'm only suggesting it as I'm far mora familiar with it. You may have to set up a separate system that you could run the testing framework on which would execute the javascript as though it were running in a browser (because under Cypress, at least, it is). Set up an automated test for whatever you're expecting to load on the page, and report the status of the test back as the result.
Please let us know if you have any other questions or concerns.

-Jason
Post Reply