mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
Initial version
This commit is contained in:
parent
ca88b23225
commit
835f964ee5
61
plugins/other/multips
Executable file
61
plugins/other/multips
Executable file
@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Script to monitor number of processes. Programs are configured
|
||||
# in /etc/munin/plugin-conf.d/munin-node
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by lrrd-config)
|
||||
#
|
||||
# Configuration example
|
||||
#
|
||||
# [multips]
|
||||
# env.multipsnames pop3d imapd sslwrap
|
||||
# env.regex_imapd ^[0-9]* imapd:
|
||||
# env.regex_pop3d ^[0-9]* pop3d:
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.1 2004/01/29 19:42:45 jimmyo
|
||||
# Added a new plugin generic/multips to count several procs in one graph. (SF#885579)
|
||||
#
|
||||
#
|
||||
# Magic markers (optional):
|
||||
#%# family=manual
|
||||
#%# capabilities=autoconf
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ -z "$multipsnames" ]; then
|
||||
echo "Configuration required $multipsnames"
|
||||
else
|
||||
echo yes
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo graph_title Number of selected processes
|
||||
echo 'graph_category processes'
|
||||
echo 'graph_args --base 1000 --vertical-label processes -l 0'
|
||||
for name in $multipsnames; do
|
||||
echo "$name.label $name"
|
||||
echo "$name.draw LINE2"
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for name in $multipsnames; do
|
||||
printf "$name.value "
|
||||
|
||||
eval REGEX='"${regex_'$name'-\<'$name'\>}"'
|
||||
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
|
||||
done
|
Loading…
Reference in New Issue
Block a user