Apply Configuration Fails with Disabled Items

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
mopp
Posts: 64
Joined: Thu Aug 20, 2015 7:15 am

Apply Configuration Fails with Disabled Items

Post 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.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Apply Configuration Fails with Disabled Items

Post 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?
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!
mopp
Posts: 64
Joined: Thu Aug 20, 2015 7:15 am

Re: Apply Configuration Fails with Disabled Items

Post 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?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Apply Configuration Fails with Disabled Items

Post 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
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!
bheden
Product Development Manager
Posts: 179
Joined: Thu Feb 13, 2014 9:50 am
Location: Nagios Enterprises

Re: Apply Configuration Fails with Disabled Items

Post by bheden »

This has been fixed for CCM in XI 5.3.0. Thanks!
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Nagios Enterprises
Senior Developer
Locked