String check on website with JS

Hello everyone,

I want to check if my website is up by search a string on that site, using the check_http plugin.

However the website is loading its content with (I believe) javascript so the string I define under “http_string” can not be found. The only content that the plugin can read is the node
“You need to enable JavaScript to run this app.”.

Is there an option I am missing or which method could I use to do this check?

Ano

How about creating a single HTML (non-Javascript) page for Icinga to check,
which isn’t linked from anywhere else, and contains a nice unique string which
wouldn’t be found on other pages?

Either that, or tell whatever CMS you’re using to build the website that you’d
like to be friendly to non-Javascript browsers too, and give it some plain
HTML content.

Antony.

1 Like

Thanks for the suggestion Anthony,

but isn’t the purpose of the check_http plugin to check, whether the site I intend for users to see is up or not?
And a mistake on my part here, it is not exactly “my website” but rather a site the developers of my company have created for our customer, which has to be checked if it is available or not.

Ano

Try to use the developer tools of your browser and watch for communications of the java script with the back end. If you’r lucky, you can simulate the call and watch for the response with check_http. If this fails you will soon be at a point where you want to use test robots that run a zombified browser - I once did a poc with python and selenium GitHub - objectified/selmon: Nagios monitoring using Selenium / Webdriver.

2 Likes