From acd97175b60ff35146fe1aa59edb416aa33d3433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Wed, 21 Mar 2012 15:32:03 -0400 Subject: [PATCH] fix both display of incidents and usage of existing stats we were not using the right key --- plugins/relayd/relayd | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/relayd/relayd b/plugins/relayd/relayd index 7f6523b7..68c237ae 100755 --- a/plugins/relayd/relayd +++ b/plugins/relayd/relayd @@ -146,7 +146,9 @@ save_state($pos); # get missing availability values from relayctl, if necessary for my $host (@hosts) { my $ran = 0; - if (!defined $avail{$host} && !$ran) { + my $clean = clean_fieldname($host); + $clean = clean_fieldname('host'.$host) unless ($clean ne '_'); + if (!defined $avail{$clean} && !$ran) { open(my $status, "relayctl show summary|") or die "can't open relayctl: $!"; while (<$status>) { if (/([\w\.]+)\s+(\d+\.\d+)%/) { @@ -163,12 +165,12 @@ print "multigraph relayd_avail\n"; for my $host (@hosts) { my $clean = clean_fieldname($host); $clean = clean_fieldname('host'.$host) unless ($clean ne '_'); - print "$clean.value " . ($avail{$host} || 'NaN'). "\n"; + print "$clean.value " . ($avail{$clean} || 'NaN'). "\n"; } print "multigraph relayd_incidents\n"; for my $host (@hosts) { my $clean = clean_fieldname($host); $clean = clean_fieldname('host'.$host) unless ($clean ne '_'); - print "$clean.value " . ($down{$host} || 0). "\n"; + print "$clean.value " . ($down{$clean} || 0). "\n"; }