Browse Source

enhanced gnuplotting

tth 2 years ago
parent
commit
f546418fb4
2 changed files with 9 additions and 5 deletions
  1. 8
    4
      rrdb/getvalues.sh
  2. 1
    1
      rrdb/insert.sh

+ 8
- 4
rrdb/getvalues.sh View File

@@ -4,7 +4,8 @@ source ./commun.sh
4 4
 
5 5
 tmpf="somevalues.dat"
6 6
 
7
-rrdtool fetch $RRDB LAST			|
7
+rrdtool fetch $RRDB LAST			\
8
+	--start 0				|
8 9
 tr -d ':'					|
9 10
 awk	'
10 11
 	(!/nan/ && NF==2) { print $1, $2 }
@@ -15,11 +16,14 @@ awk	'
15 16
 # as an example, we are gnuploting our datas
16 17
 #
17 18
 gnuplot << __EOC__
18
-set term png size 800,600
19
+set term png size 1024,512
19 20
 set output "graphe.png"
20 21
 set grid
21
-plot "${tmpf}" with lines
22
+set xdata time
23
+set timefmt "%s"
24
+set format x "%m/%d\n%H:%M"
25
+plot "${tmpf}" using 1:2 with lines
22 26
 __EOC__
23 27
 
24
-rm ${tmpf}
28
+# rm ${tmpf}
25 29
 

+ 1
- 1
rrdb/insert.sh View File

@@ -5,7 +5,7 @@ source ./commun.sh
5 5
 ctime=$(date +'%s')
6 6
 value=$(cut -d ' ' -f 1 /proc/loadavg)
7 7
 
8
-# write value to a file
8
+# display and write value to a file
9 9
 echo ${ctime} ${value} | tee -a bar.dat
10 10
 
11 11
 # inject value in the rrdb file 

Loading…
Cancel
Save