Used PhantomJS Nagios plugin on CentOS machine with Nagios installed.
yum install glibc fontconfig freetype freetype-devel fontconfig-devel wget bzip2
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2 -C /usr/local/share/
ln -sf /usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin
phantomjs –version
yum install ruby ruby-devel gcc
gem install json
mkdir page-load-test
cd page-load-test/
git clone https://github.com/hggh/phantomjs-nagios.git
cp check_http_load_time.rb /usr/local/nagios/libexec/
./check_http_load_time.rb --perf -c 60 -w 30 -u http://www.pctags.com -p /usr/local/bin/phantomjs --perf
OK: http://www.pctags.com load time: 0.56 | load_time=556.0ms size=4882 requests=4 dom_elements=23 load_time_initial_req=384ms
define command {
command_name check_http_load_time
command_line $USER1$/check_http_load_time.rb --perf -p /usr/local/bin/phantomjs -u $ARG1$ -w $ARG2$ -c $ARG3$
}
define service {
use local-service
host_name localhost
service_description check_http_load_time www.pctags.com
check_command check_http_load_time!http://www.pctags.com!8!10
notifications_enabled 1
contact_groups admins
}