Ad Widget

Collapse

dns checking [named]

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lesnik
    Junior Member
    • Jun 2007
    • 2

    #1

    dns checking [named]

    Hello all,

    is there any solution how to check that dns server [named] is properly running and is answering corectly to dns querys?
  • diegocito
    Junior Member
    • Jun 2007
    • 22

    #2
    Up, please, I need this too.

    Thanks

    Diegocito

    Comment

    • gescheit
      Senior Member
      • Jul 2007
      • 156

      #3
      Some like this if use external check.

      check_dns.sh
      #!/bin/bash
      HOST_FOR_RESOLV="ya.ru"

      DNS_SERVER=`mysql -b -D zabbix -u zabbix -ppass -e "SELECT ip FROM hosts WHERE host='$1' LIMIT 1" | cut -f 2 | grep -v ip`

      if [ `nslookup $HOST_FOR_RESOLV $DNS_SERVER | grep "has address" | wc -l` -gt 0 ]; then
      echo "1"
      else
      echo "0"
      fi

      To add this do: Item -> Create Item ->
      Type: External check
      Key check_dns.sh()
      -> Save
      Sure that check_dns.sh at "ExternalScripts" path.
      Last edited by gescheit; 24-07-2007, 13:41.

      Comment

      • diegocito
        Junior Member
        • Jun 2007
        • 22

        #4
        Ok, it seems working, but "last value" is always at "0" whereas it works and it must be at "1" (I made the test in command lines)...

        Thanks for your answer

        Diegocito

        Comment

        • diegocito
          Junior Member
          • Jun 2007
          • 22

          #5
          Sorry but it doesn't work, but this doesn't come from your plugin, It comes from Zabbix I think.
          Indeed, In command lines, it "echos" me 0 and 1 correctly, but with Zabbix, it stay always at 1 ??? I have the impression that Zabbix cannot understand the "else echo "0"" because in the zabbix_server_log file, it is written : "timeout while answering request" what is right because I unplug the network cable to test if there is no connection, but "else echo "0"" should work at this time nevetheless, no??

          Thanks
          Diegocito
          Last edited by diegocito; 26-07-2007, 10:26.

          Comment

          • gescheit
            Senior Member
            • Jul 2007
            • 156

            #6
            Use "host" instead "nslookup"

            Comment

            • tokind
              Member
              • May 2007
              • 47

              #7
              Script for Host (DNS) lookup

              Code:
              #!/usr/local/bin/bash
              #DNS lookup scripts for Zabbix monitor. Conditional return
              # of valid IP | 0 for failed lookup.
              
              
              HOST_QUERY=$1
              
              if [`host $HOST_QUERY | grep "has address" | wc -l` -eq 0 ]; then
              
               #lookup failed, bad DNS lookup
               echo "0"
              
              else
              
               #String eval returns valid IP address
               LOOKUP=`host -cIN $HOST_QUERY`
               echo ${LOOKUP#$HOST_QUERY has address}
              
              fi
              Last edited by tokind; 24-09-2007, 21:45.

              Comment

              • wyatt121
                Junior Member
                • Aug 2008
                • 4

                #8
                Hi,

                I'm unable to get this to work. When I create this item, Zabbix makes it "Not Supported". I followed the below instructions.

                Anyone have any idea what I'm doing wrong?

                Regards,

                Wyatt


                Originally posted by tokind
                Code:
                #!/usr/local/bin/bash
                #DNS lookup scripts for Zabbix monitor. Conditional return
                # of valid IP | 0 for failed lookup.
                
                
                HOST_QUERY=$1
                
                if [`host $HOST_QUERY | grep "has address" | wc -l` -eq 0 ]; then
                
                 #lookup failed, bad DNS lookup
                 echo "0"
                
                else
                
                 #String eval returns valid IP address
                 LOOKUP=`host -cIN $HOST_QUERY`
                 echo ${LOOKUP#$HOST_QUERY has address}
                
                fi

                Comment

                • tokind
                  Member
                  • May 2007
                  • 47

                  #9
                  Hi Wyatt,
                  Based on feedback (and script) from various people I developed php scripts that work more reliably. You may see them here:

                  http://www.zabbix.com/wiki/doku.php?...n_your_network

                  The thread you are reading forked somewhere and you may not be seeing the reference to my completed article on the Wiki.

                  I am sure you will have better luck with those instructions.

                  Comment

                  • tokind
                    Member
                    • May 2007
                    • 47

                    #10
                    Article moved

                    They restructured the Wiki. Now this article is at

                    http://www.zabbix.com/wiki/howto/mon...n_your_network

                    Comment

                    • js1
                      Member
                      • Apr 2009
                      • 66

                      #11
                      We use the following bash script to return the response time of a DNS server:

                      Code:
                      #!/bin/bash
                      dig +tcp -c CH -t TXT +noquestion +stats +time=1 @$1 hostname.bind | grep "Query\ time" | cut -d" " -f4
                      We configure the item to be of external check calling that script. The value is a unsigned integer. And, we set a trigger if the the return value is over some selected limit.

                      Comment

                      • NOB
                        Senior Member
                        Zabbix Certified Specialist
                        • Mar 2007
                        • 469

                        #12
                        Hi

                        we are using a Nagios-plugin for DNS checks.

                        Add a "Nagios plugin" entry to your value maps and fill in the standard exit codes of all Nagios plugins (0 to 3).
                        Code:
                        0: OK
                        1: Warning
                        2: Critical
                        3: Unknown
                        Write a small script to call the Nagios plugin and echo the exit code at the end by
                        Code:
                        echo $?
                        Use this script as "external check".
                        The result is an integer - the exit code of the Nagios plugin.
                        Set the valuemap to your newly created one.

                        We added interpreting the output of the Nagios plugin to
                        send the response time via zabbix_sender, if the exit
                        code is 0 (OK).

                        HTH,

                        Norbert.

                        Comment

                        • janis.orlovs
                          Junior Member
                          • Sep 2010
                          • 14

                          #13
                          Can anybody help with NET.TCP.DNS key. I have problems with basic understanding of nslookup key at this point of view. Firstly question I want to use this key for testing if the DNS server is responable, but on which host I have to put this on? On nameserver or on different host which will test the nameserver working condition?

                          Sorry for the stupid question.

                          Comment

                          • tokind
                            Member
                            • May 2007
                            • 47

                            #14
                            I run the check script on my Zabbix Host. This makes sense, because you want to make sure that your DNS server is responding to other hosts. Simply checking to see if named is running on the DNS server does not assure that the server is able to serve your network.

                            Be sure and take a look at http://www.zabbix.com/wiki/howto/mon...n_your_network
                            Last edited by tokind; 22-12-2010, 23:58.

                            Comment

                            • qix
                              Senior Member
                              Zabbix Certified SpecialistZabbix Certified Professional
                              • Oct 2006
                              • 423

                              #15
                              I don't know if anybody had mentioned it yet (to lazy to read the whole thread ), but just a note.
                              Zabbix agent can now perform DNS query checks by itself,
                              no external script needed:

                              http://www.zabbix.com/documentation/...s#zabbix_agent


                              Use net.tcp.dns[<ip>,zone] or net.tcp.dns.query[<ip>,zone,<type>]
                              With kind regards,

                              Raymond

                              Comment

                              Working...