DNS Service monitor

Started by kafachan, June 05, 2013, 11:00:37 AM

Previous topic - Next topic

kafachan

Hi , as title , is it possible to monitoring the dns server , Thanks .

Victor Kirhenshtein

Hi!

It's possible only with external tools. You can define external parameter on any agent like this:

ExternalParameter = DNS.Check(*):/usr/bin/dig +noall +short @$1 $2 A | grep $3 | wc -l

You'll get new agant parameter DNS.Check, which accepts 3 arguments: DNS server address, DNS name to test, expected IP address. It will return 1 for successful test and 0 for failed. For example, in my network I can call it like

DNS.Check(172.30.30.1,www.netxms.org,5.9.19.37)

to check that my local DNS server at 172.30.30.1 resolves DNS name www.netxms.org to correct IP address (5.9.19.37).

Best regards,
Victor


kafachan

Hi,
  thank you for the reply . i did it and it can report value 1 , but i face another problem , how can i set it pop up alarm when the value is 0 ? Thank you very much .

Victor Kirhenshtein

You should set a threshold on your DCI (with condition "last values equals 0"), and add rule in event processing policy to generate an alarm. Here is a tutorial for a similar task: http://wiki.netxms.org/wiki/How_to_send_e-mail_notification_when_disk_space_is_low - it should help you understand the concept.

Best regards,
Victor

kafachan

yes , thank you very much , it work perfect .  ;D

Taomyn

I wanted to add to this thread a Windows equivalent which I needed for myself. I've added two new DCI's to my agent's config file:

ExternalParameter = DNS.Lookup(*):dig +noall +short @$1 $2 A
ExternalParameterShellExec = DNS.Check(*):dig +noall +short @$1 $2 A | find /c "$3"


The first returns the IP looked up as I wanted to be able to check it for myself, the second is the equivalent of the example from Victor that returns just a code. The reason for the "ShellExec" is because "find" is a built-in function of the command-prompt, and "/c" returns the count.

You'll also need a copy of "dig" for Windows which can be found here.