MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /usr/local/src/munin-1.2.6/node/node.d/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/local/src/munin-1.2.6/node/node.d/ps_.in
#!/bin/sh
#
# Wildcard-script to monitor number of processes. To monitor a
# program, link ps_<program> to this file. E.g.
#
#    ln -s /usr/share/munin/node/plugins-auto/ps_ /etc/munin/node.d/ps_exim
#
# ...will monitor number of exim-processes.
#
# Parameters:
#
# 	config   (required)
# 	autoconf (optional - used by munin-config)
# 	suggest  (optional - used by munin-config)
#
# Configuration variables
#
#   regex - regex to use for filtering pgrep/ps output
#
# Magic markers (optional):
#%# family=auto
#%# capabilities=autoconf suggest

. $MUNIN_LIBDIR/plugins/plugin.sh

myname=`basename $0 | sed 's/^ps_//g'`

name="${name-\<$myname\>}"
REGEX="${regex-\<$name\>}"

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 $myname processes
	echo 'graph_args --base 1000 --vertical-label processes -l 0'
	echo 'graph_category processes'
	echo "count.label $myname"
	exit 0
fi

printf "count.value "

PGREP=`which pgrep`
if [ -n "$PGREP" ]; then
	$PGREP -f -l "$name" | grep "$REGEX" | wc -l
elif [ -x /usr/ucb/ps ]; then
	# Solaris without pgrep. How old is that?
	/usr/ucb/ps auxwww | grep "$REGEX" | grep -v grep | wc -l
else
	ps auxwww | grep "$REGEX" | grep -v grep | wc -l
fi

Anon7 - 2021