commit c3567ba120dd3c09c45de2f74a385cde621cfdab Author: Karsten Loesing karsten.loesing@gmx.net Date: Tue Mar 8 15:16:36 2011 +0100
Warn when bandwidth scanners are failing. --- .../ernie/cron/ConsensusHealthChecker.java | 25 ++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/src/org/torproject/ernie/cron/ConsensusHealthChecker.java b/src/org/torproject/ernie/cron/ConsensusHealthChecker.java index ac07754..65a8cce 100644 --- a/src/org/torproject/ernie/cron/ConsensusHealthChecker.java +++ b/src/org/torproject/ernie/cron/ConsensusHealthChecker.java @@ -105,6 +105,7 @@ public class ConsensusHealthChecker { StringBuilder authorityVersionsResults = new StringBuilder(); SortedSet<String> allKnownFlags = new TreeSet<String>(); SortedSet<String> allKnownVotes = new TreeSet<String>(); + SortedSet<String> runningBandwidthScanners = new TreeSet<String>(); SortedMap<String, String> consensusAssignedFlags = new TreeMap<String, String>(); SortedMap<String, SortedSet<String>> votesAssignedFlags = @@ -383,6 +384,7 @@ public class ConsensusHealthChecker { + " <td>" + voteContainsBandwidthWeights + " Measured values in w lines</td>\n" + " </tr>\n"); + runningBandwidthScanners.add(dirSource); } }
@@ -404,6 +406,29 @@ public class ConsensusHealthChecker { + "directory authorities: " + sb.toString().substring(2)); }
+ /* Check if less than 4 bandwidth scanners are running. TODO make this + * configurable */ + SortedSet<String> knownBandwidthScanners = new TreeSet<String>( + Arrays.asList("ides,urras,moria1,gabelmoo".split(","))); + for (String dir : runningBandwidthScanners) { + knownBandwidthScanners.remove(dir); + } + if (!knownBandwidthScanners.isEmpty()) { + StringBuilder sb = new StringBuilder(); + for (String dir : knownBandwidthScanners) { + sb.append(", " + dir); + } + String message = "The following directory authorities are not " + + "reporting bandwidth scanner results: " + + sb.toString().substring(2); + this.logger.warning(message); + if (runningBandwidthScanners.size() >= 3) { + nagiosWarnings.add(message); + } else { + nagiosCriticals.add(message); + } + } + try {
/* Keep the past two consensus health statuses. */