Page 1 of 1

NagiosXI applying service checks to localhost

Posted: Tue Feb 07, 2017 11:15 am
by philip.ianni
Hey there,

We're having an issue where our brand new NagiosXI instance (migrated from a very old and broken NagiosXI server) is applying the localhost host to some services. The issue is that, based on looking in the GUI and config files in the server, that the host 'localhost' should not have these service checks at all.

Here's an example

The service 'Linux - Base - Disk Space' only uses the contact group 'Linux'. Inside 'Linux', localhost is not present. However in the GUI, when I search 'localhost', it shows the host having the service check 'Linux - Base - Disk Space'.


Thanks.

Re: NagiosXI applying service checks to localhost

Posted: Tue Feb 07, 2017 11:18 am
by rkennedy
Can you PM over a profile to myself, and dwhitfield? I'd like to see what's going on exactly in your configurations. (Admin -> System Profile -> Download Profile)

UPDATE: profile received and shared with techs.

Re: NagiosXI applying service checks to localhost

Posted: Tue Feb 07, 2017 1:36 pm
by philip.ianni
Sent over profile!

Re: NagiosXI applying service checks to localhost

Posted: Tue Feb 07, 2017 1:56 pm
by rkennedy
It looks like they are indeed being assigned -

Code: Select all

define service {
	host_name	localhost
	service_description	HTTP - medlib5/probe/site_medlib.html
	check_period	xi_timeperiod_24x7
	check_command	check_website_response!
From one of your config files -

Code: Select all

define service {
	host_name			localhost
	service_description		HTTP - medlib5/probe/site_medlib.html
	use				Standard Check Settings,Critical to VictorOps [System Administrators - Email]
	check_command			check_website_response!http://dc01-vip-viewer.prod-cloud.com/medlib5/probe/site_medlib.html!!!!!!!
	check_period			xi_timeperiod_24x7
	notification_period		xi_timeperiod_24x7
	_xiwizard			linux-server
	register			1
	}	

define service {
	host_name			localhost
	service_description		HTTP - medlib6/901/config.xml
	use				Standard Check Settings,Critical to VictorOps [System Administrators - Email]
	check_command			check_website_response!http://dc01-vip-viewer.prod-cloud.com/medlib6/901/config.xml!!!!!!!
	check_period			xi_timeperiod_24x7
	notification_period		xi_timeperiod_24x7
	_xiwizard			linux-server
	register			1
	}	

define service {
	host_name			dc01-web-17
	service_description		HTTP - MUC - web-17
	use				Standard Check Settings,Critical to VictorOps [System Administrators - Email]
	check_command			check_website_response!dc01-web-17.prod-cloud.com/MUC-web/index.html!!!!!!!
	check_period			xi_timeperiod_24x7
	notification_period		xi_timeperiod_24x7
	_xiwizard			linux-server
	register			1
	}	

define service {
	host_name			dc01-web-18
	service_description		HTTP - MUC - web-18
	use				Standard Check Settings,Critical to VictorOps [System Administrators - Email]
	check_command			check_website_response!dc01-web-18.prod-cloud.com/MUC-web/index.html!!!!!!!
	check_period			xi_timeperiod_24x7
	notification_period		xi_timeperiod_24x7
	_xiwizard			linux-server
	register			1
	}	
Additionally, I couldn't find any checks called 'Linux - Base - Disk space' in your service_description's - can you show us a screenshot of an exact service which shouldn't be under localhost?

Re: NagiosXI applying service checks to localhost

Posted: Fri Feb 10, 2017 4:12 pm
by philip.ianni
rkennedy wrote:It looks like they are indeed being assigned -

Code: Select all

define service {
	host_name	localhost
	service_description	HTTP - medlib5/probe/site_medlib.html
	check_period	xi_timeperiod_24x7
	check_command	check_website_response!
From one of your config files -

Code: Select all

define service {
	host_name			localhost
	service_description		HTTP - medlib5/probe/site_medlib.html
	use				Standard Check Settings,Critical to VictorOps [System Administrators - Email]
	check_command			check_website_response!http://dc01-vip-viewer.prod-cloud.com/medlib5/probe/site_medlib.html!!!!!!!
	check_period			xi_timeperiod_24x7
	notification_period		xi_timeperiod_24x7
	_xiwizard			linux-server
	register			1
	}	

define service {
	host_name			localhost
	service_description		HTTP - medlib6/901/config.xml
	use				Standard Check Settings,Critical to VictorOps [System Administrators - Email]
	check_command			check_website_response!http://dc01-vip-viewer.prod-cloud.com/medlib6/901/config.xml!!!!!!!
	check_period			xi_timeperiod_24x7
	notification_period		xi_timeperiod_24x7
	_xiwizard			linux-server
	register			1
	}	

define service {
	host_name			dc01-web-17
	service_description		HTTP - MUC - web-17
	use				Standard Check Settings,Critical to VictorOps [System Administrators - Email]
	check_command			check_website_response!dc01-web-17.prod-cloud.com/MUC-web/index.html!!!!!!!
	check_period			xi_timeperiod_24x7
	notification_period		xi_timeperiod_24x7
	_xiwizard			linux-server
	register			1
	}	

define service {
	host_name			dc01-web-18
	service_description		HTTP - MUC - web-18
	use				Standard Check Settings,Critical to VictorOps [System Administrators - Email]
	check_command			check_website_response!dc01-web-18.prod-cloud.com/MUC-web/index.html!!!!!!!
	check_period			xi_timeperiod_24x7
	notification_period		xi_timeperiod_24x7
	_xiwizard			linux-server
	register			1
	}	
Additionally, I couldn't find any checks called 'Linux - Base - Disk space' in your service_description's - can you show us a screenshot of an exact service which shouldn't be under localhost?
Thanks for your reply. Those service checks are intended to be there for localhost.

An example of a service that is included localhost when we do not want in included would be:

ServiceName: "Linux - Base" Description: "Disk Space"

The corresponding file on the server is /usr/local/nagios/etc/services/"Linux - Base.cfg"

Thanks.

Re: NagiosXI applying service checks to localhost

Posted: Mon Feb 13, 2017 10:28 am
by rkennedy
Looking through your configurations I found the two services -

Code: Select all

define service {
	host_name	localhost
	service_description	Disk Space
	check_period	24x7
	check_command	check_diskSpace!-a '85 91 90 95'!!!!!!!
	contact_groups	VictorOps-SysAdmins-Email
	notification_period	24x7
	initial_state	o
	importance	0
	check_interval	5.000000
	retry_interval	1.000000
	max_check_attempts	3
	is_volatile	0
	parallelize_check	1
	active_checks_enabled	1
	passive_checks_enabled	1
	obsess	1
	event_handler_enabled	1
	low_flap_threshold	0.000000
	high_flap_threshold	0.000000
	flap_detection_enabled	1
	flap_detection_options	c
	freshness_threshold	0
	check_freshness	0
	notification_options	r,c
	notifications_enabled	1
	notification_interval	60.000000
	first_notification_delay	0.000000
	stalking_options	n
	process_perf_data	1
	retain_status_information	1
	retain_nonstatus_information	1
	_VO_MONITOR_NAME	Production x
	_VO_ORGANIZATION_ID	x
	_VO_ORGANIZATION_KEY	x
	}

define service {
	host_name	localhost
	service_description	Drive C Disk Usage
	check_period	24x7
	check_command	check_xi_service_nsclient!x!USEDDISKSPACE!-l C -w 70 -c 90!!!!!
	contact_groups	VictorOps-SysAdmins-Email
	notification_period	24x7
	initial_state	o
	importance	0
	check_interval	5.000000
	retry_interval	1.000000
	max_check_attempts	3
	is_volatile	0
	parallelize_check	1
	active_checks_enabled	1
	passive_checks_enabled	1
	obsess	1
	event_handler_enabled	1
	low_flap_threshold	0.000000
	high_flap_threshold	0.000000
	flap_detection_enabled	1
	flap_detection_options	c
	freshness_threshold	0
	check_freshness	0
	notification_options	r,c
	notifications_enabled	1
	notification_interval	60.000000
	first_notification_delay	0.000000
	stalking_options	n
	process_perf_data	1
	retain_status_information	1
	retain_nonstatus_information	1
	_VO_MONITOR_NAME	Production x
	_VO_ORGANIZATION_ID	x
	_VO_ORGANIZATION_KEY	x
	}
I assume neither of these should be there. I then noticed that one of your templates has a default host_name of localhost, with the same _VO_###### variable passed through to both of them.

Code: Select all

define service {
       name                          		VictorOps_Service_Settings
       host_name                     		localhost
       process_perf_data             		1
       _VO_MONITOR_NAME              		x
       _VO_ORGANIZATION_ID           		x
       _VO_ORGANIZATION_KEY          		x
       register                    		0

}
If you had a random service that did not have a host assigned, then through the process of templates a service would be assigned to the localhost. I'm wondering if this could be affecting you. Could you try removing the host_name from the template and seeing if that fixes it?

Re: NagiosXI applying service checks to localhost

Posted: Mon Feb 13, 2017 11:57 am
by philip.ianni
Where are you seeing the _V_ entries like " _VO_ORGANIZATION_KEY x"? When I grep for on the server I only see it in the service template.

When I remove the host_name from the template it errors.

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

Re: NagiosXI applying service checks to localhost

Posted: Mon Feb 13, 2017 2:21 pm
by rkennedy
Those were from your objects.cache file, which is compiled from all of your templates / configs.
Error: Service has no hosts and/or service_description (config file '/usr/local/nagios/etc/services/victorops-Leonardo.cfg', starting on line 136)
This would indicate that these services are depending on the template to get their host. If you manually assign localhost to the services mentioned in this file, does it persist to create the other checks? I don't think it will. Here's what I found after further looking -

Let's look at the services defind in your /usr/local/nagios/etc/services/Nagios.cfg -

Code: Select all

define service {
	service_description		Disk Space
	use				Standard Check Settings,Critical to VictorOps [System Administrators - Email]
	check_command			nagios_check_diskSpace!85 90 !!!!!!!
	check_period			xi_timeperiod_24x7
	notification_period		xi_timeperiod_24x7
	_xiwizard			linux-server
	register			1
	}
(no host assigned)

which brings us to the template assigned -

Code: Select all

define service {
       name                          		Critical to VictorOps [System Administrators - Email]
       use                           		VictorOps_Service_Settings
       notification_interval         		60
       first_notification_delay      		0
       notification_period           		24x7
       notification_options          		c,r,
       notifications_enabled         		1
       contact_groups                		VictorOps-SysAdmins-Email
       register                    		0

}	
which then leads to the template, where you have localhost assigned -

Code: Select all

define service {
       name                          		VictorOps_Service_Settings
       host_name                     		localhost
       process_perf_data             		1
       _VO_MONITOR_NAME              		Production Nagios
       _VO_ORGANIZATION_ID           		leonardo
       _VO_ORGANIZATION_KEY          		cd94ae7e-5336-4755-b7a0-4cfbf6237db4
       register                    		0

}	
The other option is perhaps deleting the disk space check from this file in the CCM. (if it's not needed for anything else)

Re: NagiosXI applying service checks to localhost

Posted: Thu Feb 16, 2017 11:16 am
by philip.ianni
Thanks for your help. I was able to figure out the issue. I didn't want to remove the host_name from the template because functionally I needed it there, but I was able to explicitly exclude localhost on each of the service checks so it doesn't skip over and configure localhost to run on that service.

Thanks again,

Phil

Re: NagiosXI applying service checks to localhost

Posted: Thu Feb 16, 2017 11:45 am
by rkennedy
No problem - nice work around for it and use of templates :-)!

Going to close this thread up - feel free to create a new one if you have questions in the future!