summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2005-09-20 11:34:34 (GMT)
committerTon Voon <tonvoon@users.sourceforge.net>2005-09-20 11:34:34 (GMT)
commit571e8e5af47c727189798c43095fd903331bc639 (patch)
tree2c5e8b40b42529d090b11f0cd3d3f624ecca7dd6
parent44248b8b2b5b5ae1f7a7e46f382ede00b3e18882 (diff)
downloadmonitoring-plugins-571e8e5af47c727189798c43095fd903331bc639.tar.gz
Support for Tru64 for check_procs + additional test cases
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1231 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r--configure.in19
-rw-r--r--plugins/t/check_procs.t3
2 files changed, 13 insertions, 9 deletions
diff --git a/configure.in b/configure.in
index 76ad013..6b812c6 100644
--- a/configure.in
+++ b/configure.in
@@ -698,14 +698,17 @@ then
698 ac_cv_ps_cols=9 698 ac_cv_ps_cols=9
699 AC_MSG_RESULT([$ac_cv_ps_command]) 699 AC_MSG_RESULT([$ac_cv_ps_command])
700 700
701dnl Tru64 - needs %*[ +] in PS_FORMAT 701dnl Tru64 - needs %*[ +<>] in PS_FORMAT.
702elif ps -ao 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \ 702dnl Has /usr/bin/ps and /sbin/ps - force sbin version
703 egrep -i ["^ *S[TAUES]* +[UCOMDNA]+ +[VSIZE]+ +R[S]+ +U[SER]+ +U[ID]+ +P[ID]+ +P[PID]+ +[RGSCOMDNA]+"] >/dev/null 703dnl Can't use vsize and rssize because comes back with text (eg, 1.5M instead
704then 704dnl of 1500). Will need big changes to check_procs to support
705 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]" 705elif /sbin/ps -eo 'stat uid pid ppid pcpu etime comm args' 2>/dev/null | \
706 ac_cv_ps_command="$PATH_TO_PS -ao 'stat uid pid ppid vsz rss pcpu comm args'" 706 egrep -i ["^ *S +[UID]+ +[PID]+ +[PID]+ +[%CPU]+ +[ELAPSD]+ +[COMMAND]+ +[COMMAND]+"] > /dev/null
707 ac_cv_ps_format=["%s%*[ +] %d %d %d %d %d %f %s %n"] 707then
708 ac_cv_ps_cols=9 708 ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procpcpu,procetime,procprog,&pos]"
709 ac_cv_ps_command="/sbin/ps -eo 'stat uid pid ppid pcpu etime comm args'"
710 ac_cv_ps_format=["%s%*[ +<>] %d %d %d %f %s %s %n"]
711 ac_cv_ps_cols=8
709 AC_MSG_RESULT([$ac_cv_ps_command]) 712 AC_MSG_RESULT([$ac_cv_ps_command])
710 713
711elif ps -eo 's comm vsz rss user uid pid ppid args' 2>/dev/null | \ 714elif ps -eo 's comm vsz rss user uid pid ppid args' 2>/dev/null | \
diff --git a/plugins/t/check_procs.t b/plugins/t/check_procs.t
index cb5f122..91f5c44 100644
--- a/plugins/t/check_procs.t
+++ b/plugins/t/check_procs.t
@@ -10,7 +10,7 @@ use Test;
10use NPTest; 10use NPTest;
11 11
12use vars qw($tests); 12use vars qw($tests);
13BEGIN {$tests = 10; plan tests => $tests} 13BEGIN {$tests = 12; plan tests => $tests}
14 14
15my $t; 15my $t;
16 16
@@ -19,6 +19,7 @@ $t += checkCmd( "./check_procs -w 100000 -c 100000 -s Z", 0, '/^PROCS OK: [0-9
19$t += checkCmd( "./check_procs -w 0 -c 10000000", 1, '/^PROCS WARNING: [0-9]+ process(es)?$/' ); 19$t += checkCmd( "./check_procs -w 0 -c 10000000", 1, '/^PROCS WARNING: [0-9]+ process(es)?$/' );
20$t += checkCmd( "./check_procs -w 0 -c 0", 2, '/^PROCS CRITICAL: [0-9]+ process(es)?$/' ); 20$t += checkCmd( "./check_procs -w 0 -c 0", 2, '/^PROCS CRITICAL: [0-9]+ process(es)?$/' );
21$t += checkCmd( "./check_procs -w 0 -c 0 -s S", 2, '/^PROCS CRITICAL: [0-9]+ process(es)? with /' ); 21$t += checkCmd( "./check_procs -w 0 -c 0 -s S", 2, '/^PROCS CRITICAL: [0-9]+ process(es)? with /' );
22$t += checkCmd( "./check_procs -w 0 -c 10000000 -p 1", 1, "/^PROCS WARNING: [0-9]+ process(es)? with PPID = 1/' );
22 23
23exit(0) if defined($Test::Harness::VERSION); 24exit(0) if defined($Test::Harness::VERSION);
24exit($tests - $t); 25exit($tests - $t);