summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fbb6e27)
raw | patch | inline | side by side (parent: fbb6e27)
author | Ton Voon <tonvoon@users.sourceforge.net> | |
Wed, 26 Mar 2003 03:57:58 +0000 (03:57 +0000) | ||
committer | Ton Voon <tonvoon@users.sourceforge.net> | |
Wed, 26 Mar 2003 03:57:58 +0000 (03:57 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@463 f882894a-f735-0410-b71e-b25c423dba1c
configure.in | patch | blob | history | |
plugins/check_procs.c | patch | blob | history |
diff --git a/configure.in b/configure.in
index 646519f89d3b86671e9cc329a5c3eac669ae4bc8..5e5ee361f152aa5496c6e60202037f349d501049 100644 (file)
--- a/configure.in
+++ b/configure.in
dnl #### Process table test
AC_PATH_PROG(PATH_TO_PS,ps)
-ac_cv_use_ps_vars=no
AC_MSG_CHECKING(for ps syntax)
dnl STAT UCOMM VSZ RSS USER UID PPID COMMAND
if ps -weo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
then
- ac_cv_use_ps_vars=yes
ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
- ac_cv_ps_raw_command="$PATH_TO_PS -weo 'stat user ppid args'"
ac_cv_ps_command="$PATH_TO_PS -weo 'stat uid ppid comm args'"
ac_cv_ps_format="%s %d %d %s %n"
ac_cv_vsz_command="$PATH_TO_PS -weo 'vsz comm'"
elif ps waxco 'state command vsz rss uid user ppid' 2>/dev/null | \
egrep -i ["^STAT +COMMAND +VSZ +RSS +UID +USER +PPID"] >/dev/null
then
- ac_cv_use_ps_vars=yes
ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
- ac_cv_ps_raw_command="$PATH_TO_PS waxo 'state uid ppid command'"
ac_cv_ps_command="$PATH_TO_PS waxco 'state uid ppid command command'"
ac_cv_ps_format="%s %d %d %s %n"
ac_cv_vsz_command="$PATH_TO_PS waxco 'vsz command'"
elif ps waxno 'state comm vsz rss uid user ppid args' 2>/dev/null | \
egrep -i ["^S +COMMAND +VSZ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
then
- ac_cv_use_ps_vars=yes
ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
- ac_cv_ps_raw_command="$PATH_TO_PS waxno 'state user ppid comm'"
ac_cv_ps_command="$PATH_TO_PS waxno 'state uid ppid comm args'"
ac_cv_ps_format="%s %d %d %s %n"
ac_cv_vsz_command="$PATH_TO_PS waxno 'vsz comm'"
elif ps -laxnwww 2>/dev/null | \
egrep -i ["^ *F(LAGS)? +UID +PID +PPID +CP +PRI +NI +(SZ)|(VSZ)|(SIZE) +RSS +WCHAN +STAT? +TTY? +TIME +COMMAND"] >/dev/null
then
- ac_cv_use_ps_vars=yes
- ac_cv_ps_raw_command="$PATH_TO_PS laxnwww"
ac_cv_ps_varlist="[&procuid,&procppid,procstat,&pos,procprog]"
ac_cv_ps_command="$PATH_TO_PS -laxnwww"
ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %*s %*s %*s %s %*s %*s %n%s"
elif ps laxnwww 2>/dev/null | \
egrep -i ["^ *F(LAGS)? +UID +PID +PPID +PRI +NI +(VSZ)|(SIZE) +RSS +WCHAN +STAT? TTY +TIME +COMMAND"] >/dev/null
then
- ac_cv_use_ps_vars=yes
- ac_cv_ps_raw_command="$PATH_TO_PS laxnwww"
ac_cv_ps_varlist="[&procuid,&procppid,procstat,&pos,procprog]"
ac_cv_ps_command="$PATH_TO_PS laxnwww"
ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %*s %*s %s %*s %*s %n%s"
@@ -707,9 +696,7 @@ dnl OpenBSD (needs to come early because -exo appears to work, but does not give
elif ps -axo 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
then
- ac_cv_use_ps_vars=yes
ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
- ac_cv_ps_raw_command="$PATH_TO_PS -axo 'stat user ppid args'"
ac_cv_ps_command="$PATH_TO_PS -axo 'stat uid ppid comm args'"
ac_cv_ps_format="%s %d %d %s %n"
ac_cv_vsz_command="$PATH_TO_PS -axo 'vsz comm'"
@@ -723,9 +710,7 @@ dnl AIX 4.3.3 - needs verification. This works for Tru64 - needs %*[ +] in PS_FO
elif ps -ao 'stat comm vsz rss user uid ppid args' 2>/dev/null | \
egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
then
- ac_cv_use_ps_vars=yes
ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
- ac_cv_ps_raw_command="$PATH_TO_PS -ao 'stat user ppid args'"
ac_cv_ps_command="$PATH_TO_PS -ao 'stat uid ppid comm args'"
ac_cv_ps_format="[["%s%*[ +] %d %d %s %n"]]"
ac_cv_vsz_command="$PATH_TO_PS -ao 'vsz comm'"
elif ps -eo 's comm vsz rss user uid ppid args' 2>/dev/null | \
egrep -i ["^S[TAUES]* +C[OMDNA]+ +[VSIZE]+ +U[SER]+ +U[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null
then
- ac_cv_use_ps_vars=yes
ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
- ac_cv_ps_raw_command="$PATH_TO_PS -eo 's user ppid args'"
ac_cv_ps_command="$PATH_TO_PS -eo 's uid ppid comm args'"
ac_cv_ps_format="%s %d %d %s %n"
ac_cv_vsz_command="$PATH_TO_PS -eo 'vsz comm'"
elif ps -Ao 's comm vsz rss uid user ppid args' 2>/dev/null | \
egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
then
- ac_cv_use_ps_vars=yes
ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
- ac_cv_ps_raw_command="$PATH_TO_PS -Ao 's user ppid args'"
ac_cv_ps_command="$PATH_TO_PS -Ao 's uid ppid comm args'"
ac_cv_ps_format="%s %d %d %s %n"
ac_cv_vsz_command="$PATH_TO_PS -Ao 'vsz comm'"
elif ps -Ao 'status comm vsz rss uid user ppid args' 2>/dev/null | \
egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
then
- ac_cv_use_ps_vars=yes
ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
- ac_cv_ps_raw_command="$PATH_TO_PS -Ao 'status user ppid args'"
ac_cv_ps_command="$PATH_TO_PS -Ao 'status uid ppid comm args'"
ac_cv_ps_format="%s %d %d %s %n"
ac_cv_vsz_command="$PATH_TO_PS -Ao 'vsz comm'"
elif ps -Ao 'state comm vsz rss uid user ppid args' 2>/dev/null | \
egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
then
- ac_cv_use_ps_vars=yes
ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
- ac_cv_ps_raw_command="$PATH_TO_PS -Ao 'state user ppid args'"
ac_cv_ps_command="$PATH_TO_PS -Ao 'state uid ppid comm args'"
ac_cv_ps_format="%s %d %d %s %n"
ac_cv_vsz_command="$PATH_TO_PS -Ao 'vsz comm'"
elif ps -ao 'state command vsz rss user ppid args' 2>/dev/null | \
egrep -i ["^S[TAUES]* +C[OMDNA]+ +V[SIZE]+ +RSS +UID +USER +PPID +[RGSCOMDNA]+"] >/dev/null
then
- ac_cv_use_ps_vars=yes
ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
- ac_cv_ps_raw_command="$PATH_TO_PS -ao 'state user ppid args'"
ac_cv_ps_command="$PATH_TO_PS -ao 'state uid ppid command args'"
ac_cv_ps_format="%s %d %d %s %n"
ac_cv_vsz_command="$PATH_TO_PS -ao 'vsz command'"
elif ps -el 2>/dev/null | \
egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
then
- ac_cv_use_ps_vars=yes
ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
ac_cv_ps_command="$PATH_TO_PS -el"
ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
elif ps -el 2>/dev/null | \
egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +P +ADDR +SZ +RSS +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
then
- ac_cv_use_ps_vars=yes
ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
ac_cv_ps_command="$PATH_TO_PS -el"
ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
elif ps -el 2>/dev/null | \
egrep -i ["^ *F +S +UID +PID +PPID +C +PRI +NI +ADDR +SZ +WCHAN +TTY +TIME +[RGSCOMDNA]+"] >/dev/null
then
- ac_cv_use_ps_vars=yes
ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
ac_cv_ps_command="$PATH_TO_PS -el"
ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
elif ps glaxen 2>/dev/null | \
egrep -i ["^ *F +UID +PID +PPID +PRI +NI +VSZ +RSS +WCHAN +STAT +TTY +TIME +COMMAND"] >/dev/null
then
- ac_cv_use_ps_vars=yes
ac_cv_ps_varlist="[&procuid,&procppid,procstat,&pos,procprog]"
ac_cv_ps_command="$PATH_TO_PS glaxen"
ac_cv_ps_format="%*s %d %*s %d %*s %*s %*s %*s %*s %s %*s %*s %n%s"
elif ps waxo 'state vsz rss uid user ppid ucomm command' 2>/dev/null | \
egrep -i ["^STAT +VSZ +RSS +UID +USER +PPID +UCOMM +COMMAND"] >/dev/null
then
- ac_cv_use_ps_vars=yes
ac_cv_ps_varlist="[procstat,&procuid,&procppid,procprog,&pos]"
- ac_cv_ps_raw_command="$PATH_TO_PS waxo 'state uid ppid command'"
ac_cv_ps_command="$PATH_TO_PS waxo 'state uid ppid ucomm command'"
ac_cv_ps_format="%s %d %d %s %n"
ac_cv_vsz_command="$PATH_TO_PS waxco 'vsz command'"
elif ps -Al 2>/dev/null | \
egrep -i ["^ *F +S +UID +PID +PPID +CLS +PRI +NI +C +ADDR +SZ +WCHAN +TTY +TIME +COMD"] >/dev/null
then
- ac_cv_use_ps_vars=yes
ac_cv_ps_varlist="[procstat,&procuid,&procppid,&pos,procprog]"
ac_cv_ps_command="$PATH_TO_PS -Al"
ac_cv_ps_format="%*s %s %d %*s %d %*s %*s %*s %*s %*s %*s %*s %*s %*s %n%s"
AC_MSG_WARN([unable to find usable ps syntax])
fi
-if test "x$ac_cv_use_ps_vars" != "xno"
-then
- AC_DEFINE(USE_PS_VARS,1,[Define if 'ps' will be parsed with sscanf])
-fi
AC_DEFINE_UNQUOTED(PS_VARLIST,$ac_cv_ps_varlist,
[Variable list for sscanf of 'ps' output])
-AC_DEFINE_UNQUOTED(PS_RAW_COMMAND,"$ac_cv_ps_raw_command",
- [Verbatim command to execute for ps in check_netsaint])
AC_DEFINE_UNQUOTED(PS_COMMAND,"$ac_cv_ps_command",
[Verbatim command to execute for ps in check_procs])
AC_DEFINE_UNQUOTED(PS_FORMAT,"$ac_cv_ps_format",
diff --git a/plugins/check_procs.c b/plugins/check_procs.c
index e95a07226d8d7b078593873ac485ce36f5b476ea..29f86bed4a78aba6593a3273fd1fe1105d5bdad4 100644 (file)
--- a/plugins/check_procs.c
+++ b/plugins/check_procs.c
fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process);
while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) {
-#ifdef USE_PS_VARS
cols = sscanf (input_buffer, PS_FORMAT, PS_VARLIST);
-#else
- cols = sscanf (input_buffer, PS_FORMAT, procstat, &procuid,
- &procppid, &pos, procprog);
-#endif
+
/* Zombie processes do not give a procprog command */
if ( cols == 3 && strstr(procstat, zombie) ) {
strcpy(procprog, "");