line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Zabbix::API::Host; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
4309
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
44
|
|
4
|
2
|
|
|
2
|
|
7
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
50
|
|
5
|
2
|
|
|
2
|
|
35
|
use 5.010; |
|
2
|
|
|
|
|
5
|
|
6
|
2
|
|
|
2
|
|
8
|
use Carp; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
150
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
775
|
use parent qw/Zabbix::API::CRUDE/; |
|
2
|
|
|
|
|
433
|
|
|
2
|
|
|
|
|
9
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub id { |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
## mutator for id |
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
0
|
1
|
|
my ($self, $value) = @_; |
15
|
|
|
|
|
|
|
|
16
|
0
|
0
|
|
|
|
|
if (defined $value) { |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
$self->data->{hostid} = $value; |
19
|
0
|
|
|
|
|
|
return $self->data->{hostid}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
} else { |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
return $self->data->{hostid}; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub prefix { |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
0
|
1
|
|
my (undef, $suffix) = @_; |
32
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
|
if ($suffix) { |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
return 'host'.$suffix; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} else { |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
return 'host'; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub extension { |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
0
|
1
|
|
return ( output => 'extend', |
48
|
|
|
|
|
|
|
select_macros => 'extend', |
49
|
|
|
|
|
|
|
select_groups => 'extend' ); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub collides { |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
return @{$self->{root}->query(method => $self->prefix('.get'), |
58
|
|
|
|
|
|
|
params => { filter => { host => $self->data->{host} }, |
59
|
0
|
|
|
|
|
|
$self->extension })}; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub name { |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
0
|
|
|
|
return $self->data->{host} || ''; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub items { |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
## accessor for items |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
0
|
1
|
|
my ($self, $value) = @_; |
76
|
|
|
|
|
|
|
|
77
|
0
|
0
|
|
|
|
|
if (defined $value) { |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
die 'Accessor items called as mutator'; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
} else { |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
my $items = $self->{root}->fetch('Item', params => { hostids => [ $self->data->{hostid} ] }); |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
$self->{items} = $items; |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
return $self->{items}; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
94
|
|
|
|
|
|
|
__END__ |