Page 1 of 1

Can't delete service or host

Posted: Thu Sep 04, 2014 2:53 pm
by hillhealthcenter
Hi,

I'm having trouble delete one host and it's related service.

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

Here are the contents of the file

Code: Select all

###############################################################################
#
# Service configuration file
#
# Created by: Nagios QL Version 3.0.3
# Date:       2014-06-04 13:24:21
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################

define service {
        host_name                       antek-server
        service_description             Ping
        use                             xiwizard_windowsserver_ping_service
        max_check_attempts              5
        check_interval                  5
        retry_interval                  1
        check_period                    xi_timeperiod_24x7
        notification_interval           60
        notification_period             xi_timeperiod_24x7
        contacts                        nagiosadmin
        _xiwizard                       windowsserver
        register                        1
        }

###############################################################################
#
# Service configuration file
#
# END OF FILE
#
###############################################################################
Nagios XI Version : 2014R1.4
2.6.32-220.23.1.el6.i686 i686
CentOS release 6.2 (Final)

Re: Can't delete service or host

Posted: Thu Sep 04, 2014 2:55 pm
by tmcdonald
In the Core Configuration Manager, you can either delete that service or attach it to a host then click Apply Config again.

Re: Can't delete service or host

Posted: Thu Sep 04, 2014 3:24 pm
by hillhealthcenter
tmcdonald,

Thanks for getting back to me.

I'm still getting the same error.

Re: Can't delete service or host

Posted: Thu Sep 04, 2014 3:26 pm
by tmcdonald
Go ahead and remove the /usr/local/nagios/etc/services/antek-server.cfg file from the command line, then re-run Apply Config. Chances are there will be other services like this, in which case they too will need to be removed.

Re: Can't delete service or host

Posted: Thu Sep 04, 2014 3:52 pm
by hillhealthcenter
I deleted the file from the command and verified that it was no longer listed the directory.
I clicked Apply at the CCM then file was recreated.
I still cannot successfully remove the service and the related host.

Re: Can't delete service or host

Posted: Thu Sep 04, 2014 4:03 pm
by lmiltchev
I deleted the file from the command and verified that it was no longer listed the directory.
I clicked Apply at the CCM then file was recreated.
This config is being pulled from somewhere... Are you sure it is not still in the database (CCM)? Are you reverting to the last good configuration because of config errors? Try removing the service again from the CLI, but instead of applying configuration directly, run the Write Config Tool, and observe the output for errors. If there are no errors, apply configuration.

Re: Can't delete service or host

Posted: Thu Sep 04, 2014 5:47 pm
by EnvBroker1
I had the problem where after making a lot of changes to fix problems, one big fatal error and it reverted back to the last know good config. I didn't notice that at first so I was confused until I picked up on that. Check the date on the file and if it's days ago then that's one problem. Until I fixed this, I would make a copy of the file I had fixed, just it case it was over written again.

In the CCM, if you find that service and click on the I button, it's supposed to tell you what the dependencies are so you can continue to track down where the actual problem is.

Anyway, that's some of the stuff I went through before I even got my first good verification to run.

Hope that's helpful.

Re: Can't delete service or host

Posted: Thu Sep 04, 2014 5:53 pm
by hillhealthcenter
This is what I get after deleting the .cfg file then click the Write button under Write Configs To File.

Code: Select all

Write host configurations ...
Host configuration files successfully written!

Write service configurations ...
Configuration file: antek-server.cfg successfully written!
Service configuration files successfully written!

Configuration file: hostgroups.cfg successfully written!
Configuration file: servicegroups.cfg successfully written!
Configuration file: hosttemplates.cfg successfully written!
Configuration file: servicetemplates.cfg successfully written!
Configuration file: timeperiods.cfg successfully written!
Configuration file: commands.cfg successfully written!
Configuration file: contacts.cfg successfully written!
Configuration file: contactgroups.cfg successfully written!
Configuration file: contacttemplates.cfg successfully written!
Configuration file: servicedependencies.cfg successfully written!
Configuration file: hostdependencies.cfg successfully written!
Configuration file: serviceescalations.cfg successfully written!
Configuration file: hostescalations.cfg successfully written!
Configuration file: serviceextinfo.cfg successfully written!
Configuration file: hostextinfo.cfg successfully written!

Re: Can't delete service or host

Posted: Fri Sep 05, 2014 9:28 am
by tmcdonald
lmiltchev wrote:[...] run the Write Config Tool, and observe the output for errors. If there are no errors, apply configuration.
Did you apply config? If so, were there errors?