check_dns issue

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
batchen
Posts: 24
Joined: Tue Jan 19, 2016 10:04 am

check_dns issue

Post by batchen »

Hello,

check dns used to work and one day it stops with this error :

(No output on stdout) stderr:
manully runing the commend it works :

Code: Select all

root@localhost: objects#/usr/lib64/nagios/plugins/check_dns -H www.google.com -s (localhost) -t 40
DNS OK: 20.004 seconds response time. www.google.com returns |time=20.004378s;;;0.000000
command.cfg :

Code: Select all

#check DNS
define command{
command_name    check_dns
command_line    $USER1$/check_dns -H www.google.com -s '$HOSTADDRESS$' -t 40
}
localhost.cfg:

Code: Select all

define service{
        use                     local-service
        host_name               localhost
        service_description     Check dns
        check_command           check_dns
        }
what is the issue ?
Regards,
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: check_dns issue

Post by hsmith »

Can you try to manually run the command as the nagios user instead of the root user?
Former Nagios Employee.
me.
batchen
Posts: 24
Joined: Tue Jan 19, 2016 10:04 am

Re: check_dns issue

Post by batchen »

Hi,

i did.
same ressult:

Code: Select all

root@localhost: ~#su nagios
[nagios@localhost root]$ /usr/lib64/nagios/plugins/check_dns -H www.google.com -s (localhost) -t 40
DNS OK: 20.004 seconds response time. www.google.com returns |time=20.003911s;;;0.000000
thanks.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_dns issue

Post by scottwilkerson »

you are specifying to use (localhost) as the DNS server

Can you run this command?

Code: Select all

[nagios@localhost root]$ /usr/lib64/nagios/plugins/check_dns -H www.google.com -s '8.8.8.8' -t 40

8.8.8.8 is a public DNS server
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
batchen
Posts: 24
Joined: Tue Jan 19, 2016 10:04 am

Re: check_dns issue

Post by batchen »

Hi,
no i use the localhost IP so i can check if the DNS are ok in the local host. (im just changing it to (localhost) when i post...)
here is the output:

Code: Select all

DNS OK: 0.072 seconds response time. www.google.com returns 82.102.187.110,82.102.187.111,82.102.187.123,82.102.187.20,82.102.187.32,82.102.187.33,82.102.187.45,82.102.187.46,82.102.187.58,82.102.187.59,82.102.187.71,82.102.187.72,82.102.187.84,82.102.187.85,82.102.187.97,82.102.187.98|time=0.071778s;;;0.000000

thanks.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: check_dns issue

Post by rkennedy »

Can you post the host definition that goes with this as well?
Former Nagios Employee
batchen
Posts: 24
Joined: Tue Jan 19, 2016 10:04 am

Re: check_dns issue

Post by batchen »

Hi,

everthing else works and it used to work as well..

here it is : (i hide the IP address)

Code: Select all

# Define the switch that we'll be monitoring

define host{
        use             generic-switch          ; Inherit default values from a template
        host_name       Fortigate100D           ; The name we're giving to this switch
        alias           FortiGate100D   ; A longer name associated with the switch
        address         x.x.x.x             ; IP address of the switch
        hostgroups      fortigate               ; Host groups this switch is associated with
        }




###############################################################################
###############################################################################
#
# HOST GROUP DEFINITIONS
#
###############################################################################
###############################################################################

# Create a new hostgroup for switches

define hostgroup{
        hostgroup_name  fortigate               ; The name of the hostgroup
        alias           Network devices         ; Long name of the group
        }

rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: check_dns issue

Post by rkennedy »

Hmm.

To clarify, is your DNS server is hosted on your 'Fortigate100D' host then?
Former Nagios Employee
batchen
Posts: 24
Joined: Tue Jan 19, 2016 10:04 am

Re: check_dns issue

Post by batchen »

hi sorry i got confused with local host :

Code: Select all

# Define a host for the local machine

define host{
        use                     linux-server            ; Name of host template to use
                                                        ; This host definition will inherit all variables that are defined
                                                        ; in (or inherited by) the linux-server host template definition.
        host_name               localhost
        alias                   localhost
        address                 127.0.0.1
        }



###############################################################################
###############################################################################
#
# HOST GROUP DEFINITION
#
###############################################################################
###############################################################################

# Define an optional hostgroup for Linux machines

define hostgroup{
        hostgroup_name  linux-servers ; The name of the hostgroup
        alias           Linux Servers ; Long name of the group
        members         localhost     ; Comma separated list of hosts that belong to this group
        }

i only want to verify that the server is capable to translate DNS it is not my main DNS server,i just dontget why in the command line it works and in nagios doest..
maybe it happend cause i set time and date ? what else can i try?
maybe logs i can look at?

thanks
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: check_dns issue

Post by rkennedy »

#check DNS
define command{
command_name check_dns
command_line $USER1$/check_dns -H http://www.google.com -s '$HOSTADDRESS$' -t 40
}
The check_dns command is using -s, which then looks for DNS records on your $HOSTADDRESS$ (in this case, 127.0.0.1). I believe this is why you are seeing an error.
Former Nagios Employee
Locked