Page 1 of 1

Apply Configuration Fails with Disabled Items

Posted: Wed Jun 08, 2016 8:16 am
by mopp
Hi,

there is a bug in CCM. The bug applies not only to contacts or templates as shown in this example.
Nagios version 5.2.8
To reproduce the problem:
Create a contact and assign the contact to a service check.
=> Apply Configuration => Everything should work.
Disable the contact
=> Apply Configuration

Code: Select all

Error: Contact 'Test' is not defined anywhere!
Error: Could not add contact 'Test' to service (config file '/usr/local/nagios/etc/services/testservice.cfg', starting on line 16)
Config file line 16:
contacts Test
Another example:
Create a service template and assign the service template to a service. Add only one service template to the service.
=> Apply Configuration => Everything should work.
Disable the service template
=> Apply Configuration

Code: Select all

Error: Template 'local-service' specified in service definition could not be not found (config file '/usr/local/nagios/etc/services/localhost.cfg', starting on line 136)

Config file line 136:
use local-service
From my point of view CCM should not add a disabled items to the configuration file.
The workflow to check for an error is not very nice, to see the error in the configuration file you have to extract the tar.gz. file.
It would be much better if the configuration with the error is somehow readable by the web interface or at least easy visible using SSH.
For example this command will get the name of the config file from the log file.

Code: Select all

grep 'Error:.*config file ' /usr/local/nagiosxi/nom/checkpoints/nagioscore/errors/1465390852.txt | sed -e "s/.*(config file '//" -e "s/', starting.*//"
So it would be nice to have a button to download this file using the web interface, it should not be too difficult to implement.

Re: Apply Configuration Fails with Disabled Items

Posted: Wed Jun 08, 2016 10:22 am
by lmiltchev
Nagios version 5.2.8
To reproduce the problem:
Create a contact and assign the contact to a service check.
=> Apply Configuration => Everything should work.
Disable the contact
=> Apply Configuration
This is strange... You shouldn't be able to deactivate the contact if it is added to a host or a service... You should see an error in the CCM similar to the one below:
example01.PNG
Are you deactivating the contact in the CCM or making mods from the CLI?

Re: Apply Configuration Fails with Disabled Items

Posted: Thu Jun 09, 2016 2:24 am
by mopp
I' m using the web interface.
When I click on the little "information" icon next to the diskette icon, I get the following message:

Code: Select all

Database Relationships for contact:
Test
Items labeled as: 'Dependent relationships' will prohibit deletion
Object ID: 5 of table tbl_contact:
Relation to Contacttemplates, entry: generic-contact
Relation to Services, entry: localhost-testservice - Dependent relationship
When I click on testservice I get:

Code: Select all

Database Relationships for service:
localhost
Items labeled as: 'Dependent relationships' will prohibit deletion
Object ID: 17 of table tbl_service:
Relation to Contacts, entry: Test
Relation to Hosts, entry: localhost
Relation to Servicetemplates, entry: local-service
And as I' m writing it I found the bug:
If you select contact "Test" and use with checked "Deactivate" I get:

Code: Select all

Item Test cannot be disabled because it has dependent relationships
If you click on contact "Test" to edit the contact and then uncheck the checkbox "Active" you can save it and apply configuration.
=> Apply Configuration and Error

What is about my idea from above to make the configuration file with the error available in the web interface?

Re: Apply Configuration Fails with Disabled Items

Posted: Thu Jun 09, 2016 1:28 pm
by lmiltchev
And as I' m writing it I found the bug:
If you select contact "Test" and use with checked "Deactivate" I get:

Item Test cannot be disabled because it has dependent relationships

If you click on contact "Test" to edit the contact and then uncheck the checkbox "Active" you can save it and apply configuration.
=> Apply Configuration and Error
I was able to recreate the issue and filed an internal bug report (TASK ID 8777).
The workflow to check for an error is not very nice, to see the error in the configuration file you have to extract the tar.gz. file.
You should be able to see the error by clicking on the "Show Errors" link...
example01.PNG
example02.PNG

Re: Apply Configuration Fails with Disabled Items

Posted: Thu Jun 09, 2016 3:53 pm
by bheden
This has been fixed for CCM in XI 5.3.0. Thanks!