including a file from in the services.cfg file

Marc Powell marc at ena.com
Wed Mar 17 16:20:50 CET 2004


On Wednesday, March 17, 2004 3:05 AM, Patrick Amirian shared with us:

> HI,
> I would like to know if there is a way for me to Include a .txt file
> in my services.cfg file? 
> 
> I have a perl script that dynamically generates services to watch in
> a txt file and I just want the services.cfg file to include this file
> in itself so that I can monitor my systems that are constantly
> changing.   
> 
> So how do I include a txt file from within a .cfg file?

There's no way to do an include but you _can_ have multiple cfg_file
directives or you can use the cfg_dir directive to include all .cfg
files in the specified dir. You'll probably want to use a .cfg extension
instead of .txt (not sure if it matters though). In the examples below,
I generate all the tnops-* files out of a database every night and
everything else is static.

For example --

# Engineering Devices
cfg_file=/usr/local/nagios/etc/ena_config/enacorp.cfg
cfg_file=/usr/local/nagios/etc/ena_config/nschool.cfg
cfg_file=/usr/local/nagios/etc/ena_config/mcgavock.cfg
cfg_file=/usr/local/nagios/etc/ena_config/mis.cfg
cfg_file=/usr/local/nagios/etc/ena_config/dev-qc.cfg

# Tennessee Schools
cfg_file=/usr/local/nagios/etc/ena_config/tnops-east.cfg
cfg_file=/usr/local/nagios/etc/ena_config/tnops-lea-east.cfg
cfg_file=/usr/local/nagios/etc/ena_config/tnops-middle.cfg
cfg_file=/usr/local/nagios/etc/ena_config/tnops-lea-middle.cfg
cfg_file=/usr/local/nagios/etc/ena_config/tnops-west.cfg
cfg_file=/usr/local/nagios/etc/ena_config/tnops-lea-west.cfg
cfg_file=/usr/local/nagios/etc/ena_config/firewalls.cfg


Or

cfg_dir=/usr/local/nagios/etc/ena_config/


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list