summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <>2013-09-26 00:54:10 +0000
committererdgeist <>2013-09-26 00:54:10 +0000
commit54d0e9130b77332651a88a0eaa944e3789edccb1 (patch)
tree8b296de9165f97ee8eb9bbd21dd99193dd1e054f
parentd6aa9dc0d6f76d433e80c441b9f871ff149307fb (diff)
Add process monitoring
-rwxr-xr-xminimunin21
1 files changed, 20 insertions, 1 deletions
diff --git a/minimunin b/minimunin
index 950c0e8..3a96ae0 100755
--- a/minimunin
+++ b/minimunin
@@ -2,7 +2,7 @@
2 2
3PLUGIN_DIR=/usr/local/etc/minimunin-plugins 3PLUGIN_DIR=/usr/local/etc/minimunin-plugins
4CONFIG_DIR=/usr/local/etc/minimunin-configs 4CONFIG_DIR=/usr/local/etc/minimunin-configs
5BUILTIN="cpu load swap systat iostat uptime memory open_files" 5BUILTIN="cpu processes load swap systat iostat uptime memory open_files"
6SYSCTL=/sbin/sysctl 6SYSCTL=/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 ;;
83processes)
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 ;;
83iostat) 88iostat)
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
293EOF 298EOF
294;; 299;;
300processes)
301cat <<-EOF
302graph_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 ))
312EOF
313;;
295*) 314*)
296 printf "# Unknown plugin ${_plugin}.\n" 315 printf "# Unknown plugin ${_plugin}.\n"
297 ;; 316 ;;