From f546418fb495b44417def67b079fd8f21787b422 Mon Sep 17 00:00:00 2001 From: tth Date: Fri, 4 Jan 2019 14:09:02 +0100 Subject: [PATCH] enhanced gnuplotting --- rrdb/getvalues.sh | 12 ++++++++---- rrdb/insert.sh | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/rrdb/getvalues.sh b/rrdb/getvalues.sh index 43fedf1..9a28cab 100755 --- a/rrdb/getvalues.sh +++ b/rrdb/getvalues.sh @@ -4,7 +4,8 @@ source ./commun.sh tmpf="somevalues.dat" -rrdtool fetch $RRDB LAST | +rrdtool fetch $RRDB LAST \ + --start 0 | tr -d ':' | awk ' (!/nan/ && NF==2) { print $1, $2 } @@ -15,11 +16,14 @@ awk ' # as an example, we are gnuploting our datas # gnuplot << __EOC__ -set term png size 800,600 +set term png size 1024,512 set output "graphe.png" set grid -plot "${tmpf}" with lines +set xdata time +set timefmt "%s" +set format x "%m/%d\n%H:%M" +plot "${tmpf}" using 1:2 with lines __EOC__ -rm ${tmpf} +# rm ${tmpf} diff --git a/rrdb/insert.sh b/rrdb/insert.sh index 3990eb0..ad5dfbc 100755 --- a/rrdb/insert.sh +++ b/rrdb/insert.sh @@ -5,7 +5,7 @@ source ./commun.sh ctime=$(date +'%s') value=$(cut -d ' ' -f 1 /proc/loadavg) -# write value to a file +# display and write value to a file echo ${ctime} ${value} | tee -a bar.dat # inject value in the rrdb file