LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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:07 AM   #1
ramesh14
Member
 
Registered: Apr 2008
Location: Hyderabad
Distribution: RHEL5,Fedora 8/9
Posts: 119
Blog Entries: 1

Rep: Reputation: 15
nagios adding remote host problem


I have some problem with nagios adding remote host in my localhost.cfg(/etc/nagios/objects/localhost.cfg) file

I installed nagios & nrpe properly i checked nagios configuration file it is working well. But i cann't able to add multiple hosts please guide me.

I followed these setps.

I installed nagios,nagios-plugins,nrpe,xinetd & openssl-devel
#yum install nagios nagios-plugins* nrpe xinted openssl-devel -y


I have edited /etc/nagios/objects/localhost.cfg file in that i have changed

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
}

i checked the configuration file
#nagios -v /etc/nagios/nagios.cfg

i got below 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 i have checked the nrpe
#/usr/local/nagios/libexec/check_nrpe -H <server ip>
#/usr/local/nagios/libexec/check_nrpe -H <remote host ip>
I got NRPE v2.12 this output

In remote host i have installed nrpe through yum
#yum install nrpe
#vi /etc/nagios/nrpe.cfg file
i have edited allow_hosts=<nagios serverip>
# nrpe -c /etc/nagios/nrpe.cfg -d
above the command excuted well because i didn't get any error


if it is only one remote host it is working very well if i have added multiple hosts in loacalhost.cfg file i am getting below error

i have excuted below command
#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 got above output.



please any one can help me how to add multiple remote hosts in my nagios server.


Thanks in advanced..........
 
Old 03-02-2011, 07:45 AM   #2
timvandijk039
Member
 
Registered: Jul 2009
Location: The Netherlands
Distribution: Debian/Ubuntu and RHEL/CentOS
Posts: 42

Rep: Reputation: 18
Hello ramesh14,

You've got a duplicate entry error in the nagios -v <conf file> output.

Quote:
Warning: Duplicate definition found for host 'localhost' (config file '/etc/nagios/objects/localhost.cfg', starting on line 34)
This means that you've probably defined the two hosts with the same hostname.

An example might be the following:

Code:
===== file: localhost.cfg =====
define host{
          use linux-server
          host_name localhost
          alias localhost
          address 192.168.0.28
}

define service{
          use                 generic-service
          host_name           localhost
          service_description <check_description>
          check_command       check_nrpe_disk (example)
          }

===== file: <remote_hostname>.cfg =====

define host{
          use linux-server
          host_name <remote_hostname>
          alias <whatever is meaningfull to you>
          address <remote_ip>
}

define service{
          use                 generic-service
          host_name           <remote_hostname>
          service_description <check_description>
          check_command       check_nrpe_disk (example)
          }

===== file: command.cfg =====
define command{
        command_name check_nrpe
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
        }


===== file: nagios.cfg ======
cfg_file=<path_to_localhost.cfg>
cfg_file=<path_to_remote_hostname.cfg>
Hope this helps getting things in perspective.

Regards,
Tim
 
1 members found this post helpful.
Old 03-03-2011, 11:05 PM   #3
ramesh14
Member
 
Registered: Apr 2008
Location: Hyderabad
Distribution: RHEL5,Fedora 8/9
Posts: 119

Original Poster
Blog Entries: 1

Rep: Reputation: 15
Again i got error for adding multiple hosts for nagios

hai timvandijk039;

Thanks for giving your guidance, what method you forwarded i followed those steps but i got error message like this.

I edited localhost.cfg
# 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
}

########
in the service session i added this service
define service{
use generic-service
host_name localhost
service_description Root Partion
check_command check_nrpe_disk!20%!10%!/
}
#############
i created remote_hostname.cfg file
define host{
use linux-server
host_name 7stl121
alias linux remotehost
address 192.168.0.29
}



define service{
use generic-service
host_name 7stl121
service_description Root Partion
check_command check_nrpe_disk!20%!10%!/
}
#####################################
i have added the commands.cfg
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
#######################################
after that i added the localhost.cfg & remote_hostname.cfg file name in nagios.cfg file. i have executed below the command

#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'...
Processing object config file '/etc/nagios/objects/remote_hostname.cfg'...
Read object config files okay...

Running pre-flight check on configuration data...

Checking services...
Error: Service check command 'check_nrpe_disk' specified in service 'Root Partion' for host '7stl121' not defined anywhere!
Error: Service check command 'check_nrpe_disk' specified in service 'Root Partion' for host 'localhost' not defined anywhere!
Checked 10 services.
Checking hosts...
Checked 2 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: 2

***> One or more problems was encountered while running the pre-flight check...

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.

please guide me i cann't able understand the error can i upgrade nagios & nrpe packages.



Thanks in advanced...............



Hi,

I have installed nagios, nrpe & xinetd is it required to install nrpe package in nagios server...........

Last edited by ramesh14; 03-03-2011 at 11:34 PM.
 
Old 03-04-2011, 08:37 AM   #4
dijk039
LQ Newbie
 
Registered: Aug 2005
Location: Netherlands
Posts: 1

Rep: Reputation: 1
Hello ramesh14,

It appears to me that you have your command_name wrong.

You've defined the command "check_nrpe"...
Quote:
command_name check_nrpe
... but refer to that commando with "check_nrpe_disk".
Quote:
check_command check_nrpe_disk!20%!10%!/
I think the solution to your problem would be to change the command name from check_nrpe_disk to check_nrpe in the files: remote_hostname.cfg and localhost.cfg

While typing this message I realize that I was the one that suggested this. That's because in my configuration I've defined some extra command's for nrpe. I accidentally forgot to change that while copying and pasting. Sorry for confusion.

Good luck. Nagios is absolutely worth using!!

Tim
 
1 members found this post helpful.
  


Reply



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 07:35 AM
[SOLVED] nagios adding remote host problem uppalagayatri Linux - Software 2 03-20-2011 11:16 PM
How to monitor remote host using nagios Ashish Sood Linux - General 16 01-25-2011 05:05 AM
Nagios passive or remote-host-side alert. knockout_artist Linux - Server 1 01-06-2010 11:49 AM
[Nagios] Ideas of Transferring file from remote to monitor host fabbie Linux - Newbie 2 12-02-2009 09:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:49 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
Open Source Consulting | Domain Registration