LINUX 监控SNMP培训日记 1 ( RRDTOOL
1. SNMPSNMPWALK / SNMPGET/ snmpnetstat / snmpd.conf
2. RRD ( round robin database )
时间序列数据, 创建时指定时间槽,间隔
PDP : 主数据节点: Primary Data Point ( 临时数据 ) -〉分组计算在保存到时间槽中
CDP : 聚合数据节点( consolidate data point )
有用的数据是RRA : round robin archive DATA
解析度:resolution 时间跨度
一个RRD文件可以保存两个序列,(DATA source )数据源
每个数据源可以定义单独聚合
创建RRD ( rrdtool )
create / update / updatev / graph / info/ rrdresze / xprt / flushcached / rrdcgi
create :set up a new rrd
update : store new data values into an RRD
updatev : operationally equivalent to update except for output
graph :
create a graph from data stored in one or serveral RRDs
Apart from generating graphs, data can also be extracted to stdout
dump : dump the contents of an RRD inplain ASCII. In connection wit restore you can use this to move an RRD from one computer architecture to another
restore : restor an RRDin XML format to a binary RRD
fetch : get data for a certian time period from a RRD.
tune : alter setup of an RRD
last : fetch the last updat time of an RRD
info : get information about an RRD
rrdresize : change the size of individual RRAs
xport : export data retrieved from one or serveral RRDs
flushcached : flush the values for a specific RRD file from memory
rrdcgi : standalone tool for producing RRD graphs on the fly
实例:每5秒产生一个随机数,参看50s和500s的平均值
5秒钟数据保存一天/50s数据保存1周/500s数据保存一个月
rrdtool create {filename} [--start|-b starttime ] [--step | -s step ] [--no-overwrite] [ RRA:CF:cf argumens]
DST : 数据类型-GAUGE/COUNTER/DERIVE/ABSOLUTE/Compute
DST arguments : heartbeat : min : max
CF: 聚合函数:AVERAGE/MIN/MAX/LAST
CF arguments : xff:steps:rows
#> rdtool create test.rrd --step 5 DS:testds:GAUGE:8:0:U RRA:AVERAGE:0.5:10:17280 RRA:AVERAGE:0.5:10:3456 RRA:AVERAGE:0.5:100:1210
#> rrdtool info test.rrd
filename = "test.rrd"
rrd_version = "0003"
step = 5
last_update = 1397123014
ds.type = "GAUGE"
ds.minimal_heartbeat = 8
ds.min = 0.0000000000e+00
ds.max = NaN
ds.last_ds = "U"
ds.value = 0.0000000000e+00
ds.unknown_sec = 4
rra.cf = "AVERAGE"
rra.rows = 17280
rra.cur_row = 11633
rra.pdp_per_row = 10
rra.xff = 5.0000000000e-01
rra.cdp_prep.value = NaN
rra.cdp_prep.unknown_datapoints = 2
rra.cf = "AVERAGE"
rra.rows = 3456
rra.cur_row = 2955
rra.pdp_per_row = 10
rra.xff = 5.0000000000e-01
rra.cdp_prep.value = NaN
rra.cdp_prep.unknown_datapoints = 2
rra.cf = "AVERAGE"
rra.rows = 1210
rra.cur_row = 444
rra.pdp_per_row = 100
rra.xff = 5.0000000000e-01
rra.cdp_prep.value = NaN
rra.cdp_prep.unknown_datapoints = 2
rrdtool {update |updatev } {filename} timestamp: :
#> rrdtool update test.rrd N:$RANDOM
#> rrdtool fetch test.rrd AVERAGE | less
页:
[1]