File Coverage

blib/lib/Monitoring/GLPlugin/SNMP/CSF.pm
Criterion Covered Total %
statement 6 20 30.0
branch 0 8 0.0
condition 0 6 0.0
subroutine 2 3 66.6
pod 0 1 0.0
total 8 38 21.0


line stmt bran cond sub pod time code
1             package Monitoring::GLPlugin::SNMP::CSF;
2             #our @ISA = qw(Monitoring::GLPlugin::SNMP);
3 1     1   3 use Digest::MD5 qw(md5_hex);
  1         1  
  1         42  
4 1     1   3 use strict;
  1         1  
  1         233  
5              
6             sub create_statefile {
7 0     0 0   my ($self, %params) = @_;
8 0           my $extension = "";
9 0 0         $extension .= $params{name} ? '_'.$params{name} : '';
10 0 0         if ($self->opts->community) {
11 0           $extension .= md5_hex($self->opts->community);
12             }
13 0           $extension =~ s/\//_/g;
14 0           $extension =~ s/\(/_/g;
15 0           $extension =~ s/\)/_/g;
16 0           $extension =~ s/\*/_/g;
17 0           $extension =~ s/\s/_/g;
18 0 0 0       if ($self->opts->snmpwalk && ! $self->opts->hostname) {
    0 0        
19 0           return sprintf "%s/%s_%s%s", $self->statefilesdir(),
20             'snmpwalk.file'.md5_hex($self->opts->snmpwalk),
21             $self->clean_path($self->mode), $self->clean_path(lc $extension);
22             } elsif ($self->opts->snmpwalk && $self->opts->hostname eq "walkhost") {
23 0           return sprintf "%s/%s_%s%s", $self->statefilesdir(),
24             'snmpwalk.file'.md5_hex($self->opts->snmpwalk),
25             $self->clean_path($self->mode), $self->clean_path(lc $extension);
26             } else {
27 0           return sprintf "%s/%s_%s%s", $self->statefilesdir(),
28             $self->opts->hostname,
29             $self->clean_path($self->mode), $self->clean_path(lc $extension);
30             }
31             }
32              
33             1;
34              
35             __END__