Configstress after install - now running OK

Support requests, bug reports, questions etc.
Locked
Newling
Configstress after install - now running OK

Post by Newling » Thu Apr 30, 2009 09:58

Hi,
after fiddeling with the config of nagios and nconf here a quick-n-dirty solution to run after install.

1. Backup the files of /etc/nagios/objects
2. edit nagios.cfg and comment out all the cfg_file lines (line 30...) and the cfg_file line of localhost
(you can add all items from nconf later)
3. at line 52 in the actual nagios.cfg are the lines for cfg_dir entries written.
create a similar line with:
cfg_dir=/etc/nagios/objects
and safe the file.

I want to config (fast and comfortable in nconf) and with one shell script to push the new
config to nagios and restart nagios.

This is a sample script (working on my machine):
----snip-----------------
#!/bin/bash
# by Newling 04/2009

# create backup number
dow=`date +%u`
# change to nconf output dir
cd /opt/nagios/nconf/output

# create tempdir
mkdir new
cd new
# unpack actual file
tar xvzf ../NagiosConfig.tgz

# back to nagios
cd /etc/nagios
# backup last config
tar cvzf /opt/nagios/nconf/output/backup.$dow.tgz .

# now get the new config to the right place
cd objects
cp /opt/nagios/nconf/output/new/global/* .
cp /opt/nagios/nconf/output/new/Default_collector/* .
# and restart nagios
rcnagios restart

---------snip---------------

Next, i try to reach the last target: after creating the config in nconf, automatic transfer to nagios and restart.

Newling

Guest

Re: Configstress after install - now running OK

Post by Guest » Thu Apr 30, 2009 10:03

Newling wrote:Hi,
after fiddeling with the config of nagios and nconf here a quick-n-dirty solution to run after install.

Be sure that nconf is creating the new config in the output dir before you do this!

1. Backup the files of /etc/nagios/objects
2. edit nagios.cfg and comment out all the cfg_file lines (line 30...) and the cfg_file line of localhost
(you can add all items from nconf later)
3. at line 52 in the actual nagios.cfg are the lines for cfg_dir entries written.
create a similar line with:
cfg_dir=/etc/nagios/objects
and safe the file.
4. delete ALL files in /etc/nagios/objects and copy all files from the nconf output to this dir
5. restart nagios

I want to config (fast and comfortable in nconf) and with one shell script to push the new
config to nagios and restart nagios.

This is a sample script (working on my machine):
----snip-----------------
#!/bin/bash
# by Newling 04/2009

# create backup number
dow=`date +%u`
# change to nconf output dir
cd /opt/nagios/nconf/output

# create tempdir
mkdir new
cd new
# unpack actual file
tar xvzf ../NagiosConfig.tgz

# back to nagios
cd /etc/nagios
# backup last config
tar cvzf /opt/nagios/nconf/output/backup.$dow.tgz .

# now get the new config to the right place
cd objects
cp /opt/nagios/nconf/output/new/global/* .
cp /opt/nagios/nconf/output/new/Default_collector/* .
# and restart nagios
rcnagios restart

---------snip---------------

Next, i try to reach the last target: after creating the config in nconf, automatic transfer to nagios and restart.

Newling

Locked