[Nagiosplug-help] Check_procs -C problem (UNCLASSIFIED)

kyle smith kyles at apple.com
Tue May 20 20:07:57 CEST 2008


Yeah there are some limitations in check_procs that I found also. It  
seems check_procs on OSX uses "ps aux" rather than "ps auxwww" and I  
needed to identfy processes whose characterstics were only shown with  
auxwww. I tried to customize this via configure options as suggested  
elsewhere but this didn't work.

I ended up writing my own plugin in ksh called "check_long_procs"  
which I've included below. This plugin does not meet all the official  
nagios req's for a plugin but it works great for what I need. You  
could probably edit this to meet your needs. Good luck!

kyle

*** script begins here ***
#!/bin/ksh

#
# nagios plugin to check for existence of java processes with long  
argument strings
# written because attempts to customize the ps command in nagios- 
supplied check_procs plugin unsuccessful
# process types checked for are Confluence, Jira, TeamCityAgent,  
TeamCityServer, AuthServer, SyncServer
# all of these are java processes, argument list of ps auxwww shows  
specifics
# if process of type specified is present return a 0 (OK) else return  
a 2 (CRITICAL)
# supports range of number of procs x:y x: (x is min) :y (y is max)
#

set -a
PATH=/bin:/usr/bin
CMD=check_long_procs
USAGE="USAGE: $CMD -c min:max -a Confluence | Jira | TeamCityAgent |  
TeamCityServer | AuthServer | SyncServer"

bye() {
         rc=$1
         shift
         (( $# > 0 )) \
                 && print -u2 "$*"
         exit $rc
}

#
# need 4 input args
#
(($# != 4)) && bye $? $USAGE

# get input args
while getopts c:a: x
do
         case  "$x" in
         c)
                 range="$OPTARG"
                 ;;
         a)
                 process_type="$OPTARG"
                 ;;
         *)
                 bye 4 $USAGE
                 ;;
         esac
done

# case of :x means x is max, set min to 0
# case of x: means x is min, set max to 100
min=${range%:*}
max=${range#*:}
min=${min:=0}
max=${max:=100}

#
# set $process_args with specific strings to look for in ps output
#
case "$process_type" in
         Confluence)
                 process_args="java.awt.headless=true"
                 ;;
         Jira)
                 process_args="jira.jelly.on=true"
                 ;;
         TeamCityAgent)
                 process_args="jetbrains.buildServer.agent.Launcher"
                 ;;
         TeamCityServer)
                 process_args="log4j.configuration=file:/usr/local/ 
teamcity/server/"
                 ;;
         AuthServer)
                 process_args="SERVICE_NAME=authserver"
                 ;;
         SyncServer)
                 process_args="SERVICE_NAME=syncserver"
                 ;;
         *)
                 print "Invalid process type"
                 bye $? $USAGE
esac

#
# determine number of processes of type
#
typeset -i num_procs
num_procs=$(ps auxwww | grep $process_args | grep -v grep | wc -l)

#
# in range? awesome! no? critical!
#
if ((((num_procs>=$min)) && ((num_procs<=$max))))
then
         print "PROCS OK: $num_procs procs of type $process_type found"
         exit
else
         print "PROCS CRITICAL: $num_procs procs of type  
$process_type found"
         exit 2
fi

*** end of script ***

On May 20, 2008, at 10:45 AM, Moore, Stephen C Mr CTR USA TRADOC wrote:

> Classification:  UNCLASSIFIED
> Caveats: NONE
>
>
> Hello list,
>
> I am having problems with the check_procs plugin v1.4.11.  When  
> checking
> for specific processes with the -C option, I seem to be limited to a
> process name of 15 characters or less.  Not sure if this is an  
> arbitrary
> decision or a bug, but it's a problem for me.
>
> [root at pc200 libexec]# ps aux | grep condor
> condor   10273  0.0  0.0 21968 5556 ?        Ss   May19   0:32
> condor_collector -f
> condor   10289  0.0  0.1 22916 6156 ?        Ss   May19   0:12
> condor_negotiator -f
> condor   10290  0.0  0.0 20408 4168 ?        Ss   May19   0:00
> condor_schedd -f
>
> [root at pc200 libexec]# ./check_procs -C condor_schedd
> PROCS OK: 1 process with command name 'condor_schedd'
>
> [root at pc200 libexec]# ./check_procs -C condor_collector
> PROCS OK: 0 processes with command name 'condor_collector'
>
> I tried this out with other processes greater than 15 characters  
> and had
> the same problem.
>
> Appreciate your help.
>
> __
> Stephen C. Moore, RHCE
> Senior Systems Engineer/IASO
> Unitec ISOSS TRAC-WSMR
> (575) 678-7922, DSN: 258
> SIPR: moores at trac-wsmr.army.smil.mil
>
> Classification:  UNCLASSIFIED
> Caveats: NONE
>
>
> ---------------------------------------------------------------------- 
> ---
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Nagiosplug-help mailing list
> Nagiosplug-help at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagiosplug-help
> ::: Please include plugins version (-v) and OS when reporting any  
> issue.
> ::: Messages without supporting info will risk being sent to /dev/null





More information about the Help mailing list