Révision 17f78427
Whitespace cleanup
- remove trailing whitespace
- remove empty lines at the end of files
| plugins/apache/page_load | ||
|---|---|---|
| 22 | 22 |
# |
| 23 | 23 |
# apache2.conf |
| 24 | 24 |
# LogFormat "%h %l %u %t \"%r\" %>s %O %b %D \"%{Referer}i\" \"%{User-Agent}i\"" custom
|
| 25 |
#
|
|
| 25 |
# |
|
| 26 | 26 |
# According to : http://httpd.apache.org/docs/2.2/mod/mod_log_config.html |
| 27 | 27 |
# %D The time taken to serve the request, in microseconds. |
| 28 | 28 |
# In our case %D -> 9 |
| 29 |
######################################################################################################
|
|
| 29 |
###################################################################################################### |
|
| 30 | 30 |
# GLOBALS |
| 31 | 31 |
LOGFILE="/var/log/apache2/access.log" |
| 32 | 32 |
BUFFER_SIZE=500 |
| 33 | 33 |
|
| 34 | 34 |
###################################################################################################### |
| 35 | 35 |
|
| 36 |
|
|
| 36 |
|
|
| 37 | 37 |
do_ () {
|
| 38 | 38 |
command="tail -n $BUFFER_SIZE $LOGFILE | awk '{sum=sum+\$9} END {print \"exec_time.value \"(sum/$BUFFER_SIZE)/1000000}'"
|
| 39 | 39 |
eval $command |
| 40 | 40 |
exit 0 |
| 41 | 41 |
} |
| 42 |
|
|
| 42 |
|
|
| 43 | 43 |
do_config () {
|
| 44 | 44 |
echo "graph_title Average page execution time" |
| 45 | 45 |
echo "graph_vlabel Seconds" |
| 46 | 46 |
echo "graph_category webserver" |
| 47 | 47 |
echo "graph_args --base 1000 -l 0" |
| 48 | 48 |
echo "graph_info Average page execution time" |
| 49 |
|
|
| 49 |
|
|
| 50 | 50 |
echo "exec_time.label Execution time" |
| 51 | 51 |
echo "exec_time.type GAUGE" |
| 52 | 52 |
} |
| 53 |
|
|
| 53 |
|
|
| 54 | 54 |
case $1 in |
| 55 | 55 |
config|'') |
| 56 | 56 |
eval do_$1 |
| 57 | 57 |
esac |
| 58 |
|
|
| 58 |
|
|
| 59 | 59 |
exit $? |
Formats disponibles : Unified diff