sensu-plugins / sensu-plugins-dns

This plugin provides native DNS instrumentation for monitoring, including: record resolution
http://sensu-plugins.io
MIT License
5 stars 26 forks source link

Handle multiple results #25

Closed adamdecaf closed 7 years ago

adamdecaf commented 7 years ago

Hi there!

I'm having a problem in which a site I'm hosting can be reached on 3 IPs, but often the dns name will only resolve to one of those IPs. Writing a check-dns.rb check for each IP will cause 2/3 to always fail.

I'd like to write one check-dns.rb check which would look something like this:

$ check-dns.rb -d example.com -r 74.200.39.23 -r 74.200.39.24 -r 74.200.39.25

However, right now only the last -r 74.200.39.25 is parsed and available in config[:result] for the check. Thoughts?

adamdecaf commented 7 years ago

I can spin up a quick PR if you think this would be accepted.

majormoses commented 7 years ago

Sorry for the delayed response. Hmm that is strange we should certainly add support say an array of results and check any of them. I would be more than happy to review a PR for that. I'd imagine the easiest thing to do is to make it take a string like it is now but split on commas to make it an array and then check each result against the list of acceptable results.

adamdecaf commented 7 years ago

@majormoses Sure thing. https://github.com/sensu-plugins/sensu-plugins-dns/pull/26 feel free to merge/change it if needed.