Error: Unable to locate host

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.
Locked
search4u2003
Posts: 8
Joined: Tue Jul 16, 2013 11:25 pm

Error: Unable to locate host

Post by search4u2003 »

My nagios configuration is working fine for linux environment but when i try to configure windows host and go for nagios test i get below error.

Error: Unable to locate host 'hostname' for service 'C:\ Drive Space'
Error: Could not register service (config file '/usr/local/nagios/etc/objects/web-remote.cfg', starting on line 91)

whereas i have do mentioned the hostname in /etc/hosts file.

I'm able to ping the server and run the command manually.


# 'check_nt' command definition
define command{
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -s password -v $ARG1$ $ARG2$
}

#web-remote.cfg file

define host{
host_name hostname ; Name of this template
address x.x.x.x
use windows-server ; Inherit default values
check_period 24x7
check_interval 3
retry_interval 1
max_check_attempts 10
check_command check-host-alive
notification_period 24x7
notification_interval 30
notification_options d,r
contact_groups admins
register 0 ; DONT REGISTER THIS - ITS A TEMPLATE
}
#define host{
# use windows-server ; Inherit default values from a template
# host_name hostname ; The name we're giving to this host
# alias My Windows Server ; A longer name associated with the host
# address x.x.x.x. ; IP address of the host
# }
# Create a service for monitoring the version of NSCLient++ that is installed
# Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name hostname
service_description NSClient++ Version
check_command check_nt!CLIENTVERSION
}
# Create a service for monitoring the uptime of the server
# Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name hostname
service_description Uptime
check_command check_nt!UPTIME
}
# Create a service for monitoring CPU load
# Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name hostname
service_description CPU Load
check_command check_nt!CPULOAD!-l 1,80,90
}
# Create a service for monitoring memory usage
# Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name hostname
service_description Memory Usage
check_command check_nt!MEMUSE!-w 80 -c 90
}
# Create a service for monitoring C:\ disk usage
# Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name hostname
service_description C:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90
}
# Create a service for monitoring D:\ disk usage
# Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name hostname
service_description D:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l d -w 80 -c 90
}
# Create a service for monitoring E:\ disk usage
# Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name hostname
service_description E:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l e -w 80 -c 90
}
# Create a service for monitoring the W3SVC service
# Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name hostname
service_description W3SVC
check_command check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
}
# Create a service for monitoring the Explorer.exe process
# Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name hostname
service_description Explorer
check_command check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe
}
search4u2003
Posts: 8
Joined: Tue Jul 16, 2013 11:25 pm

Re: Error: Unable to locate host

Post by search4u2003 »

I have managed to resolve the issue now its working fine.

U can close this post.
Locked