Browse Source

améliore les choses

master
vince vince 3 years ago
parent
commit
09eac4a412
2 changed files with 83 additions and 6 deletions
  1. +77
    -5
      Makefile
  2. +6
    -1
      index.php

+ 77
- 5
Makefile View File

@ -25,7 +25,9 @@ FS ?= /
FORMAT = SVG FORMAT = SVG
EXTENSION = .$(shell echo $(FORMAT) |tr '[:upper:]' '[:lower:]') EXTENSION = .$(shell echo $(FORMAT) |tr '[:upper:]' '[:lower:]')
DAY_IN_SECS = 86400
DAY_IN_SECS = 86400
WEEK_IN_SECS = 604800
MONTH_IN_SECS = 2678400
BUILD_DIR = web BUILD_DIR = web
@ -160,7 +162,43 @@ $(BUILD_DIR)/mem-daily$(EXTENSION): mem.rrd
$(BUILD_DIR)/net-daily$(EXTENSION): net.rrd $(BUILD_DIR)/net-daily$(EXTENSION): net.rrd
rrdtool graph $@ --imgformat $(FORMAT) --end now --start end-$(DAY_IN_SECS) \ rrdtool graph $@ --imgformat $(FORMAT) --end now --start end-$(DAY_IN_SECS) \
--title "Réseau" \
--title "Réseau (jour)" \
DEF:rbytes=$<:rbytes:AVERAGE \
CDEF:rbytesps=rbytes,60,/ \
VDEF:rbytespsmax=rbytesps,MAXIMUM \
DEF:tbytes=$<:tbytes:AVERAGE \
CDEF:tbytesps=tbytes,60,/ \
VDEF:tbytespsmax=tbytesps,MAXIMUM \
CDEF:ntbytes=tbytes,-1,* \
HRULE:0#$(INFO) \
AREA:rbytes#$(DANGER):"reçu" \
COMMENT:"maximum " \
GPRINT:rbytespsmax:"%6.2lf %So/s" \
AREA:ntbytes#$(SUCCESS):"envoyé" \
COMMENT:"maximum " \
GPRINT:tbytespsmax:"%6.2lf %So/s"
$(BUILD_DIR)/net-weekly$(EXTENSION): net.rrd
rrdtool graph $@ --imgformat $(FORMAT) --end now --start end-$(WEEK_IN_SECS) \
--title "Réseau (semaine)" \
DEF:rbytes=$<:rbytes:AVERAGE \
CDEF:rbytesps=rbytes,60,/ \
VDEF:rbytespsmax=rbytesps,MAXIMUM \
DEF:tbytes=$<:tbytes:AVERAGE \
CDEF:tbytesps=tbytes,60,/ \
VDEF:tbytespsmax=tbytesps,MAXIMUM \
CDEF:ntbytes=tbytes,-1,* \
HRULE:0#$(INFO) \
AREA:rbytes#$(DANGER):"reçu" \
COMMENT:"maximum " \
GPRINT:rbytespsmax:"%6.2lf %So/s" \
AREA:ntbytes#$(SUCCESS):"envoyé" \
COMMENT:"maximum " \
GPRINT:tbytespsmax:"%6.2lf %So/s"
$(BUILD_DIR)/net-monthly$(EXTENSION): net.rrd
rrdtool graph $@ --imgformat $(FORMAT) --end now --start end-$(MONTH_IN_SECS) \
--title "Réseau (mois)" \
DEF:rbytes=$<:rbytes:AVERAGE \ DEF:rbytes=$<:rbytes:AVERAGE \
CDEF:rbytesps=rbytes,60,/ \ CDEF:rbytesps=rbytes,60,/ \
VDEF:rbytespsmax=rbytesps,MAXIMUM \ VDEF:rbytespsmax=rbytesps,MAXIMUM \
@ -178,19 +216,53 @@ $(BUILD_DIR)/net-daily$(EXTENSION): net.rrd
$(BUILD_DIR)/disk-daily$(EXTENSION): disk.rrd $(BUILD_DIR)/disk-daily$(EXTENSION): disk.rrd
rrdtool graph $@ --imgformat $(FORMAT) --end now --start end-$(DAY_IN_SECS) \ rrdtool graph $@ --imgformat $(FORMAT) --end now --start end-$(DAY_IN_SECS) \
--title "Disque" \
--title "Disque (jour)" \
--lower-limit 0 \
DEF:mbfsfree=$<:mbfsfree:AVERAGE \
CDEF:bfsfree=mbfsfree,1024,*,1024,* \
VDEF:avgbfsfree=bfsfree,AVERAGE \
DEF:mbfsused=$<:mbfsused:AVERAGE \
CDEF:bfsused=mbfsused,1024,*,1024,* \
CDEF:pfsused1=bfsused,100,*,bfsused,bfsfree,+,/ \
VDEF:pfsused2=pfsused1,AVERAGE \
AREA:bfsused#$(DANGER):"utilisé":STACK \
GPRINT:pfsused2:"%3.2lf %%" \
AREA:bfsfree#$(SUCCESS):"libre":STACK \
GPRINT:pfsused2:"%4.0lf %So"
$(BUILD_DIR)/disk-weekly$(EXTENSION): disk.rrd
rrdtool graph $@ --imgformat $(FORMAT) --end now --start end-$(WEEK_IN_SECS) \
--title "Disque (semaine)" \
--lower-limit 0 \
DEF:mbfsfree=$<:mbfsfree:AVERAGE \
CDEF:bfsfree=mbfsfree,1024,*,1024,* \
VDEF:avgbfsfree=bfsfree,AVERAGE \
DEF:mbfsused=$<:mbfsused:AVERAGE \
CDEF:bfsused=mbfsused,1024,*,1024,* \
CDEF:pfsused1=bfsused,100,*,bfsused,bfsfree,+,/ \
VDEF:pfsused2=pfsused1,AVERAGE \
AREA:bfsused#$(DANGER):"utilisé":STACK \
GPRINT:pfsused2:"%3.2lf %%" \
AREA:bfsfree#$(SUCCESS):"libre":STACK \
GPRINT:pfsused2:"%4.0lf %So"
$(BUILD_DIR)/disk-monthly$(EXTENSION): disk.rrd
rrdtool graph $@ --imgformat $(FORMAT) --end now --start end-$(MONTH_IN_SECS) \
--title "Disque (mois)" \
--lower-limit 0 \ --lower-limit 0 \
DEF:mbfsfree=$<:mbfsfree:AVERAGE \ DEF:mbfsfree=$<:mbfsfree:AVERAGE \
CDEF:bfsfree=mbfsfree,1024,*,1024,* \ CDEF:bfsfree=mbfsfree,1024,*,1024,* \
VDEF:avgbfsfree=bfsfree,AVERAGE \
DEF:mbfsused=$<:mbfsused:AVERAGE \ DEF:mbfsused=$<:mbfsused:AVERAGE \
CDEF:bfsused=mbfsused,1024,*,1024,* \ CDEF:bfsused=mbfsused,1024,*,1024,* \
CDEF:pfsused1=bfsused,100,*,bfsused,bfsfree,+,/ \ CDEF:pfsused1=bfsused,100,*,bfsused,bfsfree,+,/ \
VDEF:pfsused2=pfsused1,AVERAGE \ VDEF:pfsused2=pfsused1,AVERAGE \
AREA:bfsused#$(DANGER):"utilisé":STACK \ AREA:bfsused#$(DANGER):"utilisé":STACK \
GPRINT:pfsused2:"%3.2lf %%" \ GPRINT:pfsused2:"%3.2lf %%" \
AREA:bfsfree#$(SUCCESS):"libre":STACK
AREA:bfsfree#$(SUCCESS):"libre":STACK \
GPRINT:pfsused2:"%4.0lf %So"
$(BUILD_DIR)/%.html: %.php $(BUILD_DIR)/%.html: %.php
php $< >$@ php $< >$@
graph: $(BUILD_DIR)/cpu-daily$(EXTENSION) $(BUILD_DIR)/load-daily$(EXTENSION) $(BUILD_DIR)/mem-daily$(EXTENSION) $(BUILD_DIR)/net-daily$(EXTENSION) $(BUILD_DIR)/disk-daily$(EXTENSION) $(BUILD_DIR)/index.html
graph: $(BUILD_DIR)/cpu-daily$(EXTENSION) $(BUILD_DIR)/load-daily$(EXTENSION) $(BUILD_DIR)/mem-daily$(EXTENSION) $(BUILD_DIR)/net-daily$(EXTENSION) $(BUILD_DIR)/net-weekly$(EXTENSION) $(BUILD_DIR)/net-monthly$(EXTENSION) $(BUILD_DIR)/disk-daily$(EXTENSION) $(BUILD_DIR)/disk-weekly$(EXTENSION) $(BUILD_DIR)/disk-monthly$(EXTENSION) $(BUILD_DIR)/index.html

+ 6
- 1
index.php View File

@ -51,14 +51,19 @@ $formatter = new \IntlDateFormatter('fr_FR.UTF8', IntlDateFormatter::FULL, IntlD
<pre><?php $output = ''; exec('cat /proc/net/dev', $output); echo implode(PHP_EOL, $output); ?></pre> <pre><?php $output = ''; exec('cat /proc/net/dev', $output); echo implode(PHP_EOL, $output); ?></pre>
</details><p> </details><p>
<img src="net-daily.svg" /> <img src="net-daily.svg" />
<img src="net-weekly.svg" />
<img src="net-monthly.svg" />
</p> </p>
<h2 id="disk">Disque</h2> <h2 id="disk">Disque</h2>
<details> <details>
<summary>Détails</summary> <summary>Détails</summary>
<pre><?php $output = ''; exec('df -hlT -x tmpfs -x devtmpfs --total 2>/dev/null', $output); echo implode(PHP_EOL, $output); ?></pre> <pre><?php $output = ''; exec('df -hlT -x tmpfs -x devtmpfs --total 2>/dev/null', $output); echo implode(PHP_EOL, $output); ?></pre>
</details><p>
</details>
<p>
<img src="disk-daily.svg" /> <img src="disk-daily.svg" />
<img src="disk-weekly.svg" />
<img src="disk-monthly.svg" />
</p> </p>
</body> </body>


Loading…
Cancel
Save