NetXMS Support Forum

English Support => General Support => Topic started by: kafachan on June 05, 2013, 11:00:37 AM

Title: DNS Service monitor
Post by: kafachan on June 05, 2013, 11:00:37 AM
Hi , as title , is it possible to monitoring the dns server , Thanks .
Title: Re: DNS Service monitor
Post by: Victor Kirhenshtein on June 05, 2013, 02:38:53 PM
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

Title: Re: DNS Service monitor
Post by: kafachan on June 06, 2013, 12:54:20 PM
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 .
Title: Re: DNS Service monitor
Post by: Victor Kirhenshtein on June 06, 2013, 02:32:35 PM
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 (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
Title: Re: DNS Service monitor
Post by: kafachan on June 07, 2013, 06:43:20 AM
yes , thank you very much , it work perfect .  ;D
Title: Re: DNS Service monitor
Post by: Taomyn on June 13, 2013, 02:16:03 PM
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 (http://members.shaw.ca/nicholas.fong/dig/).