Add Phantomjs' loadspeed.js to notification

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
nirvana86
Posts: 3
Joined: Mon Dec 15, 2014 12:44 pm

Add Phantomjs' loadspeed.js to notification

Post 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
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Add Phantomjs' loadspeed.js to notification

Post 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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
nirvana86
Posts: 3
Joined: Mon Dec 15, 2014 12:44 pm

Re: Add Phantomjs' loadspeed.js to notification

Post 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
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Add Phantomjs' loadspeed.js to notification

Post 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/
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
nirvana86
Posts: 3
Joined: Mon Dec 15, 2014 12:44 pm

Re: Add Phantomjs' loadspeed.js to notification

Post by nirvana86 »

Thank you sir. I'm already enlightened. :)
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Add Phantomjs' loadspeed.js to notification

Post 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.
Former Nagios employee
mickeyncube
Posts: 2
Joined: Tue Apr 21, 2015 9:00 am

Re: Add Phantomjs' loadspeed.js to notification

Post 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.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Add Phantomjs' loadspeed.js to notification

Post 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
Former Nagios employee
mickeyncube
Posts: 2
Joined: Tue Apr 21, 2015 9:00 am

Re: Add Phantomjs' loadspeed.js to notification

Post 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
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: Add Phantomjs' loadspeed.js to notification

Post 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!
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
Locked