i have some problem with nagios adding remots hosts in localhost.cfg (/etc/nagios/objects/localhost.cfg) file
in that i am able to only one remote host if i add one more host in that file i got below error
#/usr/sbin/nagios -v /etc/nagios/nagios.cfg
##########
Nagios Core 3.2.3
Copyright (c) 2009-2010 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 10-03-2010
License: GPL
Website:
http://www.nagios.org
Reading configuration data...
Read main config file okay...
Processing object config file '/etc/nagios/objects/commands.cfg'...
Processing object config file '/etc/nagios/objects/contacts.cfg'...
Processing object config file '/etc/nagios/objects/timeperiods.cfg'...
Processing object config file '/etc/nagios/objects/templates.cfg'...
Processing object config file '/etc/nagios/objects/localhost.cfg'...
Warning: Duplicate definition found for host 'localhost' (config file '/etc/nagios/objects/localhost.cfg', starting on line 34)
Error: Could not add object property in file '/etc/nagios/objects/localhost.cfg' on line 38.
Error processing object config files!
***> One or more problems was encountered while processing the config files...
Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.
###########################
i am using fedora12 below these steps i followed
#yum install nagios nagios-plugins nrpe xinetd openssl-devel gcc*
#cd /etc/nagios/objects/localhost.cfg
in that i have add one remote host ip
# 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 192.168.0.28
}
#vi /etc/nagios/objects/commands.cfg
in that i have added below lines
###############################################################################
# NRPE CHECK COMMAND
#
# Command to use NRPE to check remote host systems
###############################################################################
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
#htpasswd -c /etc/nagios/passwd nagiosadmin
after that i have checked the nagios configuration file
#nagios -v /etc/nagios/nagios.cfg
i got this output
Nagios Core 3.2.3
Copyright (c) 2009-2010 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 10-03-2010
License: GPL
Website:
http://www.nagios.org
Reading configuration data...
Read main config file okay...
Processing object config file '/etc/nagios/objects/commands.cfg'...
Processing object config file '/etc/nagios/objects/contacts.cfg'...
Processing object config file '/etc/nagios/objects/timeperiods.cfg'...
Processing object config file '/etc/nagios/objects/templates.cfg'...
Processing object config file '/etc/nagios/objects/localhost.cfg'...
Read object config files okay...
Running pre-flight check on configuration data...
Checking services...
Checked 8 services.
Checking hosts...
Checked 1 hosts.
Checking host groups...
Checked 1 host groups.
Checking service groups...
Checked 0 service groups.
Checking contacts...
Checked 1 contacts.
Checking contact groups...
Checked 1 contact groups.
Checking service escalations...
Checked 0 service escalations.
Checking service dependencies...
Checked 0 service dependencies.
Checking host escalations...
Checked 0 host escalations.
Checking host dependencies...
Checked 0 host dependencies.
Checking commands...
Checked 25 commands.
Checking time periods...
Checked 5 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 0
Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight check
after that started nagios, xinetd & httpd these services.
i installed in my remote host nrpe through yum command
#yum install xinetd
#yum install nrpe
#vi /etc/xinetd.d/nrpe
# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
flags = REUSE
socket_type = stream
port = 5666
wait = no
user = nagios
group = nagios
server = /usr/local/nagios/bin/nrpe
server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd
log_on_failure += USERID
disable = no
only_from = 192.168.0.28
}
#vi /etc/nagios/nrpe
i edited above the file
allowed_hosts=<my nagios serverip>
after that i started nrpe deamon help below the command
#nrpe -c /etc/nagios/nrpe.cfg -d
In my nagios server i run this command
#/usr/local/nagios/libexec/check_nrpe -H <serverip>
#/usr/local/nagios/libexec/check_nrpe -H <remote hostip>
i got the output of that nrpe version for both commands
NRPE v2.12