Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 43 lines (38 sloc) 0.78 kb
#!/usr/bin/env bash
#
# Count the number of running processes
#
# This is not directly an indicator of a problem,
# but instead is usually a symptom of a misbehaving
# program
#
# Author: Dave Eddy <dave@voxer.com>
# Date: 11/21/12
# License: MIT
warning=250
critical=400
perfdata=true
while getopts 'nw:c:' option; do
case "$option" in
n) perfdata=false;;
w) warning=$OPTARG;;
c) critical=$OPTARG;;
esac
done
count=$(ls -U1 /proc | wc -l)
if [[ -z $count ]]; then
echo 'unknown: could not count procs in /proc'
exit 3
elif ((count >= critical)); then
echo -n 'critical: '
ret=2
elif ((count >= warning)); then
echo -n 'warning: '
ret=1
else
echo -n 'ok: '
ret=0
fi
echo -n "$count processes running"
$perfdata && echo "|proc_count=$count" || echo
exit "$ret"
Jump to Line
Something went wrong with that request. Please try again.