From 4dca59a9bc7619f89aad85f5f81ce8751934e2e4 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Sun, 29 Sep 2013 04:32:25 +0000 Subject: experimental df support --- minimunin | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/minimunin b/minimunin index cc173c9..561e12a 100755 --- a/minimunin +++ b/minimunin @@ -8,7 +8,7 @@ PLUGIN_DIR=/usr/local/etc/minimunin-plugins CONFIG_DIR=/usr/local/etc/minimunin-configs -BUILTIN="cpu processes load swap systat iostat uptime memory open_files" +BUILTIN="cpu processes load swap systat df iostat uptime memory open_files" SYSCTL=/sbin/sysctl [ -f ${SYSCTL} ] || SYSCTL=/usr/sbin/sysctl @@ -101,6 +101,13 @@ systat) set -- `get_sys vm.stats.sys.v_soft vm.stats.sys.v_intr vm.stats.sys.v_syscall vm.stats.sys.v_swtch vm.stats.vm.v_forks vm.stats.vm.v_rforks vm.stats.vm.v_vforks` printf "softint.value %d\nhardint.value %d\nsyscall.value %d\ncs.value %d\nforks.value %d\n" "$1" "$2" "$3" "$4" $(( ${5}+${6}+${7} )) ;; +df) + /bin/df -P -t noprocfs,devfs,fdescfs,linprocfs,linsysfs,nfs,nullfs | /usr/bin/tail -n +2 | + while read fs blocks used avail cap mount; do + fs=`printf "%s" ${fs} | /usr/bin/tr -c '[:alnum:]' _` + printf "%s %d" ${fs}.value $(( used * 512 )) + done + ;; *) printf "# Unknown plugin ${_plugin}.\n" ;; @@ -305,7 +312,7 @@ EOF ;; processes) cat <<-EOF -graph_title Process Statistics + graph_title Process Statistics graph_args --base 1000 -l 0 graph_vlabel number of processes graph_category system @@ -317,6 +324,20 @@ graph_title Process Statistics processes.critical $(( `get_sys kern.maxproc` * 98 / 100 )) EOF ;; +df) +cat <<-EOF + graph_title Filesystem usage (in bytes) + graph_args --base 1024 --lower-limit 0 + graph_vlabel bytes + graph_category disk + graph_total Total +EOF +/bin/df -P -t noprocfs,devfs,fdescfs,linprocfs,linsysfs,nfs,nullfs | /usr/bin/tail -n +2 | +while read fs blocks used avail cap mount; do + fs=`printf "%s" ${fs} | /usr/bin/tr -c '[:alnum:]' _` + printf "%s %s" ${fs}.label ${mount} +done +;; *) printf "# Unknown plugin ${_plugin}.\n" ;; -- cgit v1.2.3