|
|
@ -1,5 +1,11 @@ |
|
|
|
# cagull-rrdtools |
|
|
|
|
|
|
|
## Prérequis |
|
|
|
|
|
|
|
Paquets Debian à installer : |
|
|
|
* `sysstats` |
|
|
|
* `rrdtools` |
|
|
|
|
|
|
|
## Objectif |
|
|
|
|
|
|
|
On cherche à mesurer les métriques de la machine virtuelle pour avoir une idée de ce qui s'y passe. |
|
|
@ -58,3 +64,65 @@ veth3cae73a: 4008409 1953 0 0 0 0 0 0 287234 |
|
|
|
``` |
|
|
|
|
|
|
|
On a donc toutes les données de mesure que l'on voulait. |
|
|
|
|
|
|
|
## Stocker les mesures |
|
|
|
|
|
|
|
On utilise les RRDTools pour stocker et tracer les données. |
|
|
|
|
|
|
|
### Créer les bases |
|
|
|
|
|
|
|
cpu |
|
|
|
load |
|
|
|
mem |
|
|
|
fs |
|
|
|
net |
|
|
|
|
|
|
|
``` |
|
|
|
rrdtool create cpu.rrd --start $(date +%s) --step 60 --no-overwrite \ |
|
|
|
DS:user:GAUGE:120:0:100 \ |
|
|
|
DS:nice:GAUGE:120:0:100 \ |
|
|
|
DS:sys:GAUGE:120:0:100 \ |
|
|
|
DS:iowait:GAUGE:120:0:100 \ |
|
|
|
DS:steal:GAUGE:120:0:100 \ |
|
|
|
DS:irq:GAUGE:120:0:100 \ |
|
|
|
DS:soft:GAUGE:120:0:100 \ |
|
|
|
DS:guest:GAUGE:120:0:100 \ |
|
|
|
DS:gnice:GAUGE:120:0:100 \ |
|
|
|
DS:idle:GAUGE:120:0:100 \ |
|
|
|
RRA:LAST:0.5:1:1440 \ |
|
|
|
RRA:AVERAGE:0.5:420:1440 \ |
|
|
|
RRA:AVERAGE:0.5:1860:1440 \ |
|
|
|
RRA:AVERAGE:0.5:21900:1440 |
|
|
|
``` |
|
|
|
|
|
|
|
``` |
|
|
|
rrdtool update cpu.rrd $(date +%s):$(LANG=C sar -u ALL 0 -1 |tail -n1 |awk '{print $3,$4,$5,$6,$7,$8,$9,$10,$11,$12}' |tr ' ' ':'); |
|
|
|
``` |
|
|
|
|
|
|
|
Dans un `while true; do …; sleep 60; done` |
|
|
|
|
|
|
|
``` |
|
|
|
rrdtool graph cpu-daily.png --end now --start end-86400s \ |
|
|
|
DEF:user=cpu.rrd:user:AVERAGE \ |
|
|
|
DEF:nice=cpu.rrd:nice:AVERAGE \ |
|
|
|
DEF:sys=cpu.rrd:sys:AVERAGE \ |
|
|
|
DEF:iowait=cpu.rrd:iowait:AVERAGE \ |
|
|
|
DEF:steal=cpu.rrd:steal:AVERAGE \ |
|
|
|
DEF:irq=cpu.rrd:irq:AVERAGE \ |
|
|
|
DEF:soft=cpu.rrd:soft:AVERAGE \ |
|
|
|
DEF:guest=cpu.rrd:guest:AVERAGE \ |
|
|
|
DEF:gnice=cpu.rrd:gnice:AVERAGE \ |
|
|
|
DEF:idle=cpu.rrd:idle:AVERAGE \ |
|
|
|
AREA:user:STACK \ |
|
|
|
AREA:nice:STACK \ |
|
|
|
AREA:sys:STACK \ |
|
|
|
AREA:iowait:STACK \ |
|
|
|
AREA:steal:STACK \ |
|
|
|
AREA:irq:STACK \ |
|
|
|
AREA:soft:STACK \ |
|
|
|
AREA:guest:STACK \ |
|
|
|
AREA:gnice:STACK \ |
|
|
|
AREA:idle:STACK |
|
|
|
``` |
|
|
|
|
|
|
|
|