Hallo zusammen,
ist schon eine ganze weile her, dass ich mit tobis rrdtool etwas gemacht
habe, und bin wohl etwas eingerostet. Ich versuche aktuell die
Festplattenaktivitäten aufzuzeichnen, mit folgendem Script (wird von
cron jede Minute aufgerufen):
1 | #!/usr/bin/env bash
|
2 | path=/var/lib/rrd/disk_io
|
3 | drivestat=$(iostat -o JSON)
|
4 | timestamp=$(date +%s)
|
5 |
|
6 | echo ${drivestat} | jq -c '.[].hosts.[]' | while read -r node; do
|
7 | nodename=$(echo ${node} | jq -r .nodename)
|
8 | echo ${node} | jq -c '.statistics.[].disk.[]' | while read -r drive; do
|
9 | name=$(echo ${drive} | jq -r .disk_device)
|
10 | filename=${path}/${nodename}_${name}.rrd
|
11 | kb_read=$(echo ${drive} | jq -r .kB_read)
|
12 | kb_wrtn=$(echo ${drive} | jq -r .kB_wrtn)
|
13 | if [ ! -f filename ]; then
|
14 | rrdcreate ${filename} \
|
15 | --step=60s \
|
16 | DS:read:GAUGE:90s:0:U \
|
17 | DS:wrtn:GAUGE:90s:0:U \
|
18 | RRA:AVERAGE:0.5:60s:14d \
|
19 | RRA:MIN:0.5:60s:14d \
|
20 | RRA:MAX:0.5:60s:14d \
|
21 | RRA:AVERAGE:0.5:300s:62d \
|
22 | RRA:MIN:0.5:300s:62d \
|
23 | RRA:MAX:0.5:300s:62d \
|
24 | RRA:AVERAGE:0.5:1h:366d \
|
25 | RRA:MIN:0.5:1h:366d \
|
26 | RRA:MAX:0.5:1h:366d \
|
27 | RRA:AVERAGE:0.5:1d:3660d \
|
28 | RRA:MIN:0.5:1d:3660d \
|
29 | RRA:MAX:0.5:1d:3660d
|
30 | fi
|
31 | rrdupdate ${filename} ${timestamp}:$((${kb_read}*1024)):$((${kb_wrtn}*1024))
|
32 | done
|
33 | done
|
Die Daten kommen auch in der rrd Datenbank an (siehe ds[read].last_ds
und ds[wrtn].last_ds:
1 | $ rrdtool info /var/lib/rrd/disk_io/server_sda.rrd
|
2 | filename = "/var/lib/rrd/disk_io/server_sda.rrd"
|
3 | rrd_version = "0003"
|
4 | step = 60
|
5 | last_update = 1731588631
|
6 | header_size = 4064
|
7 | ds[read].index = 0
|
8 | ds[read].type = "GAUGE"
|
9 | ds[read].minimal_heartbeat = 90
|
10 | ds[read].min = 0.0000000000e+00
|
11 | ds[read].max = NaN
|
12 | ds[read].last_ds = "12205752320"
|
13 | ds[read].value = 1.2205752320e+11
|
14 | ds[read].unknown_sec = 21
|
15 | ds[wrtn].index = 1
|
16 | ds[wrtn].type = "GAUGE"
|
17 | ds[wrtn].minimal_heartbeat = 90
|
18 | ds[wrtn].min = 0.0000000000e+00
|
19 | ds[wrtn].max = NaN
|
20 | ds[wrtn].last_ds = "13989277696"
|
21 | ds[wrtn].value = 1.3989277696e+11
|
22 | ds[wrtn].unknown_sec = 21
|
23 | rra[0].cf = "AVERAGE"
|
24 | rra[0].rows = 20160
|
25 | rra[0].cur_row = 14188
|
26 | rra[0].pdp_per_row = 1
|
27 | rra[0].xff = 5.0000000000e-01
|
28 | rra[0].cdp_prep[0].value = NaN
|
29 | rra[0].cdp_prep[0].unknown_datapoints = 0
|
30 | rra[0].cdp_prep[1].value = NaN
|
31 | rra[0].cdp_prep[1].unknown_datapoints = 0
|
32 | rra[1].cf = "MIN"
|
33 | rra[1].rows = 20160
|
34 | rra[1].cur_row = 1277
|
35 | rra[1].pdp_per_row = 1
|
36 | rra[1].xff = 5.0000000000e-01
|
37 | rra[1].cdp_prep[0].value = NaN
|
38 | rra[1].cdp_prep[0].unknown_datapoints = 0
|
39 | rra[1].cdp_prep[1].value = NaN
|
40 | rra[1].cdp_prep[1].unknown_datapoints = 0
|
41 | [...]
|
Allerdings kann ich keine Daten daraus fetchen:
1 | $ rrdtool fetch /var/lib/rrd/disk_io/server_sda.rrd AVERAGE -s -10m
|
2 | read wrtn
|
3 |
|
4 | 1731588540: -nan -nan
|
5 | 1731588600: -nan -nan
|
6 | 1731588660: -nan -nan
|
7 | 1731588720: -nan -nan
|
8 | 1731588780: -nan -nan
|
9 | 1731588840: -nan -nan
|
10 | 1731588900: -nan -nan
|
11 | 1731588960: -nan -nan
|
12 | 1731589020: -nan -nan
|
13 | 1731589080: -nan -nan
|
14 | 1731589140: -nan -nan
|
Kann mir da mal jemdand auf die Sprünge helfen?
Danke, Edi