From d189784ce252f9f488ffa51a303acb75f2d5bfcf Mon Sep 17 00:00:00 2001 From: rfrail3 Date: Wed, 19 Sep 2012 08:49:07 +0200 Subject: [PATCH] Fix grep command --- plugins/apache/apache_memmory | 4 ++-- plugins/apache/apache_servers | 2 +- plugins/apache/apache_threads | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/apache/apache_memmory b/plugins/apache/apache_memmory index 30dd62bd..9e288b91 100755 --- a/plugins/apache/apache_memmory +++ b/plugins/apache/apache_memmory @@ -59,9 +59,9 @@ if [ "$1" = "config" ]; then exit 0 fi -VAL1=`ps auxf | grep ${PROCS} | grep ${USR} | grep -v grep | wc -l` +VAL1=`ps auxf | grep ${PROCS} | grep ^${USR} | grep -v grep | wc -l` -VAL2=`ps auxf | grep ${PROCS} | grep ${USR} | grep -v grep | awk '{s+=$6} END {print s}'` +VAL2=`ps auxf | grep ${PROCS} | grep ^${USR} | grep -v grep | awk '{s+=$6} END {print s}'` VAL3=`expr $VAL2 / $VAL1` diff --git a/plugins/apache/apache_servers b/plugins/apache/apache_servers index afedcfa8..4af4b08f 100755 --- a/plugins/apache/apache_servers +++ b/plugins/apache/apache_servers @@ -58,7 +58,7 @@ if [ "$1" = "config" ]; then exit 0 fi -VAL1=`ps auxf | grep ${PROCS} | grep ${USR} | grep -v grep | wc -l` +VAL1=`ps auxf | grep ${PROCS} | grep ^${USR} | grep -v grep | wc -l` echo "servers.value $VAL1" diff --git a/plugins/apache/apache_threads b/plugins/apache/apache_threads index 5c0f0b02..d1c9f0f7 100755 --- a/plugins/apache/apache_threads +++ b/plugins/apache/apache_threads @@ -62,10 +62,10 @@ PROCS=$binname # Catch proccess pid -VAL1=`ps auxf | grep ${PROCS} | grep ${USR} | grep -v grep | awk '{print $2}' ` +VAL1=`ps auxf | grep ${PROCS} | grep ^${USR} | grep -v grep | awk '{print $2}' ` # Count pids -COUNT=`ps auxf | grep ${PROCS} | grep ${USR} | grep -v grep | wc -l` +COUNT=`ps auxf | grep ${PROCS} | grep ^${USR} | grep -v grep | wc -l` # Read threads per pid for i in $VAL1; do