Import config not working
-
mikemontreal
- Posts: 17
- Joined: Mon Oct 29, 2012 8:54 am
Import config not working
So anytime I import a host config file that I make changes to manually,I lose changes.
So I do the following
1-I make copy of hostabc.cfg to /usr/local/nagios/etc/hosts/example/hostabc.cfg
2- Edit file like change template name
3- Import with Overwrite Database checked
4- Apply config changes
5- All changes lost
I have also tried placing the updated config to the import folder with no luck.I must be doing something wrong??
So I do the following
1-I make copy of hostabc.cfg to /usr/local/nagios/etc/hosts/example/hostabc.cfg
2- Edit file like change template name
3- Import with Overwrite Database checked
4- Apply config changes
5- All changes lost
I have also tried placing the updated config to the import folder with no luck.I must be doing something wrong??
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Import config not working
Create the following folders:
Place your hostabc.cfg file into the orig directory and it should be left alone.
Check out this document:
http://assets.nagios.com/downloads/nagi ... p-Tool.pdf
Code: Select all
mkdir /usr/local/nagios/etc/cfgprep
mkdir /usr/local/nagios/etc/cfgprep/origCheck out this document:
http://assets.nagios.com/downloads/nagi ... p-Tool.pdf
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
mikemontreal
- Posts: 17
- Joined: Mon Oct 29, 2012 8:54 am
Re: Import config not working
sorry for not being clear
I am using Nagiosxi config files,hosts that exist in my Nagiosxi already
hostabc.cfg < is a host in nagiosxi and I am simply making some manual changes.
The reason behind this is I need to change 100+ host cnnfig host template names so I just wanted to use the sed command
sed -i 's/qt_qa_xiwizard_windowsserver_host/qt_xiwizard_windowsserver_host/' ./*
and re-import new configs .
Like i said earlier so anytime I import a host config file that I make changes to manually,I lose the changes.
So I do the following
1-I make copy of a nagiosxi hostabc.cfg to /usr/local/nagios/etc/hosts/example/hostabc.cfg
2- Edit file
cd example/
sed -i 's/qt_qa_xiwizard_windowsserver_host/qt_xiwizard_windowsserver_host/' hostabc.cfg
3- Import through web gui with Overwrite Database checked
4- Apply config changes
5- All changes lost
I am using Nagiosxi config files,hosts that exist in my Nagiosxi already
hostabc.cfg < is a host in nagiosxi and I am simply making some manual changes.
The reason behind this is I need to change 100+ host cnnfig host template names so I just wanted to use the sed command
sed -i 's/qt_qa_xiwizard_windowsserver_host/qt_xiwizard_windowsserver_host/' ./*
and re-import new configs .
Like i said earlier so anytime I import a host config file that I make changes to manually,I lose the changes.
So I do the following
1-I make copy of a nagiosxi hostabc.cfg to /usr/local/nagios/etc/hosts/example/hostabc.cfg
2- Edit file
cd example/
sed -i 's/qt_qa_xiwizard_windowsserver_host/qt_xiwizard_windowsserver_host/' hostabc.cfg
3- Import through web gui with Overwrite Database checked
4- Apply config changes
5- All changes lost
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Import config not working
Every time you Apply Configuration, your manual changes will be overwritten. All the settings are stored in CCM and the flat config files are pushed down from CCM.
That's why the files start with:
If you must maintain the cfg files yourself, anything in /usr/local/nagios/etc/static/ is not touched by Apply Config.
To do what you want to do, copy the files to /usr/local/nagios/etc/cfgprep/orig/ first and then do your sed command. Then run the import tool.
That's why the files start with:
Code: Select all
###############################################################################
#
# Host configuration file
#
# Created by: Nagios Core Config Manager 2.2.0
# Date: 2014-09-15 10:31:13
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################To do what you want to do, copy the files to /usr/local/nagios/etc/cfgprep/orig/ first and then do your sed command. Then run the import tool.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
mikemontreal
- Posts: 17
- Joined: Mon Oct 29, 2012 8:54 am
Re: Import config not working
So I did as you said. But it seems to append changes and not replace??
Before import
###############################################################################
#
# Host configuration file
#
# Created by: Nagios Core Config Manager 2.2.0
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################
define host {
host_name host
use qt_qa_xiwizard_linuxserver_host
alias host
address host.qt.com
register 1
}
###############################################################################
#
# Host configuration file
#
# END OF FILE
#
###############################################################################
After import
###############################################################################
#
# Host configuration file
#
# Created by: Nagios Core Config Manager 2.2.0
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################
define host {
host_name host
use qt_qa_xiwizard_linuxserver_host,qt_xiwizard_linuxserver_host
alias host
address host.qt.com
register 1
}
###############################################################################
#
# Host configuration file
#
# END OF FILE
#
###############################################################################
cat orig/host.cfg
###############################################################################
#
# Host configuration file
#
# Created by: Nagios Core Config Manager 2.2.0
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################
define host {
host_name host
use qt_xiwizard_linuxserver_host
alias host
address host.qt.com
register 1
}
###############################################################################
#
# Host configuration file
#
# END OF FILE
#
###############################################################################
Before import
###############################################################################
#
# Host configuration file
#
# Created by: Nagios Core Config Manager 2.2.0
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################
define host {
host_name host
use qt_qa_xiwizard_linuxserver_host
alias host
address host.qt.com
register 1
}
###############################################################################
#
# Host configuration file
#
# END OF FILE
#
###############################################################################
After import
###############################################################################
#
# Host configuration file
#
# Created by: Nagios Core Config Manager 2.2.0
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################
define host {
host_name host
use qt_qa_xiwizard_linuxserver_host,qt_xiwizard_linuxserver_host
alias host
address host.qt.com
register 1
}
###############################################################################
#
# Host configuration file
#
# END OF FILE
#
###############################################################################
cat orig/host.cfg
###############################################################################
#
# Host configuration file
#
# Created by: Nagios Core Config Manager 2.2.0
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################
define host {
host_name host
use qt_xiwizard_linuxserver_host
alias host
address host.qt.com
register 1
}
###############################################################################
#
# Host configuration file
#
# END OF FILE
#
###############################################################################
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Import config not working
I've just tested what you've said and I've been able to reproduce the issue where it is appending the changes to the templates it's using instead of overwritting.
I'll look into this further and get back to you.
I'll look into this further and get back to you.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Import config not working
It should essentially be overwriting that whole config upon import, not appending. It certainly looks like the template changes took, were you expecting just the qt_xiwizard_linuxserver_host template and not the qt_qa_xiwizard_linuxserver_host, template? Maybe I missed it in all that output, but could you post the full config before and after the modifications you are doing, this should be entirely outside of the idea of importing, just flat config files please.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
-
mikemontreal
- Posts: 17
- Joined: Mon Oct 29, 2012 8:54 am
Re: Import config not working
Started with this
###############################################################################
#
# Host configuration file
#
# Created by: Nagios Core Config Manager 2.2.0
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################
define host {
host_name host
use qt_qa_xiwizard_linuxserver_host
alias host
address host.qt.com
register 1
}
###############################################################################
#
# Host configuration file
#
# END OF FILE
#
###############################################################################
What I would like to do is to replace qt_qa_xiwizard_linuxserver_host with qt_xiwizard_linuxserver_host on 100 + hosts cfgs
Example
###############################################################################
#
# Host configuration file
#
# Created by: Nagios Core Config Manager 2.2.0
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################
define host {
host_name host
use qt_xiwizard_linuxserver_host
alias host
address host.qt.com
register 1
}
###############################################################################
#
# Host configuration file
#
# END OF FILE
#
###############################################################################
###############################################################################
#
# Host configuration file
#
# Created by: Nagios Core Config Manager 2.2.0
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################
define host {
host_name host
use qt_qa_xiwizard_linuxserver_host
alias host
address host.qt.com
register 1
}
###############################################################################
#
# Host configuration file
#
# END OF FILE
#
###############################################################################
What I would like to do is to replace qt_qa_xiwizard_linuxserver_host with qt_xiwizard_linuxserver_host on 100 + hosts cfgs
Example
###############################################################################
#
# Host configuration file
#
# Created by: Nagios Core Config Manager 2.2.0
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################
define host {
host_name host
use qt_xiwizard_linuxserver_host
alias host
address host.qt.com
register 1
}
###############################################################################
#
# Host configuration file
#
# END OF FILE
#
###############################################################################
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Import config not working
Gotcha! As box mentioned, we have reproduced and submitted a bug, for this issue. Hopefully it gets resolved shortly, but we will post back when a patch is ready.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
-
mikemontreal
- Posts: 17
- Joined: Mon Oct 29, 2012 8:54 am
Re: Import config not working
Thank you for your time, I look forward to the patch.
Work around for now that I'm using is copy all host.cfgs to other location> delete all hosts and services and apply >make changes to copys>move back to /../nagios/etc/hosts/ > follow import doc
Work around for now that I'm using is copy all host.cfgs to other location> delete all hosts and services and apply >make changes to copys>move back to /../nagios/etc/hosts/ > follow import doc