Unable to apply configuration

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: Unable to apply configuration

Post by avandemore »

Profile received.

The output seems the Apply Configuration to have completed aside from the warnings. Is it working for you now?

The Errors and Warnings are generated by Nagios Core, here is some information on what Core expects in its configuration.

Services must be defined as a real service not a template to be active. A service can inherit from a template or stack of templates.

https://assets.nagios.com/downloads/nag ... tions.html
https://assets.nagios.com/downloads/nag ... tance.html

When Core generates a warning or error like the ones you have been experiencing, it's not frivolous or inaccurate. Simply reading the output and investigating the referenced file should provide some insight.
Previous Nagios employee
avlobos
Posts: 10
Joined: Tue Nov 08, 2016 7:23 pm

Re: Unable to apply configuration

Post by avlobos »

Hi,

I was attempting to make a minor change; adding the display name to a different host via the CCM then attempting to apply the configuration.


I got the following error:
apply_config_error.png
After checking the file the requirements are there. Host and service description:

Code: Select all

###############################################################################
#
# Service configuration file
#
# Created by: Nagios Core Config Manager 2.3.3
# Date:       2016-12-06 14:11:45
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND --- 
# Nagios CCM will overwrite all manual settings during the next update if you 
# would like to edit files manually, place them in the 'static' directory or 
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################

define service {
        host_name                       devappbuild01
        service_description             check load
        use                             tmpl_linadm_alert_waking_hours
        hostgroup_name                  default_linux_silent
        display_name                    check load -w 40,30,20 -c 50,40,30
        check_command                   custom_check_xi_by_ssh!'./check_load -w 40,30,20 -c 50,40,30'!!!!!!!
        contacts                        astuck
        contact_groups                  null
        register                        1
        }       

###############################################################################
#
# Service configuration file
#
# END OF FILE
#
###############################################################################
/usr/local/nagios/etc/services/custom_linux_load_linadmin_waking_hours_test.cfg

Not sure why I still have an issue when trying to apply this config.

Thanks
You do not have the required permissions to view the files attached to this post.
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: Unable to apply configuration

Post by avandemore »

XI > Admin > System Profile > Download Profile

Please include the zip file in your response. You can PM myself or other support personnel if you have privacy concerns.
Previous Nagios employee
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: Unable to apply configuration

Post by avandemore »

Profile received.

Please send this:

XI > Configure > Core Config Manager > Configuration Snapshots > [D/L most recent Config Error snapshot]

Please include the file in your response. You can PM myself or other support personnel if you have privacy concerns.
Previous Nagios employee
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: Unable to apply configuration

Post by avandemore »

How are you creating that service? This the definition in the config:

Code: Select all

define service {
	service_description		check load
	display_name			check load -w 40,30,20 -c 50,40,30
	check_command			custom_check_xi_by_ssh!'./check_load -w 40,30,20 -c 50,40,30'!!!!!!!
	notification_period		24x7
	contacts			astuck
	contact_groups			null
	register			1
	}	
As noted in the previous Object Definitions documentation, the service doesn't contain all the required fields.
Previous Nagios employee
avlobos
Posts: 10
Joined: Tue Nov 08, 2016 7:23 pm

Re: Unable to apply configuration

Post by avlobos »

The service that is creating the issue is a copy from an existing service named:
custom_linux_load_linadmin_waking_hours.cfg

It was simply copied and altered for testing, but now it's not allowing us to apply the config if we alter something or attempt to remove a host, etc.

I've added all the required parameters to problem service by going directly to the service and adding all the parameters thru the CCM ( custom_linux_load_linadmin_waking_hours_test.cfg see below ), but it's still giving me the same error when I try to apply the config:

Error: Service has no hosts and/or service_description (config file '/usr/local/nagios/etc/services/custom_linux_load_linadmin_waking_hours_test.cfg', starting on line 16)

Code: Select all

[root@prdmgtnag01 scripts]# cat /usr/local/nagios/etc/services/custom_linux_load_linadmin_waking_hours_test.cfg
###############################################################################
#
# Service configuration file
#
# Created by: Nagios Core Config Manager 2.3.3
# Date:	      2016-12-12 14:24:05
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND --- 
# Nagios CCM will overwrite all manual settings during the next update if you 
# would like to edit files manually, place them in the 'static' directory or 
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################

define service {
	host_name			devappbuild01
	service_description		check load
	use				tmpl_linadm_silent
	hostgroup_name			rhel5_gf_silent
	display_name			check load -w 40,30,20 -c 50,40,30
	check_command			custom_check_xi_by_ssh!'./check_load -w 40,30,20 -c 50,40,30'!!!!!!!
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		120
	first_notification_delay	5
	notification_period		custom_waking_hours
	notification_options		w,c,u,r,f,s,
	contacts			avillalobos
	contact_groups			null
	register			1
	}	

###############################################################################
#
# Service configuration file
#
# END OF FILE
#
###############################################################################
Can you please share the path of the service definition you sent in the last reply? I'm not sure we're looking at the same service definition.

Thanks
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: Unable to apply configuration

Post by avandemore »

In what way was it copied?

In CCM a copy of the service also brings across the associated hosts which you don't have in the failed apply config.

Also please note the header in the file:

Code: Select all

# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
All those files are generated on each apply config. You need to correctly define it in XI > Configure > CCM in order for the new configuration to apply.
Previous Nagios employee
avlobos
Posts: 10
Joined: Tue Nov 08, 2016 7:23 pm

Re: Unable to apply configuration

Post by avlobos »

Hi,

The service was copied using the CCM. It was not manually edited by directly accessing the files on the server.

Here's the original service as seen on the server:

Code: Select all

[root@prdmgtnag01 services]# cat ./custom_linux_load_linadmin_waking_hours.cfg 
###############################################################################
#
# Service configuration file
#
# Created by: Nagios Core Config Manager 2.3.3
# Date:	      2015-05-26 14:49:34
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND --- 
# Nagios CCM will overwrite all manual settings during the next update if you 
# would like to edit files manually, place them in the 'static' directory or 
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################

define service {
	service_description		check load
	use				tmpl_linadm_alert_waking_hours
	hostgroup_name			default_linux_alert
	display_name			check load -w 40,30,20 -c 50,40,30
	check_command			custom_check_xi_by_ssh!'./check_load -w 40,30,20 -c 50,40,30'!!!!!!!
	register			1
	}	

###############################################################################
#
# Service configuration file
#
# END OF FILE
#
###############################################################################
At this point, I just want to delete the problem service (custom_linux_load_linadmin_waking_hours_test.cfg) and save the changes but it won't even let me do that.

Thanks
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: Unable to apply configuration

Post by avandemore »

XI > Configure > Core Config Manager > Config File Management > Delete Files
XI > Configure > Core Config Manager > Configuration Snapshots > [Restore most recent Config Ok]
Apply Configuration.

That will bring your system back to the most recent known good state and ensure no ill-formed definitions are laying about.
Previous Nagios employee
avlobos
Posts: 10
Joined: Tue Nov 08, 2016 7:23 pm

Re: Unable to apply configuration

Post by avlobos »

Hi,

I don't see this:
XI > Configure > Core Config Manager > Config File Management

The closest thing I see is 'Write config files' which has a delete button with the following description:
"Delete all host/service configuration files"

Is it safe to run this? The description makes it sound like a dangerous thing to do.

Thanks
Locked