Page 1 of 1

Import Breaks Nagios

Posted: Sat Mar 01, 2014 10:24 am
by mikew
I am working on a project that would like to import all new hosts, services, hostgroups, etc.

A problem that has developed is that any import of any hosts, services, etc. seems to break the Nagios configuration as it does not sync with the database.

CentOS 6.4 64-bit
Nagios XI 2012R2.9


This is a test host imported using templates and contact_groups already created. This config file was named test2.cfg and placed in the /usr/local/nagios/etc/import directory.


define host {
host_name test2
use linux-server
alias Test MTA 2
address 192.168.1.1
contact_groups admins
register 1
}

Then the /usr/local/nagiosxi/scripts/reconfigure_nagios.sh command was exectuted and the
return was:

Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 0
Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight check
RET: 0
Running configuration check...done.
Stopping nagios: done.
Starting nagios: done.

So it looks like everything is OK and the host shows up in the configuration. However, now when apply configuration is used there is an error which is not reflected in the snapshots and is not evident when the manual pre-flight check is run. The host config file is in place and looks correct.

Looking in the CCM is says sync_missed for the host. So what it is obvious that the MySQL database is not syncing with the text files which look correct. Removing the host, readding the host, nothing that is done allows you to recover seemingly.

Re: Import Breaks Nagios

Posted: Sat Mar 01, 2014 10:15 pm
by BanditBBS
Is there a reason you are running the reconfigure from the cli?

I've always followed these instructions to import and have never had an issue: http://assets.nagios.com/downloads/nagi ... p_Tool.pdf

Hope that helps!

Re: Import Breaks Nagios

Posted: Mon Mar 03, 2014 4:45 am
by mikew
The reason I am not using the prep tool is that the project is primarily using puppet to automate the import. The prep tool is usually used for the Nagios Core config files while the project I am working on wants to automate as much as the import as possible with puppet.

Re: Import Breaks Nagios

Posted: Mon Mar 03, 2014 12:28 pm
by lmiltchev
Mike, there must be something else in place here - wrong system time, problem with the templates, that you are using... I was not able to recreate the issue.

Note: I also had the "linux-server" and the "admins" already in place.

Here's what I did:

1. Created a new config (test2.cfg) and placed it in the "/usr/local/nagios/etc/import/" directory.

Code: Select all

define host {
host_name test2
use linux-server
alias Test MTA 2
address 192.168.1.1
contact_groups admins
register 1
}
2. Ran "./reconfigure_nagios.sh":

Code: Select all

cd /usr/local/nagiosxi/scripts
./reconfigure_nagios.sh
3. Viewed the host in the CCM.
example1.PNG

Code: Select all

###############################################################################
#
# Host configuration file
#
# Created by: Nagios QL Version 3.0.3
# Date:	      2014-03-03 11:20:10
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND --- 
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################

define host {
	host_name			test2
	use				linux-server
	alias				Test MTA 2
	address				192.168.1.1
	contact_groups			admins
	register			1
	}	

###############################################################################
#
# Host configuration file
#
# END OF FILE
#
###############################################################################
4. Applied configuration - no config issues.
example2.PNG
5. No out of sync issues in the CCM either.

Re: Import Breaks Nagios

Posted: Tue Mar 04, 2014 4:24 pm
by mikew
That is interesting because I reproduced it five times on 5 servers. OK, I will go back and see if there is something in those five servers that is causing it. Thanks.

Re: Import Breaks Nagios

Posted: Tue Mar 04, 2014 4:32 pm
by lmiltchev
Mike, let me know what you found out. BTW, you can PM me your configs, and I can try to recreate the issue one more time.

Re: Import Breaks Nagios

Posted: Mon Mar 10, 2014 9:53 am
by mikew
Update: Problem Was System Resources
I use a lot of virtual machines for testing and what I found was that sometimes with the limited resources of a virtual machine ( I am talking 512 RAM and 1 vCPU) some things will break when performing certain tasks. So in my testing when I provided more RAM to the system it worked fine.

Re: Import Breaks Nagios

Posted: Mon Mar 10, 2014 10:09 am
by slansing
Ah, thanks for letting us know what happened.