1. SNMP 

    SNMPWALK / 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 in  plain ASCII. In connection wit restore you can use this to move an RRD from one computer architecture to another

    restore : restor an RRD  in 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] [DS:ds-name:DST:dst arguments] [ 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[testds].type = "GAUGE"
ds[testds].minimal_heartbeat = 8
ds[testds].min = 0.0000000000e+00
ds[testds].max = NaN
ds[testds].last_ds = "U"
ds[testds].value = 0.0000000000e+00
ds[testds].unknown_sec = 4
rra[0].cf = "AVERAGE"
rra[0].rows = 17280
rra[0].cur_row = 11633
rra[0].pdp_per_row = 10
rra[0].xff = 5.0000000000e-01
rra[0].cdp_prep[0].value = NaN
rra[0].cdp_prep[0].unknown_datapoints = 2
rra[1].cf = "AVERAGE"
rra[1].rows = 3456
rra[1].cur_row = 2955
rra[1].pdp_per_row = 10
rra[1].xff = 5.0000000000e-01
rra[1].cdp_prep[0].value = NaN
rra[1].cdp_prep[0].unknown_datapoints = 2
rra[2].cf = "AVERAGE"
rra[2].rows = 1210
rra[2].cur_row = 444
rra[2].pdp_per_row = 100
rra[2].xff = 5.0000000000e-01
rra[2].cdp_prep[0].value = NaN
rra[2].cdp_prep[0].unknown_datapoints = 2

 

 

rrdtool {update |updatev } {filename} timestamp: <DS1>:<DS2>

#> rrdtool update test.rrd N:$RANDOM

#> rrdtool fetch test.rrd AVERAGE | less