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?


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.


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.


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.


An Update on how I have solved my problem.

I do 2 checks.
The first one is to check if the HEAD of the server response contains “HTTP/1.1 200”. I do that with “http_expect”.
The second check is a filter of a json file, which the site delivers and that contains all the data that is presented on the page. With the filter can specify a number of filtered values I expect to get an OK.
The check is a python script found here: check-json · PyPI