From 54d0e9130b77332651a88a0eaa944e3789edccb1 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Thu, 26 Sep 2013 00:54:10 +0000 Subject: Add process monitoring --- minimunin | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/minimunin b/minimunin index 950c0e8..3a96ae0 100755 --- a/minimunin +++ b/minimunin @@ -2,7 +2,7 @@ PLUGIN_DIR=/usr/local/etc/minimunin-plugins CONFIG_DIR=/usr/local/etc/minimunin-configs -BUILTIN="cpu load swap systat iostat uptime memory open_files" +BUILTIN="cpu processes load swap systat iostat uptime memory open_files" SYSCTL=/sbin/sysctl [ -f ${SYSCTL} ] || SYSCTL=/usr/sbin/sysctl @@ -80,6 +80,11 @@ cpu) set -- `get_sys kern.cp_time` printf "user.value %d\nnice.value %d\nsystem.value %d\ninterrupt.value %d\nidle.value %d\n" "$1" "$2" "$3" "$4" "$5" ;; +processes) + printf "processes.value %d\n" `/bin/pgrep -aS .* | /usr/bin/wc -l` + printf "threads.value %d\n" $(( `ps auxwH | wc -l` - 1 )) + printf "maxprocesses.value %d\n" `get_sys kern.maxproc` + ;; iostat) for d in `/usr/sbin/iostat -Id | /usr/bin/head -n 1 | /usr/bin/xargs`; do set -- `/usr/sbin/iostat -Idx ${d} | /usr/bin/tail -n 1 | /usr/bin/xargs` @@ -292,6 +297,20 @@ cat <<-EOF forks.min 0 EOF ;; +processes) +cat <<-EOF +graph_title Process Statistics + graph_args --base 1000 -l 0 + graph_vlabel number of processes + graph_category system + graph_info This graph monitors the number of running processes and threads. + processes.label The number of processes in the system + threads.label The number of threads in the system + maxprocesses.label The maximum number of processes in the system + processes.warning $(( get_sys kern.maxproc * 92 / 100 )) + processes.critical $(( get_sys kern.maxproc * 98 / 100 )) +EOF +;; *) printf "# Unknown plugin ${_plugin}.\n" ;; -- cgit v1.2.3