Page 1 of 2
check_dns issue
Posted: Wed Jan 27, 2016 4:37 am
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,
Re: check_dns issue
Posted: Wed Jan 27, 2016 10:40 am
by hsmith
Can you try to manually run the command as the nagios user instead of the root user?
Re: check_dns issue
Posted: Thu Jan 28, 2016 4:09 am
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.
Re: check_dns issue
Posted: Thu Jan 28, 2016 3:19 pm
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
Re: check_dns issue
Posted: Sun Jan 31, 2016 3:04 am
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.
Re: check_dns issue
Posted: Mon Feb 01, 2016 10:43 am
by rkennedy
Can you post the host definition that goes with this as well?
Re: check_dns issue
Posted: Mon Feb 01, 2016 11:16 am
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
}
Re: check_dns issue
Posted: Mon Feb 01, 2016 3:14 pm
by rkennedy
Hmm.
To clarify, is your DNS server is hosted on your 'Fortigate100D' host then?
Re: check_dns issue
Posted: Tue Feb 02, 2016 3:09 am
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
Re: check_dns issue
Posted: Tue Feb 02, 2016 10:38 am
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.