LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 03-02-2011, 07:40 AM   #1
uppalagayatri
LQ Newbie
 
Registered: Mar 2011
Posts: 26

Rep: Reputation: 1
nagios adding remote host problem


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
 
Old 03-03-2011, 02:00 AM   #2
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,240

Rep: Reputation: 132Reputation: 132
Quote:
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!
Somewhere you are using the name "localhost" more than one time..


Code:
# Generic host definition template - This is NOT a real host, just a template!

define host{
        name                            generic-host    ; The name of this host template
        notifications_enabled           1       ; Host notifications are enabled
        event_handler_enabled           1       ; Host event handler is enabled
        flap_detection_enabled          1       ; Flap detection is enabled
        failure_prediction_enabled      1       ; Failure prediction is enabled
        process_perf_data               1       ; Process performance data
        retain_status_information       1       ; Retain status information across program restarts
        retain_nonstatus_information    1       ; Retain non-status information across program restarts
        register                        0       ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
        }


# Since this is a simple configuration file, we only monitor one host - the
# local host (this machine).

define host{
        use                     generic-host            ; Name of host template to use
        host_name               Est
        alias                   Est.xeng.com      ; localhost.localhostdomain
        address                 127.0.0.1
        check_command           check-host-alive
        max_check_attempts      10
        check_period            24x7
        notification_interval   120
        notification_period     24x7
        notification_options    d,r
        contact_groups          nagicmd
        }

#
define host{
        use                     generic-host            ; Name of host template to use
        host_name               Master
        alias                   master.xeng.com
        address                 10.77.103.42
#	parents			slave
        check_command           check-host-alive
        max_check_attempts      10
        check_period            24x7
        notification_interval   120
        notification_period     24x7
        notification_options    d,r
        contact_groups          nagicmd
        }


#
define host{
        use                     generic-host            ; Name of host template to use
        host_name               Slave
        alias                   slave.xeng.com
        address                 10.77.103.44
#       parents                 slave
        check_command           check-host-alive
        max_check_attempts      10
        check_period            24x7
        notification_interval   120
        notification_period     24x7
        notification_options    d,r
        contact_groups          nagicmd
        }

#
define host{
        use                     generic-host            ; Name of host template to use
        host_name               Web1
        alias                   web1.xeng.com
        address                 10.77.103.58
#	parents			Est
        check_command           check-host-alive
        max_check_attempts      10
        check_period            24x7
        notification_interval   120
        notification_period     24x7
        notification_options    d,r
        contact_groups          nagicmd
        }

#
define host{
        use                     generic-host            ; Name of host template to use
        host_name               Web2
        alias                   web2.xeng.com
        address                 10.77.104.21
#	parents			Wan
        check_command           check-host-alive
        max_check_attempts      10
        check_period            24x7
        notification_interval   120
        notification_period     24x7
        notification_options    d,r
        contact_groups          nagicmd
        }

#Define Router information****************************************************************
define host{
        use                     generic-host            ; Name of host template to use
        host_name               Gateway
        alias                   Xeng Gateway
        address                 10.77.99.1
#	parents			master
       #check_command            
	retain_status_information 0
        active_checks_enabled   0
	checks_enabled 		0
	max_check_attempts      10
        check_period            24x7
        notification_interval   120
        notification_period     24x7
        notification_options    d,r,u
	notifications_enabled	0
        contact_groups          nagicmd
        }
As mentioned above define all the remote nodes.

Hostgroups as follows,
Code:
###############################################################################
###############################################################################
#
# HOST GROUPS
#
###############################################################################
###############################################################################

# We only have one host in our simple config file, so there is no need to
# create more than one hostgroup.

define hostgroup{
        hostgroup_name  RedHatLinux
        alias           Xeng Servers
        members         Est
        }

Last edited by kirukan; 03-03-2011 at 02:05 AM.
 
Old 03-21-2011, 12:16 AM   #3
uppalagayatri
LQ Newbie
 
Registered: Mar 2011
Posts: 26

Original Poster
Rep: Reputation: 1
solved the problem

Please tickout solved

Quote:
Originally Posted by kirukan View Post
Somewhere you are using the name "localhost" more than one time..


Code:
# Generic host definition template - This is NOT a real host, just a template!

define host{
        name                            generic-host    ; The name of this host template
        notifications_enabled           1       ; Host notifications are enabled
        event_handler_enabled           1       ; Host event handler is enabled
        flap_detection_enabled          1       ; Flap detection is enabled
        failure_prediction_enabled      1       ; Failure prediction is enabled
        process_perf_data               1       ; Process performance data
        retain_status_information       1       ; Retain status information across program restarts
        retain_nonstatus_information    1       ; Retain non-status information across program restarts
        register                        0       ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
        }


# Since this is a simple configuration file, we only monitor one host - the
# local host (this machine).

define host{
        use                     generic-host            ; Name of host template to use
        host_name               Est
        alias                   Est.xeng.com      ; localhost.localhostdomain
        address                 127.0.0.1
        check_command           check-host-alive
        max_check_attempts      10
        check_period            24x7
        notification_interval   120
        notification_period     24x7
        notification_options    d,r
        contact_groups          nagicmd
        }

#
define host{
        use                     generic-host            ; Name of host template to use
        host_name               Master
        alias                   master.xeng.com
        address                 10.77.103.42
#	parents			slave
        check_command           check-host-alive
        max_check_attempts      10
        check_period            24x7
        notification_interval   120
        notification_period     24x7
        notification_options    d,r
        contact_groups          nagicmd
        }


#
define host{
        use                     generic-host            ; Name of host template to use
        host_name               Slave
        alias                   slave.xeng.com
        address                 10.77.103.44
#       parents                 slave
        check_command           check-host-alive
        max_check_attempts      10
        check_period            24x7
        notification_interval   120
        notification_period     24x7
        notification_options    d,r
        contact_groups          nagicmd
        }

#
define host{
        use                     generic-host            ; Name of host template to use
        host_name               Web1
        alias                   web1.xeng.com
        address                 10.77.103.58
#	parents			Est
        check_command           check-host-alive
        max_check_attempts      10
        check_period            24x7
        notification_interval   120
        notification_period     24x7
        notification_options    d,r
        contact_groups          nagicmd
        }

#
define host{
        use                     generic-host            ; Name of host template to use
        host_name               Web2
        alias                   web2.xeng.com
        address                 10.77.104.21
#	parents			Wan
        check_command           check-host-alive
        max_check_attempts      10
        check_period            24x7
        notification_interval   120
        notification_period     24x7
        notification_options    d,r
        contact_groups          nagicmd
        }

#Define Router information****************************************************************
define host{
        use                     generic-host            ; Name of host template to use
        host_name               Gateway
        alias                   Xeng Gateway
        address                 10.77.99.1
#	parents			master
       #check_command            
	retain_status_information 0
        active_checks_enabled   0
	checks_enabled 		0
	max_check_attempts      10
        check_period            24x7
        notification_interval   120
        notification_period     24x7
        notification_options    d,r,u
	notifications_enabled	0
        contact_groups          nagicmd
        }
As mentioned above define all the remote nodes.

Hostgroups as follows,
Code:
###############################################################################
###############################################################################
#
# HOST GROUPS
#
###############################################################################
###############################################################################

# We only have one host in our simple config file, so there is no need to
# create more than one hostgroup.

define hostgroup{
        hostgroup_name  RedHatLinux
        alias           Xeng Servers
        members         Est
        }
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nagios notifications for a host problem cmx08 Linux - Software 1 07-20-2011 08:35 AM
nagios adding remote host problem ramesh14 Linux - Software 3 03-04-2011 09:37 AM
How to monitor remote host using nagios Ashish Sood Linux - General 16 01-25-2011 06:05 AM
Nagios passive or remote-host-side alert. knockout_artist Linux - Server 1 01-06-2010 12:49 PM
[Nagios] Ideas of Transferring file from remote to monitor host fabbie Linux - Newbie 2 12-02-2009 10:49 PM


All times are GMT -5. The time now is 01:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration