mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
Use ${CMD_...} only to check if command exists
and use the real command e.g. grep, sed, etc. in the command line.
This commit is contained in:
parent
f25c788c3d
commit
d0d36f4926
@ -34,35 +34,35 @@ fi
|
|||||||
|
|
||||||
CMD_GREP=`which grep`
|
CMD_GREP=`which grep`
|
||||||
if [ ! -e ${CMD_GREP} ]; then
|
if [ ! -e ${CMD_GREP} ]; then
|
||||||
echo "Command grep (${CMD_GREP}) not found!"
|
echo "Command grep not found!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
CMD_SED=`which sed`
|
CMD_SED=`which sed`
|
||||||
if [ ! -e ${CMD_SED} ]; then
|
if [ ! -e ${CMD_SED} ]; then
|
||||||
echo "Command sed (${CMD_SED}) not found!"
|
echo "Command sed not found!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
CMD_WC=`which wc`
|
CMD_WC=`which wc`
|
||||||
if [ ! -e ${CMD_WC} ]; then
|
if [ ! -e ${CMD_WC} ]; then
|
||||||
echo "Command wc (${CMD_WC}) not found!"
|
echo "Command wc not found!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
CMD_AWK=`which awk`
|
CMD_AWK=`which awk`
|
||||||
if [ ! -e ${CMD_AWK} ]; then
|
if [ ! -e ${CMD_AWK} ]; then
|
||||||
echo "Command awk (${CMD_AWK}) not found!"
|
echo "Command awk not found!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
CMD_BC=`which bc`
|
CMD_BC=`which bc`
|
||||||
if [ ! -e ${CMD_BC} ]; then
|
if [ ! -e ${CMD_BC} ]; then
|
||||||
echo "Command bc (${CMD_BC}) not found!"
|
echo "Command bc not found!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "php_cgi_processes.value "
|
echo -n "php_cgi_processes.value "
|
||||||
ps ax | ${CMD_GREP} -i php-cgi | ${CMD_GREP} -v grep | ${CMD_WC} -l | ${CMD_SED} 's/\t +//' | ${CMD_SED} 's/ *//'
|
ps ax | grep -i php-cgi | grep -v grep | wc -l | sed 's/\t +//' | sed 's/ *//'
|
||||||
|
|
||||||
MEMORY=0
|
MEMORY=0
|
||||||
for mem in `ps avx | ${CMD_GREP} -i php-cgi | ${CMD_GREP} -v grep | ${CMD_GREP} "Ss" | ${CMD_AWK} '{ print $7 }'`; do
|
for mem in `ps avx | grep -i php-cgi | grep -v grep | grep "Ss" | awk '{ print $7 }'`; do
|
||||||
MEMORY=$(($MEMORY + $mem))
|
MEMORY=$(($MEMORY + $mem))
|
||||||
done
|
done
|
||||||
echo -n "php_cgi_ram.value "
|
echo -n "php_cgi_ram.value "
|
||||||
|
Loading…
Reference in New Issue
Block a user