Is it possible to have seperate files eg hosts.cfg,service.cfg,hostgroups.cfg etc,on core 4.0.7.?
I have just created a hosts.cfg and defined 'hostTest'.But I keep getting error 'Host hosTest cannot be found',when i restart nagios.
But when I define this host inside locahost.cfg it works ok.
I would like to have separate files for the hosts,services and hostgroups.
Please advise.
Seperate cfg file for hosts in core 4.0.7
-
- Posts: 85
- Joined: Fri Mar 28, 2014 6:18 am
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Seperate cfg file for hosts in core 4.0.7
Yes this is possible.
In your nagios.cfg file you need to define the config files, for example:
In your nagios.cfg file you need to define the config files, for example:
Code: Select all
cfg_file=/usr/local/nagios/etc/objects/hosts.cfg
cfg_file=/usr/local/nagios/etc/objects/services.cfg
cfg_file=/usr/local/nagios/etc/objects/hostgroups.cfg
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
- Posts: 85
- Joined: Fri Mar 28, 2014 6:18 am
Re: Seperate cfg file for hosts in core 4.0.7
Thanks alot!
Re: Seperate cfg file for hosts in core 4.0.7
You can also use the "cfg_dir" directive to include *.cfg in a particular directory. And you can mix and match. Here's an example:
This means you can put your own commands.cfg and contacts.cfg and hosts.cfg and services.cfg or host_name.cfg in the my_custom_configs directory and Nagios will pick up those config files without having to specify them directly.
Don't need a file anymore (maybe for testing)? "mv my_custom_configs/file.cfg my_custom_configs/file.cfg.xxx" and it will no longer be loaded. XXX can be anything, so long as the file doesn't end in *.cfg
Code: Select all
cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/templates.cfg
cfg_dir=/usr/local/nagios/etc/my_custom_configs
Don't need a file anymore (maybe for testing)? "mv my_custom_configs/file.cfg my_custom_configs/file.cfg.xxx" and it will no longer be loaded. XXX can be anything, so long as the file doesn't end in *.cfg