Import Breaks Nagios

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
mikew
Posts: 243
Joined: Sun Feb 05, 2012 7:05 pm

Import Breaks Nagios

Post 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.
Mike Weber

Nagios Training/Consulting
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: Import Breaks Nagios

Post 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!
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
User avatar
mikew
Posts: 243
Joined: Sun Feb 05, 2012 7:05 pm

Re: Import Breaks Nagios

Post 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.
Mike Weber

Nagios Training/Consulting
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Import Breaks Nagios

Post 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.
You do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
mikew
Posts: 243
Joined: Sun Feb 05, 2012 7:05 pm

Re: Import Breaks Nagios

Post 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.
Mike Weber

Nagios Training/Consulting
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Import Breaks Nagios

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
mikew
Posts: 243
Joined: Sun Feb 05, 2012 7:05 pm

Re: Import Breaks Nagios

Post 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.
Mike Weber

Nagios Training/Consulting
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Import Breaks Nagios

Post by slansing »

Ah, thanks for letting us know what happened.
Locked