summaryrefslogtreecommitdiff
path: root/lib/custodian
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
commit4a150d2ac6e490b701f835ccd2d2a4b015454708 (patch)
tree49710122671351c1bf92a1033aa9e248d61b035e /lib/custodian
parente9928ea5ff1f6b703178660b8f0263c78410ed2b (diff)
Use the SHA1 hash of the input line as the alert ID for mauve.
Diffstat (limited to 'lib/custodian')
-rw-r--r--lib/custodian/alerts/mauve.rb9
1 files changed, 8 insertions, 1 deletions
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}"