diff options
| author | Steve Kemp <steve@steve.org.uk> | 2012-11-13 20:22:46 +0000 | 
|---|---|---|
| committer | Steve Kemp <steve@steve.org.uk> | 2012-11-13 20:22:46 +0000 | 
| commit | 19b708c81fb0f2ce596277731d4276965edce4a5 (patch) | |
| tree | 80d5f101adab577a0811fa7d3afb8a263d94f4d9 | |
| parent | b75be77faefd8b097d0d3b13eb1e184c192e6e92 (diff) | |
  Parse the extra values required for a sensible DNS client.
| -rwxr-xr-x | bin/custodian-enqueue | 30 | 
1 files changed, 26 insertions, 4 deletions
| diff --git a/bin/custodian-enqueue b/bin/custodian-enqueue index 736d7a8..a462b0a 100755 --- a/bin/custodian-enqueue +++ b/bin/custodian-enqueue @@ -276,6 +276,8 @@ class MonitorConfig          port=23        when /smtp/i then          port=25 +      when /dns/i then +        port=53        end        # @@ -300,9 +302,9 @@ class MonitorConfig            :test_alert  => alert          } +          # -        # HTTP-tests will include the expected result in one of two -        # forms: +        # HTTP-tests will include the expected result in one of two forms:          #          #    must run http with status 200          # @@ -310,9 +312,10 @@ class MonitorConfig          #          # If those are sepcified then include them here.          # -        # Note we're deliberately fast and loose here - which allows both to be specified +        # Note we're deliberately fast and loose here - which allows both to +        # be specified:          # -        #   http://example.vm/ must run http with status 200 and content 'OK' otherwise 'boo!'. +        # http://example.vm/ must run http with status 200 and content 'OK'.          #          #          if ( line =~ /\s+with\s+status\s+([0-9]+)\s+/ ) @@ -323,6 +326,25 @@ class MonitorConfig          end          # +        # These are special cased for the DNS types +        # +        if ( test[:test_type] =~ /dns/ ) + +          # +          #  Sample line: +          # +          # DNSHOSTS must run dns for www.bytemark.co.uk resolving A as '212.110.161.144'. +          # +          # +          if ( line =~ /for\s+([^\s]+)\sresolving\s([A-Z]+)\s+as\s'([^']+)'/ ) +            test[:resolve_name]     = $1.dup +            test[:resolve_type]     = $2.dup +            test[:resolve_expected] = $3.dup +          end +        end + + +        #          # We've parsed(!) the line.  Either output the JSON to the console          # or add to the queue.          # | 
