summaryrefslogtreecommitdiff
path: root/bin/custodian-enqueue
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2012-11-13 20:22:46 +0000
committerSteve Kemp <steve@steve.org.uk>2012-11-13 20:22:46 +0000
commitacb5c06dfd8b8133474a7cd1da9b2b7a081b0a3f (patch)
tree80d5f101adab577a0811fa7d3afb8a263d94f4d9 /bin/custodian-enqueue
parentdf76144735317434d14f72fc84b7a8501aaed454 (diff)
Parse the extra values required for a sensible DNS client.
Diffstat (limited to 'bin/custodian-enqueue')
-rwxr-xr-xbin/custodian-enqueue30
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.
#