Skip to content

Commit a45bf7e

Browse files
committed
rrd monitoring support
1 parent b2db73c commit a45bf7e

File tree

10 files changed

+846
-0
lines changed

10 files changed

+846
-0
lines changed

bin/v_upd_sys_rrd_ftp

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/bin/bash
2+
# info: updating ftp rrd
3+
4+
#----------------------------------------------------------#
5+
# Variable&Function #
6+
#----------------------------------------------------------#
7+
8+
# Importing variables
9+
source $VESTA/conf/vars.conf
10+
source $V_CONF/vesta.conf
11+
12+
13+
#----------------------------------------------------------#
14+
# Action #
15+
#----------------------------------------------------------#
16+
17+
# Checking directory
18+
if [ ! -d "$V_RRD/ftp" ]; then
19+
mkdir $V_RRD/ftp
20+
fi
21+
22+
# Checking database
23+
if [ ! -e "$V_RRD/ftp/ftp.rrd" ]; then
24+
# Adding database
25+
rrdtool create $V_RRD/ftp/ftp.rrd --step $V_RRD_STEP \
26+
DS:A:GAUGE:600:U:U \
27+
RRA:AVERAGE:0.5:1:600 \
28+
RRA:AVERAGE:0.5:6:700 \
29+
RRA:AVERAGE:0.5:24:775 \
30+
RRA:AVERAGE:0.5:288:797 \
31+
RRA:MAX:0.5:1:600 \
32+
RRA:MAX:0.5:6:700 \
33+
RRA:MAX:0.5:24:775 \
34+
RRA:MAX:0.5:288:797
35+
fi
36+
37+
# Parsing data
38+
a=0
39+
a=$(ps aux |grep $FTP_SYSTEM |grep -v grep| grep -v nobody| grep -v root|wc -l)
40+
41+
# Updating rrd database
42+
rrdtool update $V_RRD/ftp/ftp.rrd N:$a
43+
44+
# Updating daily graph
45+
rrdtool graph $V_RRD/ftp/ftp.png \
46+
--imgformat PNG \
47+
--height="120" \
48+
--width="440" \
49+
--start -1d \
50+
--end now \
51+
--title "$(echo $FTP_SYSTEM|tr '[a-z]' '[A-Z]') Usage" \
52+
--vertical-label "Connections" \
53+
--x-grid MINUTE:30:HOUR:1:HOUR:4:0:%H:%M\
54+
-c "BACK#484439" \
55+
-c "SHADEA#484439" \
56+
-c "SHADEB#484439" \
57+
-c "FONT#DDDDDD" \
58+
-c "CANVAS#202020" \
59+
-c "GRID#666666" \
60+
-c "MGRID#AAAAAA" \
61+
-c "FRAME#202020" \
62+
-c "ARROW#FFFFFF" \
63+
DEF:a=$V_RRD/ftp/ftp.rrd:A:AVERAGE \
64+
COMMENT:'\r' \
65+
LINE1:a#fefda0:"Users " \
66+
GPRINT:a:'LAST:Current\:''%8.0lf' \
67+
GPRINT:a:'MIN:Min\:''%8.0lf' \
68+
GPRINT:a:'MAX:Max\:''%8.0lf\j' > /dev/null
69+
70+
71+
#----------------------------------------------------------#
72+
# Vesta #
73+
#----------------------------------------------------------#
74+
75+
# No Logging
76+
#log_event 'system' "$V_EVENT"
77+
78+
exit $OK

bin/v_upd_sys_rrd_httpd

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#!/bin/bash
2+
# info: updating httpd rrd
3+
4+
#----------------------------------------------------------#
5+
# Variable&Function #
6+
#----------------------------------------------------------#
7+
8+
# Importing variables
9+
source $VESTA/conf/vars.conf
10+
source $V_CONF/vesta.conf
11+
source $V_FUNC/shared_func.sh
12+
source $V_FUNC/domain_func.sh
13+
14+
15+
#----------------------------------------------------------#
16+
# Action #
17+
#----------------------------------------------------------#
18+
19+
# Checking directory
20+
if [ ! -d "$V_RRD/web" ]; then
21+
mkdir $V_RRD/web
22+
fi
23+
24+
# Checking database
25+
if [ ! -e "$V_RRD/web/httpd.rrd" ]; then
26+
# Adding database
27+
rrdtool create $V_RRD/web/httpd.rrd --step $V_RRD_STEP \
28+
DS:A:GAUGE:600:U:U \
29+
RRA:AVERAGE:0.5:1:600 \
30+
RRA:AVERAGE:0.5:6:700 \
31+
RRA:AVERAGE:0.5:24:775 \
32+
RRA:AVERAGE:0.5:288:797 \
33+
RRA:MAX:0.5:1:600 \
34+
RRA:MAX:0.5:6:700 \
35+
RRA:MAX:0.5:24:775 \
36+
RRA:MAX:0.5:288:797
37+
fi
38+
39+
# 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))
49+
50+
# Updating rrd database
51+
rrdtool update $V_RRD/web/httpd.rrd N:$a
52+
53+
# Updating daily graph
54+
rrdtool graph $V_RRD/web/httpd.png \
55+
--imgformat PNG \
56+
--height="120" \
57+
--width="440" \
58+
--start -1d \
59+
--end now \
60+
--title "HTTPD Usage" \
61+
--vertical-label "Connections" \
62+
--x-grid MINUTE:30:HOUR:1:HOUR:4:0:%H:%M\
63+
-c "BACK#484439" \
64+
-c "SHADEA#484439" \
65+
-c "SHADEB#484439" \
66+
-c "FONT#DDDDDD" \
67+
-c "CANVAS#202020" \
68+
-c "GRID#666666" \
69+
-c "MGRID#AAAAAA" \
70+
-c "FRAME#202020" \
71+
-c "ARROW#FFFFFF" \
72+
DEF:a=$V_RRD/web/httpd.rrd:A:AVERAGE \
73+
COMMENT:'\r' \
74+
LINE1:a#fefda0:"Connections " \
75+
GPRINT:a:'LAST:Current\:''%8.0lf' \
76+
GPRINT:a:'MIN:Min\:''%8.0lf' \
77+
GPRINT:a:'MAX:Max\:''%8.0lf\j' > /dev/null
78+
79+
80+
#----------------------------------------------------------#
81+
# Vesta #
82+
#----------------------------------------------------------#
83+
84+
# No Logging
85+
#log_event 'system' "$V_EVENT"
86+
87+
exit $OK

bin/v_upd_sys_rrd_la

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/bin/bash
2+
# info: updating load average rrd
3+
4+
#----------------------------------------------------------#
5+
# Variable&Function #
6+
#----------------------------------------------------------#
7+
8+
# Importing variables
9+
source $VESTA/conf/vars.conf
10+
11+
12+
#----------------------------------------------------------#
13+
# Action #
14+
#----------------------------------------------------------#
15+
16+
# Checking directory
17+
if [ ! -d "$V_RRD/la" ]; then
18+
mkdir $V_RRD/la
19+
fi
20+
21+
# Checking database
22+
if [ ! -e "$V_RRD/la/la.rrd" ]; then
23+
# Adding database
24+
rrdtool create $V_RRD/la/la.rrd --step $V_RRD_STEP \
25+
DS:LA:GAUGE:600:U:U \
26+
DS:PR:GAUGE:600:U:U \
27+
RRA:AVERAGE:0.5:1:600 \
28+
RRA:AVERAGE:0.5:6:700 \
29+
RRA:AVERAGE:0.5:24:775 \
30+
RRA:AVERAGE:0.5:288:797 \
31+
RRA:MAX:0.5:1:600 \
32+
RRA:MAX:0.5:6:700 \
33+
RRA:MAX:0.5:24:775 \
34+
RRA:MAX:0.5:288:797
35+
fi
36+
37+
# Parsing data
38+
loadavg=$(cat /proc/loadavg )
39+
la=$(echo "$loadavg"|cut -f 2 -d ' ')
40+
pr=$(echo "$loadavg"|cut -f 4 -d ' '|cut -f 2 -d /)
41+
42+
# Updating rrd database
43+
rrdtool update $V_RRD/la/la.rrd N:${la//./}:$pr
44+
45+
# Updating daily graph
46+
rrdtool graph $V_RRD/la/la.png \
47+
--imgformat PNG \
48+
--height="120" \
49+
--width="440" \
50+
--start -1d \
51+
--end now \
52+
--title "Load Average" \
53+
--vertical-label "Points" \
54+
--x-grid MINUTE:30:HOUR:1:HOUR:4:0:%H:%M\
55+
-c "BACK#484439" \
56+
-c "SHADEA#484439" \
57+
-c "SHADEB#484439" \
58+
-c "FONT#DDDDDD" \
59+
-c "CANVAS#202020" \
60+
-c "GRID#666666" \
61+
-c "MGRID#AAAAAA" \
62+
-c "FRAME#202020" \
63+
-c "ARROW#FFFFFF" \
64+
DEF:la=$V_RRD/la/la.rrd:LA:AVERAGE \
65+
DEF:pr=$V_RRD/la/la.rrd:PR:AVERAGE \
66+
COMMENT:'\r' \
67+
AREA:la#9fec00:"LA * 100"\
68+
GPRINT:la:'LAST: Current\:''%8.0lf' \
69+
GPRINT:la:'MIN: Min\:''%8.0lf' \
70+
GPRINT:la:'MAX: Max\:''%8.0lf\j' \
71+
LINE1:pr#1c74cd:"Procs # " \
72+
GPRINT:pr:'LAST:Current\:''%8.0lf' \
73+
GPRINT:pr:'MIN:Min\:''%8.0lf' \
74+
GPRINT:pr:'MAX:Max\:''%8.0lf\j' >/dev/null
75+
76+
77+
#----------------------------------------------------------#
78+
# Vesta #
79+
#----------------------------------------------------------#
80+
81+
# No Logging
82+
#log_event 'system' "$V_EVENT"
83+
84+
exit $OK

bin/v_upd_sys_rrd_mem

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/bin/bash
2+
# info: updating memory rrd
3+
4+
#----------------------------------------------------------#
5+
# Variable&Function #
6+
#----------------------------------------------------------#
7+
8+
# Importing variables
9+
source $VESTA/conf/vars.conf
10+
11+
12+
#----------------------------------------------------------#
13+
# Action #
14+
#----------------------------------------------------------#
15+
16+
# Checking directory
17+
if [ ! -d "$V_RRD/mem" ]; then
18+
mkdir $V_RRD/mem
19+
fi
20+
21+
# Checking database
22+
if [ ! -e "$V_RRD/mem/mem.rrd" ]; then
23+
# Adding database
24+
rrdtool create $V_RRD/mem/mem.rrd --step $V_RRD_STEP \
25+
DS:RAM:GAUGE:600:U:U \
26+
DS:SWAP:GAUGE:600:U:U \
27+
RRA:AVERAGE:0.5:1:600 \
28+
RRA:AVERAGE:0.5:6:700 \
29+
RRA:AVERAGE:0.5:24:775 \
30+
RRA:AVERAGE:0.5:288:797 \
31+
RRA:MAX:0.5:1:600 \
32+
RRA:MAX:0.5:6:700 \
33+
RRA:MAX:0.5:24:775 \
34+
RRA:MAX:0.5:288:797
35+
fi
36+
37+
# Parsing data
38+
mem=$(free -m)
39+
ram=$(echo "$mem" |awk '{print $3}'|head -n2 |tail -n1)
40+
swap=$(echo "$mem" |awk '{print $3}'|tail -n1)
41+
42+
# Updating rrd
43+
rrdtool update $V_RRD/mem/mem.rrd N:$ram:$swap
44+
45+
# Updating daily graph
46+
rrdtool graph $V_RRD/mem/mem.png \
47+
--imgformat PNG \
48+
--height="120" \
49+
--width="440" \
50+
--start -1d \
51+
--end now \
52+
--title "Memory Usage" \
53+
--vertical-label "Mbytes" \
54+
--x-grid MINUTE:30:HOUR:1:HOUR:4:0:%H:%M\
55+
-c "BACK#484439" \
56+
-c "SHADEA#484439" \
57+
-c "SHADEB#484439" \
58+
-c "FONT#DDDDDD" \
59+
-c "CANVAS#202020" \
60+
-c "GRID#666666" \
61+
-c "MGRID#AAAAAA" \
62+
-c "FRAME#202020" \
63+
-c "ARROW#FFFFFF" \
64+
DEF:ram=$V_RRD/mem/mem.rrd:RAM:AVERAGE \
65+
DEF:swap=$V_RRD/mem/mem.rrd:SWAP:AVERAGE \
66+
COMMENT:'\r' \
67+
AREA:ram#867995:"RAM "\
68+
GPRINT:ram:'LAST: Current\:''%8.0lf' \
69+
GPRINT:ram:'MIN: Min\:''%8.0lf' \
70+
GPRINT:ram:'MAX: Max\:''%8.0lf\j' \
71+
LINE1:swap#f57900:"SWAP" \
72+
GPRINT:swap:'LAST:Current\:''%8.0lf' \
73+
GPRINT:swap:'MIN:Min\:''%8.0lf' \
74+
GPRINT:swap:'MAX:Max\:''%8.0lf\j' > /dev/null
75+
76+
77+
#----------------------------------------------------------#
78+
# Vesta #
79+
#----------------------------------------------------------#
80+
81+
# No Logging
82+
#log_event 'system' "$V_EVENT"
83+
84+
exit $OK

0 commit comments

Comments
 (0)