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

filter: Statementstmt 0.0% 0 / 27 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 42 CC 2 SCAR 11.5
CC
2
Cov
0%
is_dead
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.1
1 package App::MadEye::Plugin::Agent::SNMP::Process;
2 use strict;
3 use warnings;
4 use App::MadEye::Plugin::Agent::Base;
5 use App::MadEye::Util;
6 use List::Util qw/first/;
7  
8 my $hrSWRunPath = '.1.3.6.1.2.1.25.4.2.1.4';
9  
10 sub is_dead {
11 my ($self, $host) = @_;
12  
13 my $process = $self->config->{config}->{process} or die "missing process";
14  
15 my $response = snmp_session(
16 $self,
17 $host => sub {
18 my $session = shift;
19 my $response = $session->get_table(
20 -baseoid => $hrSWRunPath,
21 ) or die "cannot get a $_ : " . $session->error;
22 return $response;
23 }
24 );
25  
26 if (first { $_ eq $process } values %$response) {
27 return; # alive
28 } else {
29 return "404 $process not found";
30 }
31 }
32  
33 1;
34 __END__