summaryrefslogtreecommitdiff
path: root/lib/custodian
diff options
context:
space:
mode:
Diffstat (limited to 'lib/custodian')
-rw-r--r--lib/custodian/alerter.rb33
1 files changed, 2 insertions, 31 deletions
diff --git a/lib/custodian/alerter.rb b/lib/custodian/alerter.rb
index ffa07dd..0504f2c 100644
--- a/lib/custodian/alerter.rb
+++ b/lib/custodian/alerter.rb
@@ -1,13 +1,11 @@
+require 'custodian/util/bytemark'
require 'custodian/util/dns'
require 'mauve/sender'
require 'mauve/proto'
-require 'ipaddr'
-
-
#
# This class encapsulates the raising and clearing of alerts via Mauve.
@@ -25,14 +23,6 @@ class Alerter
attr_reader :details
- #
- # The currently allocated IP-ranges which belong to Bytemark.
- #
- # These are used to test if an alert refers to a machine outwith our
- # network.
- #
- BYTEMARK_RANGES = %w(80.68.80.0/20 89.16.160.0/19 212.110.160.0/19 46.43.0.0/18 91.223.58.0/24 213.138.96.0/19 5.153.224.0/21 2001:41c8::/32).collect{|i| IPAddr.new(i)}
-
#
@@ -46,25 +36,6 @@ class Alerter
- #
- # Is the named target inside the Bytemark IP-range?
- #
- def inside_bytemark?( target )
-
- #
- # Test trange, and format the appropriate message.
- #
- inside = false
-
- if ( BYTEMARK_RANGES.any?{|range| range.include?(IPAddr.new(target))} )
- inside = true
- end
-
- inside
- end
-
-
-
#
# Expand to a message indicating whether a hostname is inside the Bytemark network.
@@ -110,7 +81,7 @@ class Alerter
#
# Return the formatted message
#
- if ( inside_bytemark?( resolved.to_s ) )
+ if ( Custodian::Util::Bytemark.inside?( resolved.to_s ) )
if ( resolved == target )
return "<p>#{host} is inside the Bytemark network.</p>"
else