rrdtool 实例
原创
©著作权归作者所有:来自51CTO博客作者frostmounre的原创作品,请联系作者获取转载授权,否则将追究法律责任
1.create
vip="55.269.163.168"
/usr/bin/rrdtool create /home/sysadmin/tanzhijun/test_"$vip"_.rrd -s 30 \
DS:ee:GAUGE:60:0:U \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:288:797
2.update&graph
#!/bin/bash
IP="117.15.171.143 211.142.189.231 55.269.163.153 55.269.163.138 55.269.163.168"
rrd_path="/home/sysadmin/tanzhijun"
p_w_picpath_path="/home/sysadmin/tanzhijun/p_w_picpaths"
while :
do
for vip in $IP
do
now=`date +%s`
N=`netstat -ant|awk '/$vip/{print $5}'|wc -l`
/usr/bin/rrdtool update "$rrd_path"/test_"$vip"_.rrd $now:$N
done
/usr/bin/rrdtool graph "$p_w_picpath_path"/apache_visits.png \
-t "$vip apache visits" -s -86400 -e -0 -l 0 -M -h 180 -w 500 -v "test per sec"\
DEF:a1="$rrd_path"/test_117.15.171.143_.rrd:aa:AVERAGE \
DEF:a2="$rrd_path"/test_117.15.171.143_.rrd:aa:MAX \
DEF:b1="$rrd_path"/test_211.142.189.231_.rrd:bb:AVERAGE \
DEF:b2="$rrd_path"/test_211.142.189.231_.rrd:bb:MAX \
DEF:c1="$rrd_path"/test_55.269.163.153_.rrd:cc:AVERAGE \
DEF:c2="$rrd_path"/test_55.269.163.153_.rrd:cc:MAX \
DEF:d1="$rrd_path"/test_55.269.163.138_.rrd:dd:AVERAGE \
DEF:d2="$rrd_path"/test_55.269.163.138_.rrd:dd:MAX \
DEF:e1="$rrd_path"/test_55.269.163.168_.rrd:ee:AVERAGE \
DEF:e2="$rrd_path"/test_55.269.163.168_.rrd:ee:MAX \
LINE1:a1#00FF00FF:"117.15.171.143" \
GPRINT:a1:LAST:"current\:%8.0lf %s" \
GPRINT:a1:AVERAGE:"average\:%8.0lf %s" \
GPRINT:a2:MAX:"maximum\:%8.0lf \n" \
LINE1:b1#EACC00FF:"211.142.189.231" \
GPRINT:b1:LAST:"current\:%8.0lf %s" \
GPRINT:b1:AVERAGE:"average\:%8.0lf %s" \
GPRINT:b2:MAX:"maximum\:%8.0lf \n" \
LINE1:c1#FF0000FF:"55.269.163.153" \
GPRINT:c1:LAST:"current\:%8.0lf %s" \
GPRINT:c1:AVERAGE:"average\:%8.0lf %s" \
GPRINT:c2:MAX:"maximum\:%8.0lf \n" \
LINE1:d1#0000FFFF:"55.269.163.138" \
GPRINT:d1:LAST:"current\:%8.0lf %s" \
GPRINT:d1:AVERAGE:"average\:%8.0lf %s" \
GPRINT:d2:MAX:"maximum\:%8.0lf \n" \
LINE1:e1#F51D30FF:"55.269.163.168" \
GPRINT:e1:LAST:"current\:%8.0lf %s" \
GPRINT:e1:AVERAGE:"average\:%8.0lf %s" \
GPRINT:e2:MAX:"maximum\:%8.0lf \n"
sleep 30
done
下一篇:MySQL 表锁定事宜
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
rrdtool安装
mac 下: 1: sudo brew install rrdtool 2: sudo pip install python-rrdtool ubuntu: 1: sudo apt-rrdtool...
rrd install python ubuntu centos -
rrdtool 详解
最近在开发关于监控的项目,在选择数据存储方面,我想到了RRD ,而且RRD也提供了python API,为了学习方法与使用,推荐大家这篇文章,写的不错,感谢博主分享!
linux python rrdtool rrd -
RRDtool深度理解
RRDtool深入学习介绍RRDtool:Round Robin Database T
使用 原理 rrdtool