Strange duplication issues after using import script

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
griffithusg
Posts: 64
Joined: Sun Nov 07, 2010 7:16 pm

Strange duplication issues after using import script

Post by griffithusg »

Hi all,
Once again I seem to have found a stange duplication issue when using the import tool.
Hopefully not as long winded as the other one. I have created a small number of images to retrace my steps to make it hopefully clearer as to what steps im taking.

Please know that I have followed the import documentation to the letter.
The ENV is 32bit RedHat5 running in a VM ENV.


This is the host before the import
beforeimport.jpg
I then click the file I wish to import
importfile.jpg
It then adds 31 services successfully.
countofservices.jpg
You do not have the required permissions to view the files attached to this post.
Last edited by griffithusg on Tue Apr 05, 2011 12:33 am, edited 1 time in total.
griffithusg
Posts: 64
Joined: Sun Nov 07, 2010 7:16 pm

Re: Strange duplication issues after using import script

Post by griffithusg »

As you can see it has only added the 31 services.
firstimport.jpg
I then went through the entire process again changing only a check argument in the check_mem_ssh service check. - The reason for doing this is simulating what potentially might have changed between configs snapshots from the old system.
secondimport.jpg
As you can see it has added an extra check_zpool service check.

Just for debug purposes I have run the import again without deleting or changing any services and you can see it duplicates the check_zpool again creating a third duplicate.
import problem.jpg
Although the config does not error when exporting it does create lots of duplication warnings in the log. It also makes it rather messy in the CCM.

Hopefully we can out what is going on. let me know if you want me to send you the ragana.cfg.

Thanks.
You do not have the required permissions to view the files attached to this post.
rdedon
Posts: 578
Joined: Sat Nov 20, 2010 4:51 pm

Re: Strange duplication issues after using import script

Post by rdedon »

Just to make sure, this is the documentation you read http://assets.nagios.com/downloads/nagi ... ios_XI.pdf correct? (I am assuming though but just thought to check).

There is an issue that has come up with imports related to comma-separated and spaces. That being said, any space can cause it to duplicate as it reads both the word and then the word with a space.

We've identified the source of the duplicate entries upon importing into NagiosQL. It appears that when there is a comma separated list of hosts, services, groups, parents, etc in the prepped config files, that the values should not be having spaces put between them. After running tests with the spaces removed, the import happens cleanly, and there are no leftover duplicates in the Core Config Manager.

Example problem:
hostgroups group1, group2, group3


Example of fixed config line:
hostgroups group1,group2,group3
Rene deDon
Technical Team
___
Nagios Enterprises, LLC
Web: http://www.nagios.com
rdedon
Posts: 578
Joined: Sat Nov 20, 2010 4:51 pm

Re: Strange duplication issues after using import script

Post by rdedon »

Or a more specific example:

=====================
BAD CONFIG
=====================

Code: Select all

define host {
    host_name            BPI Process 2
    use                xiwizard_bpi_host
    address                127.0.0.1
    max_check_attempts        5
    check_interval            5
    retry_interval            1
    check_period            xi_timeperiod_24x7
    contacts            nagiosadmin
    notification_interval        60
    notification_period        xi_timeperiod_24x7
    notification_options        n
    hostgroups            linux-servers,websites,otherstuff       ## GOOD
    _xiwizard            bpiwizard
    register            1
    }    
===================
GOOD CONFIG
===================

Code: Select all

define host {
    host_name            BPI Process 2
    use                xiwizard_bpi_host
    address                127.0.0.1
    max_check_attempts        5
    check_interval            5
    retry_interval            1
    check_period            xi_timeperiod_24x7
    contacts            nagiosadmin
    notification_interval        60
    notification_period        xi_timeperiod_24x7
    notification_options        n
    hostgroups            linux-servers, websites, otherstuff   ## BAD
    _xiwizard            bpiwizard
    register            1
    }    
Rene deDon
Technical Team
___
Nagios Enterprises, LLC
Web: http://www.nagios.com
griffithusg
Posts: 64
Joined: Sun Nov 07, 2010 7:16 pm

Re: Strange duplication issues after using import script

Post by griffithusg »

Hello,
Yes, I have read this document.
I have also had this problem before with the duplications due to spaces.

Here is an except from the config to show you there are no spaces.

define service{
host_name ragana
service_description check_xv_ssh
use check_xv_ssh
check_command check_xv_ssh
parallelize_check 1
notification_period 24x7
}
define service{
host_name ragana
service_description check_zpool
use check_zpool
check_command check_zpool!duty
max_check_attempts 3
normal_check_interval 10
retry_check_interval 1
check_period 24x7
parallelize_check 1
notification_interval 60
notification_period on-call_hours
notification_options w,c,r
contact_groups usg_oncall
}
define service{
host_name ragana
service_description check_zpool_individual_rpool
check_command check_zpool_individual!duty!rpool
max_check_attempts 3
normal_check_interval 10
retry_check_interval 1
check_period 24x7
parallelize_check 1
notification_interval 60
notification_period on-call_hours
notification_options w,c,r
contact_groups usg_oncall
}

Is there a way to output what is being sent to Mysql from NagiosQL?
rdedon
Posts: 578
Joined: Sat Nov 20, 2010 4:51 pm

Re: Strange duplication issues after using import script

Post by rdedon »

griffithusg wrote:I have also had this problem before with the duplications due to spaces.
Ah, I spoke with my co-worker who worked with you previously and he is going to check over a few things as well.
Rene deDon
Technical Team
___
Nagios Enterprises, LLC
Web: http://www.nagios.com
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Strange duplication issues after using import script

Post by mguthrie »

Can you send us that full config? We'd like to run some tests on our end.
rdedon
Posts: 578
Joined: Sat Nov 20, 2010 4:51 pm

Re: Strange duplication issues after using import script

Post by rdedon »

Code: Select all

normal_check_interval 10
retry_check_interval 1
these may be causing an issue as it is changed now to

Code: Select all

check_interval 10
retry_interval 1
Rene deDon
Technical Team
___
Nagios Enterprises, LLC
Web: http://www.nagios.com
griffithusg
Posts: 64
Joined: Sun Nov 07, 2010 7:16 pm

Re: Strange duplication issues after using import script

Post by griffithusg »

Hi,
Sorry tried suggested changes to config with no difference.
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Strange duplication issues after using import script

Post by mguthrie »

I'm going back through the previous messages again, and I was wondering if you could give us just a little bit more detail on a few items.
I then went through the entire process again changing only a check argument in the check_mem_ssh service check. - The reason for doing this is simulating what potentially might have changed between configs snapshots from the old system.
So can you clarify just a little bit more on this part so I make sure I understand the steps correctly? You ran the import, it imported successfully the first time. I'm noticing that none of the files are synced yet. Did you apply this config, or did you run the import again?

What happens when you delete that service before re-running the import?

If you get the duplicate again, I'd like you to click the orange "Info" icon for both duplicates and show us that output. It should show us the Db relationships and to which tables. My guess is that it's ghosting an entry in there to satisfy a table relationship.


I don't think I'm quite understanding why you're using the import process to test a change in the configuration. The import process will establish new table relationships based on unique entry ID's, not host names and services names. I'm guessing this is causing the problem, but as I mentioned I don't think I'm completely understanding the situation.
Locked