line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Monitoring::GLPlugin::SNMP::TableItem; |
2
|
|
|
|
|
|
|
our @ISA = qw(Monitoring::GLPlugin::SNMP::CSF Monitoring::GLPlugin::TableItem Monitoring::GLPlugin::SNMP); |
3
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
475
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub ensure_index { |
6
|
0
|
|
|
0
|
0
|
|
my ($self, $key) = @_; |
7
|
0
|
|
0
|
|
|
|
$self->{$key} ||= $self->{flat_indices}; |
8
|
|
|
|
|
|
|
} |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub unhex_ip { |
11
|
0
|
|
|
0
|
0
|
|
my ($self, $value) = @_; |
12
|
0
|
0
|
0
|
|
|
|
if ($value && $value =~ /^0x(\w{8})/) { |
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
13
|
0
|
|
|
|
|
|
$value = join(".", unpack "C*", pack "H*", $1); |
14
|
|
|
|
|
|
|
} elsif ($value && $value =~ /^0x(\w{2} \w{2} \w{2} \w{2})/) { |
15
|
0
|
|
|
|
|
|
$value = $1; |
16
|
0
|
|
|
|
|
|
$value =~ s/ //g; |
17
|
0
|
|
|
|
|
|
$value = join(".", unpack "C*", pack "H*", $value); |
18
|
|
|
|
|
|
|
} elsif ($value && $value =~ /^([A-Z0-9]{2} [A-Z0-9]{2} [A-Z0-9]{2} [A-Z0-9]{2})/i) { |
19
|
0
|
|
|
|
|
|
$value = $1; |
20
|
0
|
|
|
|
|
|
$value =~ s/ //g; |
21
|
0
|
|
|
|
|
|
$value = join(".", unpack "C*", pack "H*", $value); |
22
|
|
|
|
|
|
|
} elsif ($value && unpack("H8", $value) =~ /(\w{2})(\w{2})(\w{2})(\w{2})/) { |
23
|
0
|
|
|
|
|
|
$value = join(".", map { hex($_) } ($1, $2, $3, $4)); |
|
0
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
} |
25
|
0
|
|
|
|
|
|
return $value; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub unhex_mac { |
29
|
0
|
|
|
0
|
0
|
|
my ($self, $value) = @_; |
30
|
0
|
0
|
0
|
|
|
|
if ($value && $value =~ /^0x(\w{12})/) { |
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
31
|
0
|
|
|
|
|
|
$value = join(".", unpack "C*", pack "H*", $1); |
32
|
|
|
|
|
|
|
} elsif ($value && $value =~ /^0x(\w{2}\s*\w{2}\s*\w{2}\s*\w{2}\s*\w{2}\s*\w{2})/) { |
33
|
0
|
|
|
|
|
|
$value = $1; |
34
|
0
|
|
|
|
|
|
$value =~ s/ //g; |
35
|
0
|
|
|
|
|
|
$value = join(":", unpack "C*", pack "H*", $value); |
36
|
|
|
|
|
|
|
} elsif ($value && unpack("H12", $value) =~ /(\w{2})(\w{2})(\w{2})(\w{2})(\w{2})(\w{2})/) { |
37
|
0
|
|
|
|
|
|
$value = join(":", map { hex($_) } ($1, $2, $3, $4, $5, $6)); |
|
0
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
} |
39
|
0
|
|
|
|
|
|
return $value; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub unhex_octet_string { |
43
|
0
|
|
|
0
|
0
|
|
my ($self, $value) = @_; |
44
|
0
|
|
|
|
|
|
my $original = $value; |
45
|
0
|
|
|
|
|
|
$value =~ s/ //g; |
46
|
0
|
0
|
0
|
|
|
|
if ($value && $value =~ /^0x([0-9a-zA-Z]+)$/) { |
|
|
0
|
0
|
|
|
|
|
47
|
0
|
|
|
|
|
|
$value = join("", unpack "A*", pack "H*", $1); |
48
|
|
|
|
|
|
|
} elsif ($value && $value =~ /^([0-9a-zA-Z]+)$/) { |
49
|
0
|
|
|
|
|
|
$value = join("", unpack "A*", pack "H*", $1); |
50
|
|
|
|
|
|
|
} else { |
51
|
0
|
|
|
|
|
|
$value = $original; |
52
|
|
|
|
|
|
|
} |
53
|
0
|
|
|
|
|
|
return $value; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |