:
Bash plugin to measure the website response speed including the following metrics:
– Time to First Byte
– Total load time
– Pre-transfer time
– Response HTTP code
– Page total size
Author: Manuel Angel Fernandez
His blog: http://rastreador.com.es/
Module data
#!/bin/bash
# Page Speed Plugin Pandora FMS Server plugin
# (c) Manuel Angel Fernandez 2012
function help { echo -e "Page Speed Plugin for Pandora FMS Plugin server. http://pandorafms.com" echo " " echo "This plugin is used to check page speed and Time to First Time" echo " " echo -e "Syntax:" echo -e "\t\t-f Time to First Byte" echo -e "\t\t-t Total time" echo -e "\t\t-p Pretransfer time" echo -e "\t\t-c Http status code" echo -e "\t\t-s Size download(Kb)" echo -e "\t\t-a All parameters csv format" echo -e "\t\t-h This help" echo -e "Samples:" echo " ./page_speed -f www.yahoo.com" echo " " echo "by Manuel Angel Fernandez – manuel at rastreador.com.es" echo " " exit } if [ $# -eq 0 ] then help fi # Main parsing code while getopts ":h:f:t:p:c::s:a:" optname do case "$optname" in "h") help ;; "f") curl -so /dev/null -H "Pragma: no-cache" -H "Cache-Control: no-cache" -w "%{time_starttransfer}\n" "$OPTARG?`date +%s`" exit 0 ;; "t") curl -so /dev/null -H "Pragma: no-cache" -H "Cache-Control: no-cache" -w "%{time_total}\n" "$OPTARG?`date +%s`" exit 0 ;; "p") curl -so /dev/null -H "Pragma: no-cache" -H "Cache-Control: no-cache" -w "%{time_pretransfer}\n" "$OPTARG?`date +%s`" exit 0 ;; "c") curl -so /dev/null -H "Pragma: no-cache" -H "Cache-Control: no-cache" -w "%{http_code}\n" "$OPTARG?`date +%s`" exit 0 ;; "s") curl -so /dev/null -H "Pragma: no-cache" -H "Cache-Control: no-cache" -w "%{size_download}\n" "$OPTARG?`date +%s`" exit 0 ;; "a") curl -so /dev/null -H "Pragma: no-cache" -H "Cache-Control: no-cache" -w "Timetofirstbyte\tTotal-Time\tPretransfer-time\tHttp-code\tdownload-size\n%{time_starttransfer}\t%{time_total}\t%{time_pretransfer}\t%{http_code}\t%{size_download}\n" "$OPTARG?`date +%s`" exit 0 ;; ?) help ;; default) help ;; esac done
(Visited 631 times, 1 visits today)