Page 1 of 1

Add Phantomjs' loadspeed.js to notification

Posted: Mon Dec 15, 2014 12:51 pm
by nirvana86
Hi, can you help me on my problem on Phantomjs' loadspeed.js to be added in notificationwhether it is warning or critical?
here's the link https://github.com/ariya/phantomjs/blob ... adspeed.js

here's the sample:

/etc/nagios3# phantomjs loadspeed.js http://nagios.org
Page title is Nagios - The Industry Standard in IT Infrastructure Monitoring
Loading time 5293 msec

How can I make the 5293 msec result if the output is more than 4 then it will go critical?

Thank you

Re: Add Phantomjs' loadspeed.js to notification

Posted: Mon Dec 15, 2014 1:11 pm
by sreinhardt
It doesn't appear that you can. This script is not intended as a nagios plugin. It has no support for thresholds, or different exit codes.

Re: Add Phantomjs' loadspeed.js to notification

Posted: Mon Dec 15, 2014 2:25 pm
by nirvana86
Thank you for the prompt reply sir sreinhardt.
Do you have in mind a nagios plugin that can help to my problem on monitoring a site's page load time?

Thank you

Re: Add Phantomjs' loadspeed.js to notification

Posted: Mon Dec 15, 2014 2:32 pm
by sreinhardt
I certainly do! :) Nagios plugins has a check_http that should be able to do just that. The command below should do the trick:

Code: Select all

cd /usr/local/nagios/libexec/
./check_http -H google.com -w 300 -c 400
If you need to request a specific uri, you can append the -U option as well like:

Code: Select all

check_http -H google.com -w 300 -c 400 -u /index.php
There are many other flags and possible checks as with that plugin as well, but if you only wish to check response time, that should do it!

Edit: It looks like you might be on ubuntu or debian, so your path for plugins might be different, most likely /usr/lib/plugins/ or /usr/lib64/plugins/

Re: Add Phantomjs' loadspeed.js to notification

Posted: Mon Dec 15, 2014 3:19 pm
by nirvana86
Thank you sir. I'm already enlightened. :)

Re: Add Phantomjs' loadspeed.js to notification

Posted: Mon Dec 15, 2014 5:12 pm
by tmcdonald
It is worth noting that the check_http plugin will not actually execute the javascript on the page, so if there are some elements that would take some time to be loaded using JS that will not be reflected. check_http will just show how long it takes to get the source of the web page.

Re: Add Phantomjs' loadspeed.js to notification

Posted: Tue Apr 21, 2015 9:12 am
by mickeyncube
Hi guys

I wanted to say Im in the same predicament and would like to monitor website load times. But I wanted to ask if you could provide a step by step guide on how to do it. I installed the plugin and expected to see it in the gui and or dashboard. but there was nothing.
I would like to know how to set the thresholds alerts etc.
looking forward to hearing back from you.

Re: Add Phantomjs' loadspeed.js to notification

Posted: Tue Apr 21, 2015 9:20 am
by tmcdonald
Which plugin are you referring to? The link in the original post is not a plugin, just a script in what appears to be Node.js

Re: Add Phantomjs' loadspeed.js to notification

Posted: Tue Apr 21, 2015 9:30 am
by mickeyncube
Thanks for getting back to me quickly.
The plugin I'm on about is found here
http://exchange.nagios.org/directory/Pl ... ed/details
Or have I got it wrong?
I'm not a developer and don't really understand code as much. But I would like to monitor and set alerts on nagios xi to monitor a few of our websites hosted on AWS. most importantly website page load times

Re: Add Phantomjs' loadspeed.js to notification

Posted: Tue Apr 21, 2015 12:53 pm
by jolson
After installing the plugin, it will be available at /usr/local/nagios/libexec/ in the CLI. Can you find it there? Based on your link it should be called check_website_speed.php. I recommend you run it from the CLI first, to get a hang of the arguments for that plugin.

This guide should be supplemental to the process: http://assets.nagios.com/downloads/nagi ... ios-XI.pdf

Please let us know if you have any questions. Thanks!