#!/bin/sh # # Wildcard-script to monitor number of processes. To monitor a # program, link ps_ to this file. E.g. # # ln -s /usr/share/lrrd/client/plugins-auto/ps_ /etc/lrrd/client.d/ps_exim # # ...will monitor number of exim-processes. # # Parameters: # # config (required) # autoconf (optional - used by lrrd-config) # suggest (optional - used by lrrd-config) # # Magic markers (optional): #%# family=auto #%# capabilities=autoconf suggest name=`basename $0 | sed 's/^ps_//g'` if [ "$1" = "autoconf" ]; then echo yes exit 0 fi if [ "$1" = "suggest" ]; then exit 0 fi if [ "$1" = "config" ]; then echo graph_title Number of $name processes echo 'graph_args --base 1000 --vertical-label processes -l 0' echo "count.label $name" echo 'processes.draw LINE2' exit 0 fi echo -n "count.value " pgrep -f -l "$name" | grep -v grep | wc -l # For systems without pgrep #ps auxwww | grep "\<$name\( \|$\)" | grep -v grep | wc -l