diff options
| author | erdgeist <> | 2013-09-29 04:32:25 +0000 |
|---|---|---|
| committer | erdgeist <> | 2013-09-29 04:32:25 +0000 |
| commit | 4dca59a9bc7619f89aad85f5f81ce8751934e2e4 (patch) | |
| tree | d3cb4ba1b41bc718de604c253889045673f09934 | |
| parent | 16cf6be1ee090093ad99e006b6ffcb9734d779f4 (diff) | |
experimental df support
| -rwxr-xr-x | minimunin | 25 |
1 files changed, 23 insertions, 2 deletions
| @@ -8,7 +8,7 @@ | |||
| 8 | 8 | ||
| 9 | PLUGIN_DIR=/usr/local/etc/minimunin-plugins | 9 | PLUGIN_DIR=/usr/local/etc/minimunin-plugins |
| 10 | CONFIG_DIR=/usr/local/etc/minimunin-configs | 10 | CONFIG_DIR=/usr/local/etc/minimunin-configs |
| 11 | BUILTIN="cpu processes load swap systat iostat uptime memory open_files" | 11 | BUILTIN="cpu processes load swap systat df iostat uptime memory open_files" |
| 12 | SYSCTL=/sbin/sysctl | 12 | SYSCTL=/sbin/sysctl |
| 13 | [ -f ${SYSCTL} ] || SYSCTL=/usr/sbin/sysctl | 13 | [ -f ${SYSCTL} ] || SYSCTL=/usr/sbin/sysctl |
| 14 | 14 | ||
| @@ -101,6 +101,13 @@ systat) | |||
| 101 | 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` | 101 | 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` |
| 102 | printf "softint.value %d\nhardint.value %d\nsyscall.value %d\ncs.value %d\nforks.value %d\n" "$1" "$2" "$3" "$4" $(( ${5}+${6}+${7} )) | 102 | printf "softint.value %d\nhardint.value %d\nsyscall.value %d\ncs.value %d\nforks.value %d\n" "$1" "$2" "$3" "$4" $(( ${5}+${6}+${7} )) |
| 103 | ;; | 103 | ;; |
| 104 | df) | ||
| 105 | /bin/df -P -t noprocfs,devfs,fdescfs,linprocfs,linsysfs,nfs,nullfs | /usr/bin/tail -n +2 | | ||
| 106 | while read fs blocks used avail cap mount; do | ||
| 107 | fs=`printf "%s" ${fs} | /usr/bin/tr -c '[:alnum:]' _` | ||
| 108 | printf "%s %d" ${fs}.value $(( used * 512 )) | ||
| 109 | done | ||
| 110 | ;; | ||
| 104 | *) | 111 | *) |
| 105 | printf "# Unknown plugin ${_plugin}.\n" | 112 | printf "# Unknown plugin ${_plugin}.\n" |
| 106 | ;; | 113 | ;; |
| @@ -305,7 +312,7 @@ EOF | |||
| 305 | ;; | 312 | ;; |
| 306 | processes) | 313 | processes) |
| 307 | cat <<-EOF | 314 | cat <<-EOF |
| 308 | graph_title Process Statistics | 315 | graph_title Process Statistics |
| 309 | graph_args --base 1000 -l 0 | 316 | graph_args --base 1000 -l 0 |
| 310 | graph_vlabel number of processes | 317 | graph_vlabel number of processes |
| 311 | graph_category system | 318 | graph_category system |
| @@ -317,6 +324,20 @@ graph_title Process Statistics | |||
| 317 | processes.critical $(( `get_sys kern.maxproc` * 98 / 100 )) | 324 | processes.critical $(( `get_sys kern.maxproc` * 98 / 100 )) |
| 318 | EOF | 325 | EOF |
| 319 | ;; | 326 | ;; |
| 327 | df) | ||
| 328 | cat <<-EOF | ||
| 329 | graph_title Filesystem usage (in bytes) | ||
| 330 | graph_args --base 1024 --lower-limit 0 | ||
| 331 | graph_vlabel bytes | ||
| 332 | graph_category disk | ||
| 333 | graph_total Total | ||
| 334 | EOF | ||
| 335 | /bin/df -P -t noprocfs,devfs,fdescfs,linprocfs,linsysfs,nfs,nullfs | /usr/bin/tail -n +2 | | ||
| 336 | while read fs blocks used avail cap mount; do | ||
| 337 | fs=`printf "%s" ${fs} | /usr/bin/tr -c '[:alnum:]' _` | ||
| 338 | printf "%s %s" ${fs}.label ${mount} | ||
| 339 | done | ||
| 340 | ;; | ||
| 320 | *) | 341 | *) |
| 321 | printf "# Unknown plugin ${_plugin}.\n" | 342 | printf "# Unknown plugin ${_plugin}.\n" |
| 322 | ;; | 343 | ;; |
