rrdb : first working code
이 커밋은 다음에 포함됨:
+14
@@ -6,11 +6,25 @@ loin d'être évidente pour les newbies.
|
||||
|
||||
La lecture de la manpage `rrdtutorial` est indispensable.
|
||||
|
||||
https://oss.oetiker.ch/rrdtool/tut/rrd-beginners.en.html
|
||||
|
||||
## premier exemple
|
||||
|
||||
Un petit peu de code fabriqué à la rache.
|
||||
|
||||
- `create.sh`
|
||||
- `update.sh`
|
||||
- `getvalues.sh`
|
||||
|
||||
Suffisant pour comprendre le principe général, mais très flou
|
||||
sur les détails.
|
||||
|
||||
## et après ?
|
||||
|
||||
Trouver une interface en C pour faciliter la vie des gens.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#
|
||||
# commun definitions for rrdb tests
|
||||
#
|
||||
|
||||
export RRDB=$HOME/TMP/tests.rrd
|
||||
|
||||
실행파일
+21
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# creating the test database
|
||||
#
|
||||
|
||||
source ./commun.sh
|
||||
|
||||
starttime=$(date +'%s')
|
||||
|
||||
echo creating $RRDB at ${starttime}s since epoch
|
||||
|
||||
rrdtool create $RRDB \
|
||||
--start $starttime \
|
||||
--step 60 \
|
||||
DS:value:GAUGE:150:0:10 \
|
||||
RRA:AVERAGE:0.5:1:60
|
||||
|
||||
|
||||
|
||||
|
||||
실행파일
+19
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
source ./commun.sh
|
||||
|
||||
rrdtool fetch $RRDB LAST |
|
||||
tr -d ':' |
|
||||
awk '
|
||||
(!/nan/ && NF==2) { print $1, $2 }
|
||||
' \
|
||||
> toto
|
||||
|
||||
gnuplot << __EOC__
|
||||
set term png size 800,600
|
||||
set output "graphe.png"
|
||||
plot "toto" with lines
|
||||
__EOC__
|
||||
|
||||
rm toto
|
||||
|
||||
실행파일
+14
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
source ./commun.sh
|
||||
|
||||
ctime=$(date +'%s')
|
||||
value=$(cut -d ' ' -f 1 /proc/loadavg)
|
||||
|
||||
# write value to a file
|
||||
echo ${ctime} ${value} | tee -a bar.dat
|
||||
|
||||
# inject value in the rrdb file
|
||||
rrdtool update $RRDB ${ctime}:${value}
|
||||
|
||||
|
||||
새 이슈에서 참조
사용자 차단