lib/App/MadEye/Plugin/Agent/Process.pm untested

filter: Statementstmt 0.0% 0 / 20 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 31 CC 2 SCAR 12.0
CC
2
Cov
0%
is_dead
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.3
1 package App::MadEye::Plugin::Agent::Process;
2 use strict;
3 use warnings;
4 use App::MadEye::Plugin::Agent::Base;
5  
6 use Net::SSH qw/ssh_cmd/;
7  
8 sub is_dead {
9 my ($self, $host) = @_;
10  
11 my $conf = $self->config->{config};
12 my $pattern = $conf->{pattern} or die "missing pattern";
13  
14 my @result = split /\n/, ssh_cmd($host, "/usr/bin/pgrep -f $pattern");
15  
16 if (scalar(@result) == 0) {
17 return "$pattern not found";
18 } else {
19 return;
20 }
21 }
22
23 1;
24 __END__