update: this script has been rewritten. please refer to this post.
background. let me start off by posing a question. have you looked at the dns mp? look closely. there are no synthetic tests. why is it that management packs like these are service-centric?
my dns service hums right along... yet problems exist. i'm not going to expatiate on the necessity of needing transaction-based monitoring. there are whole companies built around this philosophy. it does seem troubling to me though that the cornerstone of active directory is a healthy dns... yet the dns mp contains no such necessary rule. anyway, enough about that.
foreground. i wrote a script to monitor dns. it doesn't monitor the health or catch events. you've already got all that. it simply runs a nslookup command for a list of hostnames and returns errors, if there are any. it lacks any elegance or sophistication (not that you're used to that in my scripts). maybe you noticed. maybe you didn't.
i stated above that it issues nslookup commands. you may be thinking, why nslookup when you could query records through wmi? well, simple... that'd be too easy. seriously, the reason is that there was a time in the past where the dns service hung (no, mom didn't catch that either). i couldn't query anything with nslookup. however, issuing commands against wmi still continued to work. hmmmm. i guess for that reason i'm a little leery about using wmi. besides, using nslookup seems like it more closely resembles what someone might be doing. i would prefer dig, but nslookup seems quite ubiquitous in the windows world. the script has two parameters you'll need to setup:
- HostNames - accepts a comma-delimited list of hosts to query
- LogSuccessEvent - boolean value to log on success
- 41000 - no hostnames defined
- 41001 - lookup failed for
- 41002 - successfully looked up