|
|
@@ -6,21 +6,27 @@
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
# Argument defenition
|
|
|
-rrd_start=${1--1d}
|
|
|
-rrd_end=${2-now}
|
|
|
-rrd_grid=${3-MINUTE:30:HOUR:1:HOUR:4:0:%H:%M}
|
|
|
+update=$1
|
|
|
+period=${1-daily}
|
|
|
|
|
|
# Importing variables
|
|
|
source $VESTA/conf/vars.conf
|
|
|
-source $V_CONF/vesta.conf
|
|
|
-source $V_FUNC/shared.func
|
|
|
-source $V_FUNC/domain.func
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
# Action #
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
+# Switching on time period
|
|
|
+case $period in
|
|
|
+ daily) start='-1d'; end='now'; grid='MINUTE:30:HOUR:1:HOUR:4:0:%H:%M';;
|
|
|
+ weekly) start='-7d'; end='now'; grid='HOUR:8:DAY:1:DAY:1:0:%a %d';;
|
|
|
+ monthly) start='-1m'; end='now'; grid='WEEK:1:WEEK:1:WEEK:1:0:%b %d';;
|
|
|
+ yearly) start='-1y'; end='now'; grid='MONTH:1:YEAR:1:MONTH:2:2419200:%b';;
|
|
|
+ *) exit $E_RRD_FAILED ;;
|
|
|
+esac
|
|
|
+
|
|
|
+
|
|
|
# Checking directory
|
|
|
if [ ! -d "$V_RRD/web" ]; then
|
|
|
mkdir $V_RRD/web
|
|
|
@@ -42,9 +48,8 @@ if [ ! -e "$V_RRD/web/httpd.rrd" ]; then
|
|
|
fi
|
|
|
|
|
|
# Parsing data
|
|
|
-if [ -z "$1" ]; then
|
|
|
- web_port=$(get_config_value '$WEB_PORT')
|
|
|
- server_status=$(wget -qO- http://localhost:$web_port/server-status |\
|
|
|
+if [ -z "$update" ]; then
|
|
|
+ server_status=$(wget -qO- http://localhost:$WEB_PORT/server-status |\
|
|
|
grep 'currently being processed'| \
|
|
|
cut -f 2 -d '>' |\
|
|
|
sed 's/requests currently being processed, //' | \
|
|
|
@@ -58,15 +63,15 @@ if [ -z "$1" ]; then
|
|
|
fi
|
|
|
|
|
|
# Updating rrd graph
|
|
|
-rrdtool graph $V_RRD/web/httpd.png \
|
|
|
+rrdtool graph $V_RRD/web/$period-httpd.png \
|
|
|
--imgformat PNG \
|
|
|
--height="120" \
|
|
|
--width="440" \
|
|
|
- --start "$rrd_start" \
|
|
|
- --end "$rrd_end" \
|
|
|
- --title "HTTPD Usage" \
|
|
|
+ --start "$start" \
|
|
|
+ --end "$end" \
|
|
|
+ --title "HTTPD Usage ($period)" \
|
|
|
--vertical-label "Connections" \
|
|
|
- --x-grid "$rrd_grid" \
|
|
|
+ --x-grid "$grid" \
|
|
|
-c "BACK#484439" \
|
|
|
-c "SHADEA#484439" \
|
|
|
-c "SHADEB#484439" \
|