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      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...


marceloNYCMiddle-Tier AdministratorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.  :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Networking

From novice to tech pro — start learning today.