diff --git a/Makefile b/Makefile index fc2edf2..268e206 100644 --- a/Makefile +++ b/Makefile @@ -89,7 +89,19 @@ net.rrd: update_net: net.rrd rrdtool update $< $(NOW):$(shell cat /proc/net/dev |grep $(IFACE) |awk '{print $$2,$$10}' |tr ' ' ':' ) -update: update_cpu update_load update_mem update_net +disk.rrd: + rrdtool create $@ --start $$(( $(NOW) - 1 )) --step $(STEP) --no-overwrite \ + DS:MBfsfree:COUNTER:120:0:U \ + DS:MBfsused:COUNTER:120:0:U \ + RRA:LAST:0.5:1:1440 \ + RRA:AVERAGE:0.5:420:1440 \ + RRA:AVERAGE:0.5:1860:1440 \ + RRA:AVERAGE:0.5:21900:1440 + +update_disk: disk.rrd + rrdtool update $< $(NOW):$(shell sar -F MOUNT --fs=/ 0 -1 |tail -n 1 |awk '{print $$2,$$3}' |tr ' ' ':' ) + +update: update_cpu update_load update_mem update_net update_disk run: while true; do make update; sleep $(STEP); done @@ -146,4 +158,11 @@ $(BUILD_DIR)/net-daily$(EXTENSION): net.rrd AREA:rbytes#$(DANGER):rbytes \ AREA:ntbytes#$(SUCCESS):tbytes -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): disk.rrd + rrdtool graph $@ --imgformat $(FORMAT) --end now --start end-$(DAY_IN_SECS) \ + DEF:MBfsfree=$<:MBfsfree:AVERAGE \ + DEF:MBfsused=$<:MBfsused:AVERAGE \ + AREA:MBfsused#$(DANGER):MBfsused:STACK \ + AREA:MBfsfree#$(SUCCESS):MBfsfree:STACK + +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)