/usr/share/perl5/Munin/Master/Group.pm is in munin 1.4.6-3ubuntu3.4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | package Munin::Master::Group;
use base qw(Munin::Master::GroupRepository);
# $Id: Group.pm 2831 2009-11-03 23:32:48Z janl $
use warnings;
use strict;
use Carp;
use Munin::Master::Host;
sub new {
my ($class, $group_name, $parent) = @_;
my $self = {
group_name => $group_name,
hosts => {},
};
return bless $self, $class;
}
sub add_attributes {
my ($self, $attributes) = @_;
my %valid_attributes = map {$_ => 1} qw(node_order local_address contacts);
croak "Invalid attributes: " . join(', ', keys %$attributes)
if grep { !$valid_attributes{$_} } keys %$attributes;
%$self = (%$self, %$attributes);
}
sub add_host {
my ($self, $host) = @_;
$self->{hosts}{$host->{host_name}} = $host;
}
sub give_attributes_to_hosts {
my ($self) = @_;
my %not_inheritable = map {$_ => 1} qw(group_name hosts node_order);
my %attributes = grep { !$not_inheritable{$_} } %$self;
map { $_->add_attributes_if_not_exists(\%attributes) } values %{$self->{hosts}};
return 1;
}
sub get_all_hosts {
my ($self) = @_;
my @hosts = ();
for my $group (values %{$self->{groups}}) {
push @hosts, $group->get_all_hosts;
}
push @hosts, values %{$self->{hosts}};
return @hosts;
}
1;
__END__
=head1 NAME
Munin::Master::Group - Holds information on host groups.
=head1 SYNOPSIS
FIX
=head1 METHODS
=over
=item B<new>
FIX
=item B<add_attributes>
FIX
=item B<add_host>
FIX
=item B<give_attributes_to_hosts>
FIX
=item B<get_all_hosts>
FIX
=back
|