line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Zabbix2::API::HostGroup; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
405
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
17
|
|
5
|
1
|
|
|
1
|
|
15
|
use 5.010; |
|
1
|
|
|
|
|
3
|
|
6
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
46
|
|
7
|
1
|
|
|
1
|
|
4
|
use autodie; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
8
|
1
|
|
|
1
|
|
3018
|
use utf8; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
366
|
use Zabbix2::API::Host; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
5
|
use Moo::Lax; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
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__ |