Need help running nagios with a cfg_dir command


#1

I am running 2.0b4 and haven’t had any issues for about 3 months, while running the cfg files from /usr/local/nagios/etc. I am wanting to change where my cfg files are run, but when I use:

cfg_dir=/usr/local/nagios/etc/NewMexico

and comment out all of the individual cfg file entries in my nagios.cfg file, pre-flight fails. It fails on the resource.cfg file on the line:

$USER1$=/usr/lib/nagios/plugins

When I comment out the cfg_dir and uncomment the individual cfg file entries in the nagios.cfg, I don’t receive any errors during preflight.

I have resources in 7 different states that I am trying to monitor and I want to make seperate cfg_dirs for each location. I’m open to suggestions on how to achieve this if what I am trying to do is not possible.

Any help is greatly appreciated.

TD


#2

You’re trying to be that organized, eh?

Well, if you comment out all the .cfg files in Nagios.cfg, nagios will assume that those files don’t exist, because they’re not being checked when Nagios starts. So you have no hosts, no services, no host groups, no contacts…well, you get the idea.

What did you set your prefix to when you configured Nagios for the install? That’s not the default path for the $USER1$ macro; it’s /usr/local/nagios/libexec.

I don’t really see the point to having all these different directories, though. If it’s something you really want to do…I suppose you could create a bunch of small .cfg files…like, say you have 3 hosts, you create 3 hosts.cfg files: one in each directory for your hosts, and then just add those entries to nagios.cfg in your central nagios/etc/ subdirectory. I have no idea if that will work, but it’s worth a shot.

Of course, there will be .cfg files for which that won’t make any sense to make different versions in different directories, such as resource.cfg, hostgroups.cfg, servicegroups.cfg, misccommands.cfg, off the top of my head.
Edited Tue Jan 10 2006, 10:11PM ]


#3

don


#4

thanks for the info!

The issue was with my cgi.cfg and other .cfg files not running from /usr/local/nagios/etc.

Originally, the only .cfg file that I was running from /usr/local/nagios/etc was nagios.cfg