• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1121
  • Last Modified:

Nagios adding .cfg file

got Nagios 3.2.0 ( i know its old), and trying to add a new host group configuration to seperate out web servers (W3svc) from all my other servers. Everytime I try to make a change to the Nagios.cfg file to add a new object .cfg file to run, the services fail to restart.

I'm pretty much a noob on Nagios and Linux, so any answer has to be really detailed and explicit.

Thanks,
0
AHEC
Asked:
AHEC
  • 16
  • 10
1 Solution
 
Sanga CollinsSystems AdminCommented:
what errors show up when you run the check config command?

/usr/local/bin/nagios -v /usr/local/etc/nagios/nagios.cfg
0
 
AHECAuthor Commented:
I don't have anything in usr/local/bin, so there's not nagios anything in there....also wouldn't the second part be -v /usr/local/nagios/etc/nagios.cfg and not etc/nagios/nagios.cfg...at least that is how my file structure is created.

anyway..i ran it verbatim and the command failed, no such file or directory or sonmething like that.
0
 
Sanga CollinsSystems AdminCommented:
i used the check config command from my default settings nagios install. if the files are in different directories on your system, you can modify the path accordingly.
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
Sanga CollinsSystems AdminCommented:
here is the command from the nagios website documentation

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
0
 
AHECAuthor Commented:
i ran the command /usr/local/nagios -v /usr/local/nagios/etc/nagios.cfg

and got:

/usr/local/nagios: is a directory

ok...so what??
0
 
marwin79Commented:
Try these commands to find the binary and config:

find / -type f -name nagios 2> /dev/null
find / -type f -name nagios.cfg 2> /dev/null

Now take the output from the first command, space, -v, space, output from second command.
0
 
AHECAuthor Commented:
Error: Cannot open resource file 'etc/resource.cfg' for reading!
Error in configuration file '/home/support/downloads/nagios-3.1.2/t/etc/nagios.cfg' Line 450 (Check result path is not a valid directory
Error processing Main config file!

Line 450 in that file reads
check_result_path=var/spool/checkresults

i'm getting really confused on how Nagios was installed on this server. I inherited this server and it didn't have a GUI, and I didn't have permissions to edit the nagios files...so I went thru all this trouble to install desktop, and now i'm using Alt+F2 initiating gksu nautilus to browse to the files to update configs, but where i'm browsing to is /usr/local/nagios/etc and .../etc/objects. Both of these directories have nagios.cfg, and windows.cfg and others...I've been able to edit the windows.cfg file in ...etc/objects  to add new servers and they do show up on the webpage and are being monitored.

anyway...i'm just really confused :) so thanks for the help. I'm thinking to start from scratch, but still want some help figuring this out.
0
 
Sanga CollinsSystems AdminCommented:
It does look like alot of config lines are either in the wrong place or somehow corrupted. The correct line 450 for a default nagios config is:

check_result_path=/usr/local/nagios/var/spool/checkresults

Maybe environment variable PATH was setup for /usr/local/nagios/ at some point and is no longer configured correctly. That may explain the strange paths in your configs. Either way keep letting me know what errors you are getting and ill keep trying to find the correction until you are back up and running.

PS a fresh start sounds like a good idea with the default setup from the website quickstart guide.


0
 
AHECAuthor Commented:
I'm starting new server,....but once again...

look the instructions tell me to create the nagios user and give it a password:

/usr/sbin/useradd -m -s /bin/bash nagios

passwd nagios

I take these instructions to mean two seperate commands...so i entered

/usr/sbin/useradd -m -s /bin/bash nagios

ENTER

and then tried:

passwd <entered my own password>

Enter...this does not work there is not command passwd...

help...


0
 
Sanga CollinsSystems AdminCommented:
yes they are two different commands, but the second command is

passwd nagios


as in set the passwd for the user called nagios :)
0
 
AHECAuthor Commented:
ok, i think i got past that part and have finished the setup, but now i get 500 internal server error when trying to log into the web interface.

I believe i may have not understood how to set a password following this command

htpasswd -c /usr/local/nagios/etc/htpasswd.user nagiosadmin

The instructions state only "remember the password you assign to this account - you'll need it later"...but i'm not a linux guy...i dont know how to do this...i wish the instructions were a bit more detailed!!!!
0
 
AHECAuthor Commented:
so you know how i can set a pssword for nagiosadmin account for web?
0
 
AHECAuthor Commented:
Nevermind...i got it...i re-ran the command and this time it actually asked me to create a password...i did not do the same the first time.
0
 
Sanga CollinsSystems AdminCommented:
good to hear. i hope you didnt delete the old /usr/local/nagios/etc/ directory. you can use some of those old configs in the new setup of nagios.

what i like to do is create a directory /usr/local/nagios/etc/configs

and in the nagios.cfg use the setting to specify a 'configuration file directory' All my configs go in there making it easy to back up and move to new instances of nagios or when upgrading :)
0
 
AHECAuthor Commented:
OK, so I have a brand new build on Ubuntu 10.10 and i've installed the desktop...cuz i need it...now...in what directory are the .cfg files i need to use to add servers, etc.

my understanding is that the are in /usr/local/nagios/etc and ...etc/objects

but ...please advise
0
 
Sanga CollinsSystems AdminCommented:
this is what i do for my nagios setup. I put all the host configs in the hosts dir and then use this line in the config file.


# You can also tell Nagios to process all config files (with a .cfg
# extension) in a particular directory by using the cfg_dir
# directive as shown below:

cfg_dir=/usr/local/nagios/etc/hosts
0
 
AHECAuthor Commented:
if i follow the instructions and remove the # in front of
cfg_file=/usr/local/nagios/etc/objects/windows.cfg

iget error:

unexpected start of object definition in <same file i just listed above> line 46

LINE 46 IS A BLANK FCKING LINE...LOL!!!! HELP!!!!!!!
0
 
AHECAuthor Commented:
I'M SORRY the line 46 in windows.cfg file is

define hostgroup{

which i did not change...i only added a host and changed the services to look for the defualt hostgroup_name windows-servers

OMG>>>you know...i'm banging my head against the walls!!!
0
 
Sanga CollinsSystems AdminCommented:
LOLOL i think its missing a { or } on a defenitiion before.

use the Code link below the comment window and post the whole config. ill take a look at it and see whats missing
0
 
AHECAuthor Commented:
If i create a directory "configs" in .../etc, and put the windows.cfg file in there...then in the nagios.cfg file i take away the # sign in front of
cfg_dir=/usr/local/nagios/etc/configs

i get the error...line 46 in the windows.cfg file, it does not like this windows.cfg file!

what am i missing...this is the file created during setup... all i did was add a host, and changed the service defenitions to look at hostgroup_name     windows-servers

0
 
AHECAuthor Commented:
thanks for the hint, in my host config the ending } was in line 29 along with IP address, it needed to be in line 30.

ok...i'm making headway!!!!

ok, so now that i've conquered that...here's what I want to do. I want to create a second host-group to seperate non web servers from the rest of my windows servers? first, is this the proper or logical way to do this? and secondly...how would i do this. do i just define a new .cfg file called soemthing like "windowsweb.cfg" and put it in my "configs" directory?

to me...it sounds right...but nothing has worked well for me past couple days :)

thanks for your ongoing help, do you wan't me to start a new question so you can get the points for this one already?
0
 
AHECAuthor Commented:
ok, so I think i got it figured out.

If i want to create a new host group, i must also edit the templates.cfg file.

I tried this on my old server without any luck...but on the new one...   :)

thanks again.
0
 
AHECAuthor Commented:
Thanks for all your help!
0
 
Sanga CollinsSystems AdminCommented:
i saw you had closed the question. wasnt sure if you got it all sorted out or still had some lingering concerns. Either way just let me know.
0
 
AHECAuthor Commented:
well...now i'm trying to get notifications set up...cuz this is new, and i'm no linux guy...everything is taking forever....I'm not sure I got it all setup.

I've edited the contacts.cfg file to the same it is on our current nagios server,

i ran sudo apt-get install mailutils (note: mailx failed told me to be more specific)

but i'm still not getting any notifications
0
 
Sanga CollinsSystems AdminCommented:
there is a thread that was on E a couple months ago about notifications for nagios in ubuntu. i use centos for my nagios install so sendmail works right out of the box. i will see if ii can find the link to the thread and post it for you.
0
 
AHECAuthor Commented:
ok, thanks.

any additional .cfg file editing other than the contacts.cfg?
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 16
  • 10
Tackle projects and never again get stuck behind a technical roadblock.
Join Now