Skip to content

Commit

Permalink
master: add "use_default_node"
Browse files Browse the repository at this point in the history
  • Loading branch information
steveschnepp committed Jul 10, 2013
1 parent a928d35 commit 6adf38a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions common/lib/Munin/Common/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ my %legal = map { $_ => 1 } (
"html_rename",
"worker_start_delay",
"num_messages",
"use_default_node",
);

my %bools = map { $_ => 1} qw(yes no true false on off 1 0);
Expand Down
1 change: 1 addition & 0 deletions master/lib/Munin/Master/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ my %booleans = map {$_ => 1} qw(
tls_verify_certificate
update
use_node_name
use_default_node
);


Expand Down
13 changes: 10 additions & 3 deletions master/lib/Munin/Master/Node.pm
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ sub _do_connect {
}
};

INFO "node $self->{host} advertised itself as $self->{node_name} instead." if $self->{node_name} && $self->{node_name} ne $self->{host};

return 1;
}

Expand Down Expand Up @@ -237,15 +239,20 @@ sub list_plugins {
? $self->{node_name}
: $self->{host};

if (not $host) {
my $use_default_node = defined($self->{configref}{use_default_node})
? $self->{configref}{use_default_node}
: $config->{use_default_node};

if (! $use_default_node && ! $host) {
die "[ERROR] Couldn't find out which host to list on $host.\n";
}

$self->_node_write_single("list $host\n");
my $list_host = $use_default_node ? "" : $host;
$self->_node_write_single("list $list_host\n");
my $list = $self->_node_read_single();

if (not $list) {
WARN "[WARNING] Config node $self->{host} listed no services for $host. Please see http://munin-monitoring.org/wiki/FAQ_no_graphs for further information.";
WARN "[WARNING] Config node $self->{host} listed no services for $host, (advertised as $self->{node_name}). Please see http://munin-monitoring.org/wiki/FAQ_no_graphs for further information.";
}

return split / /, $list;
Expand Down

0 comments on commit 6adf38a

Please sign in to comment.