Skip to content
Snippets Groups Projects
Commit f0705dda authored by Mark Harrison's avatar Mark Harrison
Browse files

Some Fixes for run_cmd

git-svn-id: https://labs.omniti.com/resmon/trunk@241 8c0face9-b7db-6ec6-c4b3-d5f7145c7d55
parent fdf483da
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ require Exporter; ...@@ -5,7 +5,7 @@ require Exporter;
use vars qw/@ISA @EXPORT/; use vars qw/@ISA @EXPORT/;
@ISA = qw/Exporter/; @ISA = qw/Exporter/;
@EXPORT = qw/cache_command/; @EXPORT = qw/cache_command run_cmd/;
my %commhist; my %commhist;
my %commcache; my %commcache;
...@@ -48,7 +48,7 @@ sub run_cmd { ...@@ -48,7 +48,7 @@ sub run_cmd {
my @lines = <$r>; my @lines = <$r>;
waitpid($pid, 0); waitpid($pid, 0);
delete $children{$pid}; delete $children{$pid};
return join('\n', @lines); return join("", @lines);
} else { } else {
eval { eval {
open(STDOUT, ">&", $w); open(STDOUT, ">&", $w);
......
...@@ -5,7 +5,7 @@ use Resmon::Module; ...@@ -5,7 +5,7 @@ use Resmon::Module;
use Resmon::ExtComm qw/cache_command/; use Resmon::ExtComm qw/cache_command/;
use vars qw/@ISA/; use vars qw/@ISA/;
@ISA = qw/Resmon::Module/; @ISA = qw/Resmon::Module/;
my $DEBUG=1; my $DEBUG=0;
sub handler { sub handler {
......
...@@ -5,7 +5,7 @@ use Resmon::Module; ...@@ -5,7 +5,7 @@ use Resmon::Module;
use Resmon::ExtComm qw/cache_command/; use Resmon::ExtComm qw/cache_command/;
use vars qw/@ISA/; use vars qw/@ISA/;
@ISA = qw/Resmon::Module/; @ISA = qw/Resmon::Module/;
my $DEBUG=2; my $DEBUG=0;
sub handler { sub handler {
......
...@@ -10,6 +10,7 @@ sub handler { ...@@ -10,6 +10,7 @@ sub handler {
my $devorpart = $arg->{'object'}; my $devorpart = $arg->{'object'};
my $output = cache_command("$dfcmd $devorpart", 120); my $output = cache_command("$dfcmd $devorpart", 120);
my ($line) = grep(/$devorpart\s*/, split(/\n/, $output)); my ($line) = grep(/$devorpart\s*/, split(/\n/, $output));
print "$line";
if($line =~ /(\d+)\s+(\d+)\s+(\d+)%/) { if($line =~ /(\d+)\s+(\d+)\s+(\d+)%/) {
$status = "OK"; $status = "OK";
# Check free space for an exact value in KB # Check free space for an exact value in KB
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment