• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 269
  • Last Modified:

nagios2 debian installation cannot remove a host

Dear experts,

I 'm not able to remove a host server from nagios2. I just started working here and I 'm not sure how nagios2 was configure. I cannot remove it using the admin webpage. I don't see an option to do so.

I can turn off notifications and that is it.

So I went to   etc/nagios2/conf.d folder in where found "company-hosts.cfg" (commented out information for host) and hostgroups_nagios2.cfg"(found & deleted name of host).

This was done in "company-hosts.cfg"

#define host {
#   use         generic-host
#    host_name   gw-254
#  alias       Routers Gateway
#  address
#    parents     gateway

I deleted the host name entry here:


Afterwards I was not able to restart nagios2. It was looking for the host information with some others as well. It mention dependencies...

I had to undo what I did so I can get Nagios2 back running.

This is what find in  /etc/nagios2/conf.d:

company-dvrs.cfg                    contacts_nagios2.cfg-201303141237~
company-dvrs.cfg-201006071110~      contacts_nagios2.cfg.bak
company-dvrs.cfg-201006071200~      extinfo_nagios2.cfg
company-dvrs.cfg-201006071212~      extinfo_nagios2.cfg-201006071121~
company-dvrs.cfg-201006071221~      generic-host_nagios2.cfg
company-hosts.cfg                   generic-host_nagios2.cfg-201006071122~
company-hosts.cfg-201006070958~     generic-host_nagios2.cfg-201106080106~
company-hosts.cfg-201006071111~     generic-service_nagios2.cfg
company-hosts.cfg-201006071127~     generic-service_nagios2.cfg-201006071123~
company-hosts.cfg-201012032047~     hostgroups_nagios2.cfg
company-hosts.cfg-201206300645~     hostgroups_nagios2.cfg-201006071009~
company-stores.cfg                  hostgroups_nagios2.cfg-201006071021~
company-stores.cfg-201006071022~    hostgroups_nagios2.cfg-201012032043~
company-stores.cfg-201006071112~    hostgroups_nagios2.cfg-201206300656~
company-stores.cfg-201009021710~    localhost_nagios2.cfg
company-stores.cfg-201307091407     localhost_nagios2.cfg-201006071124~
company-stores.cfg-201307091423     localhost_nagios2.cfg-201205241851~
company-stores-nwevpn.cfg~          services_nagios2.cfg
company-stores-nwevpn.cfg.off~      services_nagios2.cfg-201006071006~
company-stores-smacvpn.cfg          services_nagios2.cfg-201006071017~
company-stores-smacvpn.cfg~         services_nagios2.cfg-201006071125~
contacts_nagios2.cfg                services_nagios2.cfg-201101111049~
contacts_nagios2.cfg-201006070959~  services_nagios2.cfg-201106072342~
contacts_nagios2.cfg-201006071121~  services_nagios2.cfg-201207241647~
contacts_nagios2.cfg-201207052358~  services_nagios2.cfg-201207241833~
contacts_nagios2.cfg-201207240125~  timeperiods_nagios2.cfg
contacts_nagios2.cfg-201207241828~  timeperiods_nagios2.cfg-201006071213~

I wonder if I should clean it up a bit :D...


  • 5
  • 5
1 Solution
Steven CarnahanNetwork ManagerCommented:
What happens when you run the verify after making the change:

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Steven CarnahanNetwork ManagerCommented:
Looking at your listing on conf.d it appears that you have backups dating back to 2010.  I would advise saving the dated files somewhere else  such as a bkup folder just for ease of viewing prior to removal once you are sure you don't need them anymore (for historical purposes?)
marceloNYCMiddle-Tier AdministratorAuthor Commented:

Yes, I ask my boss wants them for historical purposes.

I don’t have that path from your first  comment. It goes something like this:


Choices from there are:

/usr/local$ ls
bin  bni  compaq  lib  sbin  sbin.1  share  stow
WEBINAR: 10 Easy Ways to Lose a Password

Join us on June 27th at 8 am PDT to learn about the methods that hackers use to lift real, working credentials from even the most security-savvy employees. We'll cover the importance of multi-factor authentication and how these solutions can better protect your business!

Steven CarnahanNetwork ManagerCommented:
Try just restarting nagios:

/etc/nagios2/conf.d# /etc/init.d/nagios2 restart

It should give you the name of the file with the error.
marceloNYCMiddle-Tier AdministratorAuthor Commented:

Will do after 3 PM central time. Thank you!
marceloNYCMiddle-Tier AdministratorAuthor Commented:
Reading about it...

Around here is the problem:

Steven CarnahanNetwork ManagerCommented:
I think what you might find is that you commented out the "define host" however somewhere in the file is also a section (or more) that references the host.


define host{
        use             generic-switch  ; Inherit default values from a template
        host_name       CDA 2960-4      ; The name we're giving to this switch
        alias           CDA 2960-4      ; A longer name associated with the switch
        address        ; IP address of the switch
        hostgroups      BR01 CDA                ; Host groups this switch is associated with

Open in new window

define hostgroup{
        hostgroup_name  BR01 CDA                ; The name of the hostgroup
        alias                   ; Long name of the group

Open in new window

define service{
        use                     generic-service ; Inherit values from a template
        host_name               CDA 2960-4      ; The name of the host the service is associated with
        service_description     PING            ; The service description
        contact_groups          NWservices
        check_command           check_ping!200.0,20%!600.0,60%  ; The command used to monitor the service
        normal_check_interval   5               ; Check the service every 5 minutes under normal conditions
        retry_check_interval    1               ; Re-check the service every minute until its final/hard state is determined

Open in new window

If I comment out the host I also have to comment out the other two sections.
marceloNYCMiddle-Tier AdministratorAuthor Commented:
Nice! Will try this on Monday. My boss has me doing something else.
marceloNYCMiddle-Tier AdministratorAuthor Commented:
It was as you said.

I reload it nagios after I took out the name of the server.

It told me what it didn't like and pointed me in the right direction.

Thank you!
Steven CarnahanNetwork ManagerCommented:
Glad to help.  Nagios is great but takes a lot of work to maintain.  :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Network Scalability - Handle Complex Environments

Monitor your entire network from a single platform. Free 30 Day Trial Now!

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now