DD2-monitor/rrdb/getvalues.sh

30 lines
430 B
Bash
Raw Normal View History

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