plugin w wget to check website can't interpret javascript

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
lyle
Posts: 158
Joined: Sun Nov 21, 2010 3:05 am

plugin w wget to check website can't interpret javascript

Post by lyle »

This is a long-shot, but maybe someone here has some advice.

For years, we've happily used a plugin that's a shell script that calls wget. The wget logs in to our website, navigates to a test account page, and the script ensures website functionality by grep-ing the returned html for expected strings.

That was all fine until the website redesign, which uses jsf/ajax in the design. Now, evidently, the page expects the browser to interpret javascript. But poor wget is just made to scrape a page and return the results, not interpret javascript.

So i think I need some other tool. I'm looking through available Nagios plugins, but not too hopeful.

Any advice is appreciated. Thanks....Lyle
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: plugin w wget to check website can't interpret javascrip

Post by nscott »

I've beat my head against this problem and I haven't found a way to get wget or cURL to start rendering Javascript. The only thing I've found that does what you might want to accomplish is PhantomJS, whose homepage is located here:

http://phantomjs.org/index.html

Give it a shot, I believe this is easiest way you will find to get a page to render Javascript for you.
Nicholas Scott
Former Nagios employee
lyle
Posts: 158
Joined: Sun Nov 21, 2010 3:05 am

Re: plugin w wget to check website can't interpret javascrip

Post by lyle »

Thanks, I'll try PhantomJS.

In the meantime the quickest solution seemed to be a Windows VM running Firefox. The iMacros plug in allows a macro script to be run, and a scheduled windows task fires this off. The html file that results has all the javascript/ajax rendering done by Firefox. Then an nrpe check greps the downloaded html file for what we're looking for. Another nrpe check makes sure that the downloaded file is reasonably current. But that's all a lot of moving parts.

A headless browser like PhantomJS would reduce the complication.

...Lyle
Locked