From acb5c06dfd8b8133474a7cd1da9b2b7a081b0a3f Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Tue, 13 Nov 2012 20:22:46 +0000 Subject: Parse the extra values required for a sensible DNS client. --- bin/custodian-enqueue | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'bin') 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+/ ) @@ -322,6 +325,25 @@ class MonitorConfig test[:http_text]=$1.dup 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. -- cgit v1.2.1