line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Zabbix2::API::HostInterface; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
16
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
135
|
|
4
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
79
|
|
5
|
3
|
|
|
3
|
|
75
|
use 5.010; |
|
3
|
|
|
|
|
16
|
|
|
3
|
|
|
|
|
166
|
|
6
|
3
|
|
|
3
|
|
14
|
use Carp; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
288
|
|
7
|
3
|
|
|
3
|
|
16
|
use autodie; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
19
|
|
8
|
3
|
|
|
3
|
|
13246
|
use utf8; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
25
|
|
9
|
|
|
|
|
|
|
|
10
|
3
|
|
|
3
|
|
73
|
use Moo; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
24
|
|
11
|
|
|
|
|
|
|
extends qw/Exporter Zabbix2::API::CRUDE/; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use constant { |
14
|
3
|
|
|
|
|
1580
|
INTERFACE_TYPE_UNKNOWN => 0, |
15
|
|
|
|
|
|
|
INTERFACE_TYPE_AGENT => 1, |
16
|
|
|
|
|
|
|
INTERFACE_TYPE_SNMP => 2, |
17
|
|
|
|
|
|
|
INTERFACE_TYPE_IPMI => 3, |
18
|
|
|
|
|
|
|
INTERFACE_TYPE_JMX => 4, |
19
|
|
|
|
|
|
|
INTERFACE_TYPE_ANY => 255, |
20
|
3
|
|
|
3
|
|
1685
|
}; |
|
3
|
|
|
|
|
5
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our @EXPORT_OK = qw/ |
23
|
|
|
|
|
|
|
INTERFACE_TYPE_UNKNOWN |
24
|
|
|
|
|
|
|
INTERFACE_TYPE_AGENT |
25
|
|
|
|
|
|
|
INTERFACE_TYPE_SNMP |
26
|
|
|
|
|
|
|
INTERFACE_TYPE_IPMI |
27
|
|
|
|
|
|
|
INTERFACE_TYPE_JMX |
28
|
|
|
|
|
|
|
INTERFACE_TYPE_ANY |
29
|
|
|
|
|
|
|
/; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
32
|
|
|
|
|
|
|
interface_types => [ |
33
|
|
|
|
|
|
|
qw/INTERFACE_TYPE_UNKNOWN |
34
|
|
|
|
|
|
|
INTERFACE_TYPE_AGENT |
35
|
|
|
|
|
|
|
INTERFACE_TYPE_SNMP |
36
|
|
|
|
|
|
|
INTERFACE_TYPE_IPMI |
37
|
|
|
|
|
|
|
INTERFACE_TYPE_JMX |
38
|
|
|
|
|
|
|
INTERFACE_TYPE_ANY/ |
39
|
|
|
|
|
|
|
], |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has 'host' => (is => 'ro', |
43
|
|
|
|
|
|
|
lazy => 1, |
44
|
|
|
|
|
|
|
builder => '_fetch_host'); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _prefix { |
47
|
0
|
|
|
0
|
|
|
my (undef, $suffix) = @_; |
48
|
0
|
0
|
|
|
|
|
if ($suffix) { |
49
|
0
|
0
|
|
|
|
|
if ($suffix =~ m/ids?/) { |
50
|
0
|
|
|
|
|
|
return 'interface'.$suffix; |
51
|
|
|
|
|
|
|
} |
52
|
0
|
|
|
|
|
|
return 'hostinterface'.$suffix; |
53
|
|
|
|
|
|
|
} else { |
54
|
0
|
|
|
|
|
|
return 'hostinterface'; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub _extension { |
59
|
0
|
|
|
0
|
|
|
return (output => 'extend'); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub name { |
63
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
64
|
0
|
0
|
|
|
|
|
return $self->data->{useip} == 0 ? $self->data->{dns} : $self->data->{ip}; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub _fetch_host { |
68
|
0
|
|
|
0
|
|
|
my $self = shift; |
69
|
0
|
|
|
|
|
|
my $host = $self->{root}->fetch_single('Host', params => { hostids => [ $self->data->{hostid} ] }); |
70
|
0
|
|
|
|
|
|
return $host; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |
74
|
|
|
|
|
|
|
__END__ |