summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2012-12-12 10:11:26 +0000
committerSteve Kemp <steve@steve.org.uk>2012-12-12 10:11:26 +0000
commitcc949e2b32c4dd0e178539c3a13e12371a33aad9 (patch)
tree5f1925b46987b3595f4a2c7baa00997ce0bdec22
parentedf28a7b84f549e2476205c976655160133ea9c8 (diff)
Use the SHA1 hash of the input line as the alert ID for mauve.release-0.8-5
-rw-r--r--debian/changelog9
-rw-r--r--lib/custodian/alerts/mauve.rb9
2 files changed, 17 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index 8c17a23..8862df5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+custodian (0.8-5) stable; urgency=low
+
+ * When sending alerts via Mauve the ID of the alert must be unique,
+ per-source. We thought we'd achieved this by using the input line
+ from the parser, but sadly there is a 255 character limit.
+ Use the SHA1 hash of the input to satisfy both constraints.
+
+ -- Steve Kemp <steve@bytemark.co.uk> Wed, 12 Dec 2012 10:11:01 +0000
+
custodian (0.8-4) stable; urgency=low
* The error message is more explicit on DNS failures.
diff --git a/lib/custodian/alerts/mauve.rb b/lib/custodian/alerts/mauve.rb
index 31cb874..c0d4caf 100644
--- a/lib/custodian/alerts/mauve.rb
+++ b/lib/custodian/alerts/mauve.rb
@@ -3,6 +3,7 @@
require 'custodian/util/bytemark'
require 'custodian/util/dns'
+require 'digest/sha1'
#
@@ -172,7 +173,13 @@ module Custodian
alert = Mauve::Proto::Alert.new
- alert.id = test.to_s
+
+ #
+ # Mauve only lets us use IDs which are <= 255 characters in length
+ # hash the line from the parser to ensure it is short enough.
+ # (IDs must be unique, per-source)
+ alert.id = Digest::SHA1.hexdigest(test.to_s)
+
alert.subject = subject
alert.summary = "The #{test_type} test failed against #{test_host}"