LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-23-2014, 12:35 PM   #1
anil98433
LQ Newbie
 
Registered: May 2012
Posts: 18

Rep: Reputation: Disabled
Unhappy nagios server problem


Hi all,


i had configured nagios server and nagios hosts however i am stuck with an error, to verify Nagios Configuration files for any errors.
command:- /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

current output of above command:-
Nagios Core 4.0.1
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 10-15-2013
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Error: Unexpected token or statement in file '/usr/local/nagios/etc/services.cfg' on line 1.
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.



Desired output should be :- Total Warnings: 0
Total Errors: 0

##################################################
Nagios server configuration:
IP:- 192.168.180.185
hostname:- server.example.com
domainname:- example.com

Nagios Client configuration
IP:- 192.168.180.186
hostname:- client.example.com
domainname:- example.com
####################################################

hosts.cfg file on nagios server is:

## Default Linux Host Template ##
define host{
name linux-box ; Name of this template
use generic-host ; Inherit default values
check_period 24x7
check_interval 5
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
}

## Default
define host{
use linux-box ; Inherit default values from a template
host_name client.example.com ; The name we're giving to this server
alias client.example.com ; A longer name for the server
address 192.168.180.186 ; IP address of Remote Linux host
}


kindly help me to resolve this problem....

one question hosts.cfg and services.cfg file created on nagios server or nagios host.....jst for confirmation.


Thanks
Anil
 
Old 05-23-2014, 12:57 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Since it is complaining about /usr/local/nagios/etc/services.cfg have you looked to see if that file exists and if so what is on the first line?

Does the nagios.cfg file contain a reference for services.cfg? Is it pointing to the correct location? On Nagios 3.x most config files moved to /usr/local/nagios/etc/objects instead of just etc itself. I'm not sure if that is still true in 4.x but this may be your problem if they are still in objects in 4.x but your nagios.cfg doesn't specify that.

hosts.cfg and services.cfg (and most .cfg files OTHER than nrpe.cfg) are on the Nagios master server rather than servers it is monitoring.

For the most part you'd want to install nrpe on the UNIX/Linux clients and something like nsclient++ on the Windows clients. For UNIX/Linux clients the config file is nrpe.cfg and you use the nrpe plugin installed on the Nagios master (in addition to the Nagios package itself) to run "check_nrpe" to query those clients. There are various modes including nrpe that can be setup in nsclient++ - If you use the nrpe mode on the Windows clients then the same check_nrpe on the Nagios master can query those as well.
 
Old 05-24-2014, 05:39 AM   #3
anil98433
LQ Newbie
 
Registered: May 2012
Posts: 18

Original Poster
Rep: Reputation: Disabled
Unhappy

Quote:
Originally Posted by MensaWater View Post
Since it is complaining about /usr/local/nagios/etc/services.cfg have you looked to see if that file exists and if so what is on the first line?

Does the nagios.cfg file contain a reference for services.cfg? Is it pointing to the correct location? On Nagios 3.x most config files moved to /usr/local/nagios/etc/objects instead of just etc itself. I'm not sure if that is still true in 4.x but this may be your problem if they are still in objects in 4.x but your nagios.cfg doesn't specify that.

hosts.cfg and services.cfg (and most .cfg files OTHER than nrpe.cfg) are on the Nagios master server rather than servers it is monitoring.

For the most part you'd want to install nrpe on the UNIX/Linux clients and something like nsclient++ on the Windows clients. For UNIX/Linux clients the config file is nrpe.cfg and you use the nrpe plugin installed on the Nagios master (in addition to the Nagios package itself) to run "check_nrpe" to query those clients. There are various modes including nrpe that can be setup in nsclient++ - If you use the nrpe mode on the Windows clients then the same check_nrpe on the Nagios master can query those as well.

you are right the problem was in services.cfg file now I rectified those mistakes however upon running command "service nagios restart" output is like that there are some mistakes which I cant figureout i.e.


runuser: warning: cannot change directory to /home/nagios: No such file or directory
Stopping nagios: [FAILED]
Starting nagios: runuser: warning: cannot change directory to /home/nagios: No such file or directory
[ OK ]
please shed some light on this problem.



--------
Thanks
Anil

Last edited by anil98433; 05-24-2014 at 06:06 AM.
 
Old 05-27-2014, 08:37 AM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
First - Before trying to start Nagios you can run a check to see if it finds errors - Assuming your install is in /usr/local/nagios:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Address what it tells you one by one - you should always run this when you make changes as it will help eliminate many simple issues.

Second - Read the errors you get and address them. It tells you /home/nagios is a problem so one or more of three things is the case:
1) /home/nagios does NOT exist
2) /home/nagios DOES exist but your Nagios user can't access it
3) Something in your configuration is pointing to /home/nagios. Is it the user's home in /etc/passwd? Is /home/nagios referenced in nagios.cfg anywhere?
 
  


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 3.1.2 + RHEL 5.3 You don't have permission to access /nagios/ on this server psix Linux - Server 13 08-04-2015 02:25 AM
icinga / nagios problem - Internal server error kimaaa Linux - Software 3 12-20-2013 09:34 AM
[SOLVED] Server synced to internal NTP/Nagios Server - Nagios Still Reports Timecheck Warning Led Zappa Linux - Newbie 6 09-09-2013 04:18 PM
i am unable to monitor or connect remote linux server uning nagios 3.3 on nagios linn nandunay Linux - Server 2 05-09-2012 04:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:52 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