I'm trying to store ADSL stats for my router. I didn't do rrdtool info on the others beccause they are now showing the correct value after using the same command as in the script to update. The weird thing is that the actual float values are store fine.
Both of the values are GAUGE.
root@pi:/scripts# ./routerstats.sh&&rrdtool info rrd/attn.rrd|grep last
+ awk ' /^Max/ { maxup = $5; maxdown = $10; }
/^Channel/ { curup = $6; curdown = $11; }
/^SNR/ { snrdown = $3; snrup = $4; }
/^Attn/ { attndown = $2; attnup = $3; }
/^Pwr/ { pwrdown = $2; pwrup = $3; }
END { up = sprintf("N:%s:%s", maxup, curup);
down = sprintf("N:%s:%s", maxdown, curdown);
snr = sprintf("N:%s:%s", snrdown, snrup);
attn = sprintf("N:%s:%s", attndown, attnup);
pwr = sprintf("N:%s:%s", pwrdown, pwrup);
system("echo up " up);
system("echo down " down);
system("echo snr " snr);
system("echo attn " attn);
system("echo pwr " pwr);
system("rrdtool update /scripts/rrd/up.rrd -t max N:" maxup);
system("rrdtool update /scripts/rrd/down.rrd -t max N:" maxdown);
system("rrdtool update /scripts/rrd/snr.rrd -t down N:" snrdown);
system("rrdtool update /scripts/rrd/attn.rrd -t down N:" attndown);
system("rrdtool update /scripts/rrd/pwr.rrd -t down N:" pwrdown);
system("rrdtool update /scripts/rrd/up.rrd -t current N:" curup);
system("rrdtool update /scripts/rrd/down.rrd -t current N:" curdown);
system("rrdtool update /scripts/rrd/snr.rrd -t up N:" snrup);
system("rrdtool update /scripts/rrd/attn.rrd -t up N:" attnup);
system("rrdtool update /scripts/rrd/pwr.rrd -t up N:" pwrup);
}'
up N:1080:512
down N:10788:2048
snr N:20.4:12.0
attn N:26.0:15.0
pwr N:5.1:4.0
' to float not complete: tail 'nversion of '12.0
' to float not complete: tail 'onversion of '15.0
' to float not complete: tail 'nversion of '4.0
last_update = 1441477923
ds[down].last_ds = "U"
ds[up].last_ds = "U"
The data passed into awk:
Status: Showtime
Last Retrain Reason: 0
Last initialization procedure status: 0
Max: Upstream rate = 1120 Kbps, Downstream rate = 10816 Kbps
Channel: FAST, Upstream rate = 512 Kbps, Downstream rate = 2048 Kbps
Link Power State: L0
Mode: G.DMT
TPS-TC: ATM Mode
Trellis: ON
Line Status: No Defect
Training Status: Showtime
Down Up
SNR (dB): 21.4 12.0
Attn(dB): 26.0 15.0
Pwr(dBm): 5.0 2.9