line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Monitoring::GLPlugin::SNMP::CSF; |
2
|
|
|
|
|
|
|
#our @ISA = qw(Monitoring::GLPlugin::SNMP); |
3
|
2
|
|
|
2
|
|
11
|
use Digest::MD5 qw(md5_hex); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
89
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
460
|
|
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__ |