line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Zabbix2::API::HostGroup; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
845
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
60
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
44
|
|
5
|
1
|
|
|
1
|
|
36
|
use 5.010; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
47
|
|
6
|
1
|
|
|
1
|
|
7
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
114
|
|
7
|
1
|
|
|
1
|
|
7
|
use autodie; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
12
|
|
8
|
1
|
|
|
1
|
|
6172
|
use utf8; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
11
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
773
|
use Zabbix2::API::Host; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
52
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
14
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
extends qw/Zabbix2::API::CRUDE/; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has 'hosts' => (is => 'ro', |
17
|
|
|
|
|
|
|
lazy => 1, |
18
|
|
|
|
|
|
|
builder => '_fetch_hosts'); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub id { |
21
|
|
|
|
|
|
|
## mutator for id |
22
|
0
|
|
|
0
|
1
|
|
my ($self, $value) = @_; |
23
|
0
|
0
|
|
|
|
|
if (defined $value) { |
24
|
0
|
|
|
|
|
|
$self->data->{groupid} = $value; |
25
|
0
|
|
|
|
|
|
return $self->data->{groupid}; |
26
|
|
|
|
|
|
|
} else { |
27
|
0
|
|
|
|
|
|
return $self->data->{groupid}; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _prefix { |
32
|
0
|
|
|
0
|
|
|
my (undef, $suffix) = @_; |
33
|
0
|
0
|
0
|
|
|
|
if ($suffix and $suffix =~ m/ids?/) { |
|
|
0
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
return 'group'.$suffix; |
35
|
|
|
|
|
|
|
} elsif ($suffix) { |
36
|
0
|
|
|
|
|
|
return 'hostgroup'.$suffix; |
37
|
|
|
|
|
|
|
} else { |
38
|
0
|
|
|
|
|
|
return 'hostgroup'; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub _extension { |
43
|
0
|
|
|
0
|
|
|
return (output => 'extend'); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub name { |
47
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
48
|
0
|
|
0
|
|
|
|
return $self->data->{name} || ''; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub _fetch_hosts { |
52
|
0
|
|
|
0
|
|
|
my $self = shift; |
53
|
0
|
|
|
|
|
|
my $hosts = $self->{root}->fetch('Host', params => { groupids => [ $self->id ] }); |
54
|
0
|
|
|
|
|
|
return $hosts; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
__END__ |