Page 1 of 3
duplicates on import
Posted: Fri Apr 24, 2015 1:13 pm
by kendallchenoweth
When I import a changed service object definition into a Nagios XI server where that service is already defined, I'm getting a duplicate service rather than the original service being overwritten. The changed service object includes all necessary attributes. Is there some setting on the Nagios XI server where I'm doing the import to ensure that the new object overwrites the old object?
Thanks!
Re: duplicates on import
Posted: Fri Apr 24, 2015 1:47 pm
by tgriep
On the Import Config File Screen, there is a setting called "Overwrite Database", check that and it should overwrite the existing settings.
Re: duplicates on import
Posted: Fri Apr 24, 2015 2:20 pm
by kendallchenoweth
this option is already checked.
I got a duplicate service when I uploaded (via /etc/import) a new service description with only a changed hostgroup attribute.
I will recreate this and send you the config files that you can test on your servers. Along with the config files, what else can I provide you to help debug/understand this?
Re: duplicates on import
Posted: Fri Apr 24, 2015 2:25 pm
by abrist
You may have a service added to multiple hostgroups and/or also directly added to the host. This would cause the host to be assigned the same service twice. Check the "Manage Hosts" and "Manage Hostgroups" list for the service, and then check the "Manage Hostgroups" on the Host, and finally check the "Manage Hosts" on the hostgroups. It must be added twice somewhere.
Re: duplicates on import
Posted: Thu May 07, 2015 10:32 am
by kendallchenoweth
I am running Nagios XI 2014R2.0 and can reproduce the problem with the following steps. Please tell me if you see the same thing.
1) copy a service from /usr/local/nagios/etc/services to /usr/local/nagios/etc/import
2) change the hostgroup to a new valid value in the copy in /usr/local/nagios/etc/import
3) apply configuration
4) check the CCM and see if two services exist with different hostgroup values.
If I further disable the check with the old hostgroup entry by deselecting active, the new check now show up in the CCM with the status of "Not Applied". It looks like both entries have the same database id, but the overwrite isn't happening...
If you can't reproduce this on R2.0, let me know as well. Is this something addressed in a more current patch? Thanks!
Re: duplicates on import
Posted: Thu May 07, 2015 1:03 pm
by ssax
kendallchenoweth, I was able to replicate this on 2014R2.0 and on the latest 2014R2.7.
I've created a bug report for it:
Code: Select all
NEW TASK ID 5603 created - Nagios XI Bug Report: Import config doesn't overwrite and produces 2 services, when you disable one, the other says not applied.
Re: duplicates on import
Posted: Thu May 14, 2015 3:43 pm
by kendallchenoweth
Great... can you tell me if the fix is going to be in the next patch and when that's planned?
Thanks!
Re: duplicates on import
Posted: Thu May 14, 2015 4:45 pm
by ssax
After speaking with a developer he said that it will not work the way that we were trying because the import functionality uses the hostname/hostgroup when determining the config file name when importing and that it is expected.
He said that you can use /usr/local/nagios/etc/static and put/replace configs in there and restart nagios as an alternate solution for people who are manually managing configs. The caveats being that you will not be able to manage them through the CCM and you should delete the ones you are managing in the static directory from the CCM.
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Re: duplicates on import
Posted: Fri May 15, 2015 8:52 am
by kendallchenoweth
Drat. So as an alternative is there some command I can run to delete/disable the existing service before importing the new service? This would accomplish the same thing by having only one active service (the changed one I'm importing) in the system at any given time.
Thanks!
Re: duplicates on import
Posted: Fri May 15, 2015 10:45 am
by kendallchenoweth
It looks like a possible solution is to do the following.
cd /usr/local/nagiosxi/scripts
./nagiosql_delete_service --service=<configfile>
./reconfigure_nagios.sh
<copy the updated service into /usr/local/nagios/etc/import>
./reconfigure_nagios.sh
This will be part of a auto generated script. (I'm making changes in QA, validating and promoting the changes to the production system and executing remotely via ssh.)
Do you have any comments or suggestions on this solution?
Thanks!