From 09eac4a4126983b94a075e8e8c2026f742c1b9b0 Mon Sep 17 00:00:00 2001 From: vince Date: Sun, 23 Jan 2022 15:34:04 +0100 Subject: [PATCH] =?UTF-8?q?am=C3=A9liore=20les=20choses?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- index.php | 7 +++++- 2 files changed, 83 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index f14d5e1..e81a3da 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,9 @@ FS ?= / FORMAT = SVG 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 @@ -160,7 +162,43 @@ $(BUILD_DIR)/mem-daily$(EXTENSION): mem.rrd $(BUILD_DIR)/net-daily$(EXTENSION): net.rrd 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 \ CDEF:rbytesps=rbytes,60,/ \ VDEF:rbytespsmax=rbytesps,MAXIMUM \ @@ -178,19 +216,53 @@ $(BUILD_DIR)/net-daily$(EXTENSION): net.rrd $(BUILD_DIR)/disk-daily$(EXTENSION): disk.rrd 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 \ 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 + AREA:bfsfree#$(SUCCESS):"libre":STACK \ + GPRINT:pfsused2:"%4.0lf %So" $(BUILD_DIR)/%.html: %.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 diff --git a/index.php b/index.php index 4d82057..e8d24e5 100644 --- a/index.php +++ b/index.php @@ -51,14 +51,19 @@ $formatter = new \IntlDateFormatter('fr_FR.UTF8', IntlDateFormatter::FULL, IntlD

+ +

Disque

Détails
/dev/null', $output); echo implode(PHP_EOL, $output); ?>
-

+ +

+ +