Monitoring change of DNS A record result

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
CWSI
Posts: 30
Joined: Tue Oct 28, 2014 7:41 am

Monitoring change of DNS A record result

Post by CWSI »

Hey guys,

I'm just evaluating NagiosXI at the moment, so far I've been really impressed by the flexibility and ease of getting it going (installed on an EC2 CentOS AMI)! We host some internet based services for customers, so I'm working on building up a suite of checks that we can run against the servers to confirm everything is OK. I've done some port checks, HTTP response codes, SSL Cert expiry etc. but one of the wizard items that caught my attention was the DNS check that watches for a mismatch of the result of a DNS A record lookup to an IP you specify. Very handy to watch out for config changes, DNS failovers etc. but having to setup a Service for each Host and specify the IP there (in ARGS) is not really scalable (at 40 hosts now but could be at 2-300 shortly).

So I'm wondering if anybody has thoughts on how to make this Check more scalable? I tried sticking the expected IP in as a Free Variable of the Host, and this works well as you only need one Service object that references that variable. But this still requires looking up and typing in the IP of each host as we add them, I feel there's probably a clever trick here to do this in an automated way :). Maybe a script that runs when a new Host is added, does the lookup and sets the Free Variable? Or a script that you can run periodically during a time that you are happy that all hosts have the correct IPs and goes through all hosts to update the Free Variable. I used Kaseya in a previous life and it had the concept of a baseline audit that would run when a host was added, then you could report on variances from that baseline.


Any thoughts?

Thanks!
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Monitoring change of DNS A record result

Post by sreinhardt »

Well, if the hostnames are the dns name, and the host address is the expected IP, you could alter the command or make a new one that uses those instead of args. Unfortunately it is quite common that this would not be the case, where only one or the other matches what you need, in those cases there isn't much you can do but assign it via free variable or arg. To automate that a bit, you could certainly script a config builder for that particular check, and use reconfigure_nagios.sh to import it into XI that way. A third option, that might (depending on your use) be the best way yet, modify the wizard so that the php does a dns lookup and provides a suggested IP. If you plan to do most deployment through wizards, I think this would be by far the best way, as it would be able to populate the field for you and still be unique to each service. Do you think any of that will work in your particular case?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
CWSI
Posts: 30
Joined: Tue Oct 28, 2014 7:41 am

Re: Monitoring change of DNS A record result

Post by CWSI »

Thanks for the reply sreinhardt.

Yep your last option sounds like it would be perfect, I used the wizards when I first deployed the solution just to see what the options were, then promptly forgot them and started creating hosts/services manually! I'll give that a shot and post here if it works out, or doesn't :).


Thanks for the quick reply!
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Monitoring change of DNS A record result

Post by slansing »

Great, keep us up to date. One thing you could do would be to copy the wizard out, then make the alterations and try them instead of completely over-writing the original wizard. One thing to note is any changes you do make to the wizard will likely be reverted upon an update, so be sure to store them someplace within easy reach!
CWSI
Posts: 30
Joined: Tue Oct 28, 2014 7:41 am

Re: Monitoring change of DNS A record result

Post by CWSI »

Yeah that was my thought, take a default, rename and tweak it so it won't get overwritten...
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Monitoring change of DNS A record result

Post by sreinhardt »

In your case, I agree modification of the wizard is probably the best route. As a side note, this can be done for most wizards we provide, as only a few contain protected code. As always, let us know if you have questions or run into issues!
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked