CFG_File


#1

Hello Everyone

I am new to nagios. Need a little guidance…

OK …

So you have the Main file. NAGIOS.CFG

This file points to a couple of default configuration files… ie.

cfg_file=/user/local/nagios/etc/objects/switch.cfg

==================================================
This is the problem I am having: As long as I add the new device in this case a switch inside the default switch.cfg file and restart nagios it is fine.

However if I try to change the location of the configuration say I create a new file within the same objects folder
cfg_file=/user/local/nagios/etc/objects/coreswitch.cfg

I get an error message when i restart nagios.
“config error! start aborted. check your nagios configuration”

I know there is no syntax error because it work inside the default switch.cfg file. I wanted to figure out a way to organize everything before I added more device. I don’t see myself adding all the switches inside the default switch.cfg file.

I encountered the same problem if I try to organized it into folders.
cfg_dir=/user/local/nagios/etc/mysite/coreswitch

I know its something minor I am performing incorrectly… Just not sure what it is…

Nagios 3.0 on centos5
:slight_smile:


#2

try running /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/objects/nagios.cfg that should give you some more info about what’s wrong (change your paths accordingly if needed)


#3

[root@localhost ~]# /usr local/nagios/bin/nagios -v /usr/local/nagios/etc/objects/nagios.cfg
bash: /usr: is a directory
[root@localhost ~]#
[root@localhost ~]# /usr local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
bash: /usr: is a directory
[root@localhost ~]#

Sounds like this is the output I got… no clue what it means or if it processed the command properly.


#4

just copy and paste it right…


#5

[quote=“aceofwhitestar1”][root@localhost ~]# /usr local/nagios/bin/nagios -v /usr/local/nagios/etc/objects/nagios.cfg
bash: /usr: is a directory
[root@localhost ~]#
[root@localhost ~]# /usr local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
bash: /usr: is a directory
[root@localhost ~]#

Sounds like this is the output I got… no clue what it means or if it processed the command properly.[/quote]

First off, (If you didn’t just make a typo in your post). -->

Look at the directory structure you typed: /user/local/nagios/etc/mysite/coreswitch:
The correct path would be: /usr/local/nagios/etc/mysite/coreswitch

If that was just a typo in your post then:

It sounds like you are having permissions problems.

  1. Verify that the “nagios” user is the owner of the directories/files you are creating (chown nagios:nagios [path to dir/file]).
  2. Verify that the nagios user has write access to the directories/files. (for Dir: chmod -R 660 [Path to Folder] , for files: chmod 660 [Path to File])

As for the Config verification problem -

Try the following:

**cd /usr/local/nagios/bin **
then
./nagios -v …/etc/nagios.cfg

Also, make sure you are running the command as the nagios user, depending on your permissions - the nagios user might be the only one allowed to execute the nagios binary.

Regards,
MonkInsane


#6

Once the Permission was changed to run under the nagios users it worked fine.

Thank you for the guidance…

The other folders I created were not owned by the nagios ID.

:slight_smile:


#7

[quote=“aceofwhitestar1”]Once the Permission was changed to run under the nagios users it worked fine.

Thank you for the guidance…

The other folders I created were not owned by the nagios ID.

:)[/quote]

It’s my pleasure, I know how frustrating Nagios can be when you’re setting it up for the first time - especially when you’re new to linux. I went through the same sorta quirks.