efficient way to create and manage host definition files?

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
ikekim
Posts: 85
Joined: Wed Aug 16, 2017 12:21 pm

efficient way to create and manage host definition files?

Post 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.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: efficient way to create and manage host definition files

Post 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
Former Nagios employee
https://www.mcapra.com/
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: efficient way to create and manage host definition files

Post by dwhitfield »

Thanks @mcapra!

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