From: Jan Willamowius Date: Tue, 13 Sep 2005 14:09:24 +0000 (+0000) Subject: no limit on the output lines X-Git-Tag: spong-2_8_0-beta1~19 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=77fead6096a1169a6eb91a42db90680332ee0439;p=spong.git no limit on the output lines --- diff --git a/src/lib/Spong/Client/plugins/check_cpu b/src/lib/Spong/Client/plugins/check_cpu index bc59d11..651ad6e 100755 --- a/src/lib/Spong/Client/plugins/check_cpu +++ b/src/lib/Spong/Client/plugins/check_cpu @@ -4,7 +4,7 @@ $CHECKFUNCS{'cpu'} = \&check_cpu; # This routine checks the 5min CPU load avg from the uptime comand. This # check also return a status of warning if the uptime is less then 1 hour. -# $Id: check_cpu,v 1.3 2001/09/28 19:16:59 sljohnson Exp $ +# $Id: check_cpu,v 1.4 2005/09/13 14:09:24 willamowius Exp $ use Spong::SafeExec qw(safe_exec); @@ -12,13 +12,15 @@ sub check_cpu { my $color = "green"; my $uptime = safe_exec($UPTIME,30); my( $message, $jobs ); + my $LINES = 0; my $s = 'up\s+([^\,]+)\,.*\s(\d+) user.+?' . '[0-9\.]+\,\s*([0-9\.]+)\,\s*([0-9\.]+)\s*$'; my( $up, $users, $load ) = ( $uptime =~ /$s/ ); my @msg = safe_exec($PS,30); - for ( 0..10 ) { $message .= $msg[$_] }; + $LINES = ($#msg - 1) if ($LINES <= 0); + for ( 0..$LINES ) { $message .= $msg[$_] }; $jobs = $#msg; # num of jobs is 1 less number of entries in @msg # Check to see if the system has only been up a short time, and if it has