DD2-monitor/rrdb/getvalues.sh

30 lines
430 B
Bash
Raw Normal View History

2019-01-03 16:26:46 +01:00
#!/bin/bash
source ./commun.sh
2019-01-03 17:05:55 +01:00
tmpf="somevalues.dat"
2019-01-04 14:09:02 +01:00
rrdtool fetch $RRDB LAST \
--start 0 |
2019-01-03 16:26:46 +01:00
tr -d ':' |
awk '
(!/nan/ && NF==2) { print $1, $2 }
' \
2019-01-03 17:05:55 +01:00
> ${tmpf}
2019-01-03 16:26:46 +01:00
2019-01-03 17:05:55 +01:00
#
# as an example, we are gnuploting our datas
#
2019-01-03 16:26:46 +01:00
gnuplot << __EOC__
2019-01-04 14:09:02 +01:00
set term png size 1024,512
2019-01-03 16:26:46 +01:00
set output "graphe.png"
2019-01-03 17:05:55 +01:00
set grid
2019-01-04 14:09:02 +01:00
set xdata time
set timefmt "%s"
set format x "%m/%d\n%H:%M"
plot "${tmpf}" using 1:2 with lines
2019-01-03 16:26:46 +01:00
__EOC__
2019-01-04 14:09:02 +01:00
# rm ${tmpf}
2019-01-03 16:26:46 +01:00