Page 1 of 1

efficient way to create and manage host definition files?

Posted: Tue Oct 17, 2017 2:17 pm
by ikekim
Hi,

After having Nagios Core installed , up and running, I have created a very first host definition file and have it placed /usr/local/nagios/etc/objects/server1.cfg.

Then I modify the /usr/local/nagios/etc/nagios.cfg file by adding these lines:

# Definitions for monitoring the server1 (Linux) host
cfg_file=/usr/local/nagios/etc/objects/server1.cfg

This works fine, however, I need to create about 100 hosts so I don't want to create 100 host definition files and add 100 lines into the nagios.cfg file.

What would be the most efficient way for me to do this?

I think I can point to a directory or something like that, but not sure how to do this.


thanks,
ik.

Re: efficient way to create and manage host definition files

Posted: Tue Oct 17, 2017 2:18 pm
by mcapra
ikekim wrote:I think I can point to a directory or something like that, but not sure how to do this.

Code: Select all

# 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=/path/to/some/cfg/files

Re: efficient way to create and manage host definition files

Posted: Tue Oct 17, 2017 2:35 pm
by dwhitfield
Thanks @mcapra!

OP, let us know if you have any more questions.