line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Zabbix2::API::HostGroup;
|
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
519
|
use strict;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings;
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
25
|
|
5
|
1
|
|
|
1
|
|
31
|
use 5.010;
|
|
1
|
|
|
|
|
4
|
|
6
|
1
|
|
|
1
|
|
5
|
use Carp;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
64
|
|
7
|
1
|
|
|
1
|
|
11
|
use autodie;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
8
|
1
|
|
|
1
|
|
5672
|
use utf8;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
13
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
546
|
use Zabbix2::API::Host;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
8
|
use Moo;
|
|
1
|
|
|
|
|
2
|
|
|
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__
|