diff options
| author | erdgeist <> | 2013-09-26 00:54:10 +0000 | 
|---|---|---|
| committer | erdgeist <> | 2013-09-26 00:54:10 +0000 | 
| commit | 54d0e9130b77332651a88a0eaa944e3789edccb1 (patch) | |
| tree | 8b296de9165f97ee8eb9bbd21dd99193dd1e054f | |
| parent | d6aa9dc0d6f76d433e80c441b9f871ff149307fb (diff) | |
Add process monitoring
| -rwxr-xr-x | minimunin | 21 | 
1 files changed, 20 insertions, 1 deletions
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | PLUGIN_DIR=/usr/local/etc/minimunin-plugins | 3 | PLUGIN_DIR=/usr/local/etc/minimunin-plugins | 
| 4 | CONFIG_DIR=/usr/local/etc/minimunin-configs | 4 | CONFIG_DIR=/usr/local/etc/minimunin-configs | 
| 5 | BUILTIN="cpu load swap systat iostat uptime memory open_files" | 5 | BUILTIN="cpu processes load swap systat iostat uptime memory open_files" | 
| 6 | SYSCTL=/sbin/sysctl | 6 | SYSCTL=/sbin/sysctl | 
| 7 | [ -f ${SYSCTL} ] || SYSCTL=/usr/sbin/sysctl | 7 | [ -f ${SYSCTL} ] || SYSCTL=/usr/sbin/sysctl | 
| 8 | 8 | ||
| @@ -80,6 +80,11 @@ cpu) | |||
| 80 | set -- `get_sys kern.cp_time` | 80 | set -- `get_sys kern.cp_time` | 
| 81 | printf "user.value %d\nnice.value %d\nsystem.value %d\ninterrupt.value %d\nidle.value %d\n" "$1" "$2" "$3" "$4" "$5" | 81 | printf "user.value %d\nnice.value %d\nsystem.value %d\ninterrupt.value %d\nidle.value %d\n" "$1" "$2" "$3" "$4" "$5" | 
| 82 | ;; | 82 | ;; | 
| 83 | processes) | ||
| 84 | printf "processes.value %d\n" `/bin/pgrep -aS .* | /usr/bin/wc -l` | ||
| 85 | printf "threads.value %d\n" $(( `ps auxwH | wc -l` - 1 )) | ||
| 86 | printf "maxprocesses.value %d\n" `get_sys kern.maxproc` | ||
| 87 | ;; | ||
| 83 | iostat) | 88 | iostat) | 
| 84 | for d in `/usr/sbin/iostat -Id | /usr/bin/head -n 1 | /usr/bin/xargs`; do | 89 | for d in `/usr/sbin/iostat -Id | /usr/bin/head -n 1 | /usr/bin/xargs`; do | 
| 85 | set -- `/usr/sbin/iostat -Idx ${d} | /usr/bin/tail -n 1 | /usr/bin/xargs` | 90 | set -- `/usr/sbin/iostat -Idx ${d} | /usr/bin/tail -n 1 | /usr/bin/xargs` | 
| @@ -292,6 +297,20 @@ cat <<-EOF | |||
| 292 | forks.min 0 | 297 | forks.min 0 | 
| 293 | EOF | 298 | EOF | 
| 294 | ;; | 299 | ;; | 
| 300 | processes) | ||
| 301 | cat <<-EOF | ||
| 302 | graph_title Process Statistics | ||
| 303 | graph_args --base 1000 -l 0 | ||
| 304 | graph_vlabel number of processes | ||
| 305 | graph_category system | ||
| 306 | graph_info This graph monitors the number of running processes and threads. | ||
| 307 | processes.label The number of processes in the system | ||
| 308 | threads.label The number of threads in the system | ||
| 309 | maxprocesses.label The maximum number of processes in the system | ||
| 310 | processes.warning $(( get_sys kern.maxproc * 92 / 100 )) | ||
| 311 | processes.critical $(( get_sys kern.maxproc * 98 / 100 )) | ||
| 312 | EOF | ||
| 313 | ;; | ||
| 295 | *) | 314 | *) | 
| 296 | printf "# Unknown plugin ${_plugin}.\n" | 315 | printf "# Unknown plugin ${_plugin}.\n" | 
| 297 | ;; | 316 | ;; | 
