/usr/share/munin/munin-update is in munin 2.0.19-3.
This file is owned by root:root, with mode 0o755.
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 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | #!/usr/bin/perl
# -*- cperl -*-
use warnings;
use strict;
# $Id$
use English qw(-no_match_vars);
use Getopt::Long;
use Pod::Usage;
use Log::Log4perl qw(:easy);
use Munin::Master::Update;
use Munin::Master::Logger;
use Munin::Master::Config;
use Munin::Master::Utils;
# TODO
#
# - Include data from Munin::Master::Config in config dump?
# - nested groups
Getopt::Long::Configure(qw(auto_help));
my $globconfig = Munin::Master::Config->instance();
my $config = $globconfig->{'config'};
sub main {
exit_if_run_by_super_user();
configure();
logger_open($config->{'logdir'});
logger_debug() if $config->{debug};
my $update = Munin::Master::Update->new();
$update->run();
return 0;
}
sub configure {
my %args = parse_args();
# Uses default file if config_file is not defined by arguments.
$config->parse_config_from_file($args{config_file});
if (defined $config->{'includedir'}) {
my $dirname = $config->{'includedir'};
my $DIR;
opendir($DIR, $dirname) or
WARN "[Warning] Could not open includedir directory $dirname: $OS_ERROR\n";
my @files = grep { ! /^\.|~$/ } readdir($DIR);
closedir($DIR);
@files = map { $_ = $dirname.'/'.$_; } (sort @files);
foreach my $f (@files) {
$config->parse_config_from_file($f);
}
}
# Arguments overrides settings from config file. Note that
# this only handles settings that are on the base level, not
# anything within groups or hosts.
$config->set(\%args);
}
sub parse_args {
my $do_usage = 0;
my $do_version = 0;
my %args = (
"version" => \&print_version_and_exit,
);
GetOptions (
\%args,
"config_file=s",
"debug!",
"fork!",
"host=s@",
"service=s@",
"timeout=s",
"version!",
) or pod2usage(1);
delete $args{version};
$args{limit_hosts} = { map { $_ => 1 } @{$args{host}} };
delete $args{host};
$args{limit_services} = { map { $_ => 1 } @{$args{service}} };;
delete $args{service};
return %args;
}
exit main() unless caller;
1;
__END__
=encoding utf8
=head1 NAME
munin-update - A program to gather data from machines running munin-node
=head1 SYNOPSIS
munin-update [options]
Options:
--config_file=<file> Use <file> as configuration file.
--[no]debug Enable [or disable] debug messages. [--nodebug]
--[no]fork Query hosts in parallell (--fork), or
sequentially (--nofork). [--fork]
--host <host> Limit graphed hosts to <host>. Multiple --host
options may be supplied.
--service <service> Limit graphed services to <service>. Multiple
--service options may be supplied.
--timeout=<seconds> TCP timeout when talking to clients. [$timeout]
--help View this message.
--version View version information.
=head1 OPTIONS
=over 5
=item B<< --config_file=<file> >>
Use E<lt>fileE<gt> as the configuration file. [/etc/munin/munin.conf]
=item B<< --[no]debug >>
If set, log debug messages. [--nodebug]
=item B<< --[no]fork >>
If set, will fork off one process for each host. [--fork]
=item B<< --host <host> >>
Limit fetched data to those from E<lt>host<gt>. Multiple --host
options may be supplied. [unset]
=item B<< --service <service> >>
Limit fetched data to those of E<lt>serviceE<gt>. Multiple --service
options may be supplied. [unset]
=item B<< --timeout <seconds> >>
Set the network timeout to <seconds>. [180]
=item B<< --help >>
Print the help message then exit.
=item B<< --version >>
Print version information then exit.
=back
=head1 DESCRIPTION
Munin-update is a part of the package Munin, which is used in
combination with Munin's node. Munin is a group of programs to gather
data from Munin's nodes, graph them, create html-pages, and optionally
warn Nagios about any off-limit values.
Munin-update does the gathering. It is usually only used from within
munin-cron.
It contacts each host's munin-node in turn, gathers data from it, and
stores them in .rrd-files. If necessary, it will create the rrd-files
and the directories to store them in.
=head1 FILES
/etc/munin/munin.conf
/var/lib/munin/*
/var/log/munin/munin-update
/var/run/munin/*
=head1 BUGS
For a list of bugs concerning munin-update, see FIX<point to right
ticket report>.
Please report bugs in the bug tracker at L<http://munin-monitoring.org/>.
=head1 AUTHORS
The Munin Team. FIX
=head1 COPYRIGHT
Copyright © 2002-2009 Jimmy Olsen, Audun Ytterdal, Tore Andersson, Kjell-Magne Øierud, Linpro AS, Redpill Linpro AS
This is free software; see the source for copying conditions. There is
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
This program is released under the GNU General Public License.
|