55# Variable&Function #
66# ----------------------------------------------------------#
77
8+ # Argument defenition
9+ rrd_start=" ${1--1d} "
10+ rrd_end=" ${2-now} "
11+ rrd_grid=" ${3-MINUTE: 30: HOUR: 1: HOUR: 4: 0:% H:% M} "
12+
813# Importing variables
914source $VESTA /conf/vars.conf
1015source $V_CONF /vesta.conf
@@ -37,29 +42,31 @@ if [ ! -e "$V_RRD/web/httpd.rrd" ]; then
3742fi
3843
3944# Parsing data
40- web_port=$( get_config_value ' $WEB_PORT' )
41- server_status=$( wget -qO- http://localhost:$web_port /server-status | \
42- grep ' currently being processed' | \
43- cut -f 2 -d ' >' | \
44- sed ' s/requests currently being processed, //' | \
45- cut -f 1,2 -d ' ' )
46- active=$( echo " $server_status " | cut -f 1 -d ' ' )
47- idle=$( echo " $server_status " | cut -f 1 -d ' ' )
48- a=$(( active + idle))
45+ if [ -z " $1 " ]; then
46+ web_port=$( get_config_value ' $WEB_PORT' )
47+ server_status=$( wget -qO- http://localhost:$web_port /server-status | \
48+ grep ' currently being processed' | \
49+ cut -f 2 -d ' >' | \
50+ sed ' s/requests currently being processed, //' | \
51+ cut -f 1,2 -d ' ' )
52+ active=$( echo " $server_status " | cut -f 1 -d ' ' )
53+ idle=$( echo " $server_status " | cut -f 1 -d ' ' )
54+ a=$(( active + idle))
4955
50- # Updating rrd database
51- rrdtool update $V_RRD /web/httpd.rrd N:$a
56+ # Updating rrd database
57+ rrdtool update $V_RRD /web/httpd.rrd N:$a
58+ fi
5259
53- # Updating daily graph
60+ # Updating rrd graph
5461rrdtool graph $V_RRD /web/httpd.png \
5562 --imgformat PNG \
5663 --height=" 120" \
5764 --width=" 440" \
58- --start -1d \
59- --end now \
65+ --start " $rrd_start " \
66+ --end " $rrd_end " \
6067 --title " HTTPD Usage" \
6168 --vertical-label " Connections" \
62- --x-grid MINUTE:30:HOUR:1:HOUR:4:0:%H:%M \
69+ --x-grid " $rrd_grid " \
6370 -c " BACK#484439" \
6471 -c " SHADEA#484439" \
6572 -c " SHADEB#484439" \
@@ -74,14 +81,15 @@ rrdtool graph $V_RRD/web/httpd.png \
7481 LINE1:a#fefda0:" Connections " \
7582 GPRINT:a:' LAST:Current\:' ' %8.0lf' \
7683 GPRINT:a:' MIN:Min\:' ' %8.0lf' \
77- GPRINT:a:' MAX:Max\:' ' %8.0lf\j' > /dev/null
84+ GPRINT:a:' MAX:Max\:' ' %8.0lf\j' > /dev/null 2> /dev/null; result= $?
7885
7986
8087# ----------------------------------------------------------#
8188# Vesta #
8289# ----------------------------------------------------------#
8390
84- # No Logging
85- # log_event 'system' "$V_EVENT"
91+ if [ " $result " -ne 0 ]; then
92+ exit $E_RRD_FAILED
93+ fi
8694
8795exit $OK
0 commit comments