Also, this is documented in the command definitions: - dns_expected_answers Optional ip address or host you expect the DNS server to return. Host must end with a dot (.). This option can be repeated multiple times (Returns OK if any value match). If multiple addresses are returned at once, you have to match the whole string of addresses separated with commas (sorted alphabetically).
I defined a service and added an array as a string for the -a variable ‘dns_expected_answers’ like this.
If you are looking up a hostname, then the result/s will be IP address/es.
If you are looking up an address, then the result/s will be hostname/s.
It doesn’t make sense to combine an IP address and a hostname in the expected
list of results; there is nothing you could look up which would return both of
these.
Well I figured it out. The key is to locate the variable in Director under ‘Define Data Fields’ and set it to type array. In the service created for the command you have the option to add each item you want multiples of for this field.
-a, --expected-address=IP-ADDRESS|CIDR|HOST
Optional IP-ADDRESS/CIDR you expect the DNS server to return. HOST must end
with a dot (.). This option can be repeated multiple times (Returns OK if any
value matches).
ITL defines -a with a parameter
object CheckCommand “dns” {
…
"-a" = {
description = "Optional ip address or host you expect the DNS server to return. Host must end
with a dot (.). This option can be repeated multiple times (Returns OK if any value match). If
multiple addresses are returned at once, you have to match the whole string of addresses
separated with commas (sorted alphabetically)."
value = "$dns_expected_answers$"
}
Define dns_expected_answers in Icinga Director under ‘Define Data Fields’ and set it to type array
Create a service for the command
Hope this helps someone.
@Anthony Stone - Thanks but what if I wanted to specify multiple hostnames as the command states its possible to use the ‘-a’ flag multiple times.