Page 1 of 2

[SOLVED] New hosts not showing up in web interface

Posted: Mon Nov 26, 2012 9:13 am
by Steffan
Hi guys,

(Sorry for my english, but i'm sure you will understand).

OS: OpenSUSE 11 SP1 (64Bit)

This one has been bugging me for some weeks now, and i dont know what to try anymore.

The problem is, that if i add a new host in my config files, it does not show up in nagios web interfalce ( http://nagios-server/nagios/ )
and YES, i have restartet the nagios service to load changes in the configurations files! (i have even restarted the entire server, just to be sure)

BUT when i check the status.dat the results from the check on the newly add'ed host is there!! i just cant see it in the web interface.

In short:
I can add a new host, but cant see it. The service/host check's gets executed and the result is shown in the status.dat.

Does anyone have an idear of what this could be ? i dont really want to start from scratch with my nagios installation since i have about 120 servers and 1000 services.

Re: New hosts not showing up in web interface

Posted: Mon Nov 26, 2012 9:18 am
by Steffan
Something i have been thinking about is, since i run linux it maybe a permission problem?
Can anyone tell me, where the webinterface reads to get the hosts/service to show in tactical overview, hosts view and services view ? maybe the problem is, that when i restart the nagios service it cant write the new host/service into theese files ?
Just an idear, what do you guys think?

Re: New hosts not showing up in web interface

Posted: Mon Nov 26, 2012 10:05 am
by V3xX
hello,

where you can't see the host on webinterface?
The tactical overview only shows hosts with problems, not all hosts.

do you find the host, if you search it in quick search box?


kind regards
V3xX

Re: New hosts not showing up in web interface

Posted: Tue Nov 27, 2012 2:40 am
by Steffan
V3xX wrote:hello,

where you can't see the host on webinterface?
The tactical overview only shows hosts with problems, not all hosts.

do you find the host, if you search it in quick search box?


kind regards
V3xX
Hi,

Well, the Tactical overview also shows a "# Active Host / Service Checks: 122 / 712" and i know for sure that i have over 122 hosts with an active check.
I can't find the missing hosts if i search either, the 122 hosts that i can see, i can find by searching too. its only newly add'ed hosts that are not showing up.
I cant see the missing hosts in config.cgi either... but the result from the active checks on theese hosts still shows up in status.dat!

Please, let me know if you want me to test/try/look for something!

Re: New hosts not showing up in web interface

Posted: Tue Nov 27, 2012 3:20 am
by Steffan
I think a pretty good way to describe it is to show you, so i made some screenshots of it and attached it to this post.
As you can see, there is executed active checks on the host named DC4. but if i click on the host, the host is not found in the web interface (if i search for DC4 in the menu to the left, i can't fint it either)

Hope this helps understanding the problem..

NOTE: is doesn't matter what browser i use, or if i open in new tabs on the same tab. i tried with another user in my nagios configuration too, and from another computer just to be sure.

Re: New hosts not showing up in web interface

Posted: Tue Nov 27, 2012 6:55 am
by Steffan
Hi again,

I just ran a check of the configuration files because i add'ed a new host like usual, and i noticed that it outputs a number of hosts, services, groups and so on. and to show you how many hosts my nagios configuration actually has i took a screenshot of this too.
As you can see i have 147 hosts, but my nagios web interface only shows 122 of theese.

Re: New hosts not showing up in web interface

Posted: Tue Nov 27, 2012 4:04 pm
by jsmurphy
Hmmmmm this all smells a lot like a lack of Nagios privileges...

Can you post the authorization section from your cgi.cfg? Are you also able to post the contact, contact-group, host, a single service and host-template if relevant for the DC4 host?

I know that's a lot of information but if my hunch is right, this information will make it pretty obvious where the problem is :)

Re: New hosts not showing up in web interface

Posted: Wed Nov 28, 2012 2:48 am
by Steffan
jsmurphy wrote:Hmmmmm this all smells a lot like a lack of Nagios privileges...

Can you post the authorization section from your cgi.cfg? Are you also able to post the contact, contact-group, host, a single service and host-template if relevant for the DC4 host?

I know that's a lot of information but if my hunch is right, this information will make it pretty obvious where the problem is :)
Here you go :) i took out some ip addresses, phone numbers, emails and so on because this i a public forum and i dont think you need it for solving this case.

Authorization from cgi.cfg, as you can see everyone has access to everything as long as they are logged in:

Code: Select all

use_authentication=1
use_ssl_authentication=0
authorized_for_system_information=*
authorized_for_configuration_information=*
authorized_for_system_commands=*
authorized_for_all_services=*
authorized_for_all_hosts=*
authorized_for_all_service_commands=*
authorized_for_all_host_commands=*
#authorized_for_read_only=user1,user2 #note, this is not enabled

The DC4 host:

Code: Select all

define host{
        use             windows-server  ; Inherit default values from a template
        host_name       DC4   ; The name we're giving to this host
        alias           DC4 Herning  ; A longer name associated with the host
        hostgroups      LH,windows-machines  ; Host groups that the server should be a member of
        address         xxx.xxx.xxx.xxx   ; IP address of the host
        }


The windows-server template (used by DC4):

Code: Select all

define host{
        name                    windows-server   ; The name of this host template
        use                     generic-host   ; Inherit default values from the generic-host template
        check_period            24x7   ; By default, Windows servers are monitored round the clock
        check_interval          0.5   ; Actively check the server every minute
        retry_interval          0.5   ; Schedule host check retries at minute intervals
        max_check_attempts      3   ; Check each server 3 times (max)
        check_command           check-host-alive ; Default command to check if servers are "alive"
        notification_interval   5760  ; Resend notifications every 3 days
        notification_options    d,r   ; Only send notifications for specific host states
        contact_groups          hardware
        register                0 ; DONT REGISTER THIS - ITS JUST A TEMPLATE
        }

define hostextinfo{
        hostgroup_name                  windows-machines
        icon_image                      windows.gif
        icon_image_alt                  Windows
        vrml_image                      windows.gif
        statusmap_image                 windows.gif.gd2
        }


generic host template:

Code: Select all

define host{
        name                            generic-host  ; The name of this host template
        notifications_enabled           1  ; Host notifications are enabled
        event_handler_enabled           1 ; Host event handler is enabled
        flap_detection_enabled          1  ; Flap detection is enabled
        failure_prediction_enabled      1 ; Failure prediction is enabled
        process_perf_data               0   ; Process performance data
        retain_status_information       1    ; Retain status information across program restarts
        retain_nonstatus_information    1  ; Retain non-status information across program restarts
        notification_period             off-workhours   ; Send host notifications at any time
        register                        0    ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
        }

The contact group named Hardware (i dont know what you need this for, but here you go anyway :) ):

Code: Select all

define contactgroup{
        contactgroup_name       hardware
        alias                             Hardware
        members                       ssj
        }
The hostgroup named LH, is just a group to keep everything is that apartment together in the nagios web interface, the LH group has no associated functions, members or anything at all only an Alias.


And the contact named SSJ:

Code: Select all

define contact{
        contact_name                    ssj       ; Short name of user
        use                             generic-contact   ; Inherit default values from generic-contact
        alias                           Steffan xxxxx  ; Full name of user
        pager                           xxxxxxxx   ; phone number
        email                           [email protected]   ; Email
        service_notification_period     off-workhours   ; service notifications can be sent anytime
        host_notification_period        off-workhours
        }
The generic contact template:

Code: Select all

define contact{
        name                            generic-contact       ; The name of this contact template
        service_notification_options    c,r   ; send notifications for all service states, flapping events, and scheduled downtime events
        host_notification_options       d,r    ; send notifications for all host states, flapping events, and scheduled downtime events
        service_notification_commands   notify-service-by-email,notify-service-by-sms   ; send service notifications via email
        host_notification_commands      notify-host-by-email,notify-host-by-sms   ; send host notifications via email
        register                        0   ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE!
        service_notification_period     off-workhours  ; service notifications can be sent anytime
        host_notification_period        off-workhours
        }
I then have some commands (notify-host-by-email + notify-host-by-sms for example) to create emails and sms for notifcation, but i dont think you need theese (if you do, just ask and i will post them).
The "off-workhours" notification_period is just a normal time period that defines between 16:00 and 08.00.



If there is something more you need, feel free to ask! I really want to solve this problem, and i hope you can help with this! :)
I'm open to try stuff in order to get this working so just post what i should do, and i will try it :)
+ the nagios server is running on a virtual machine, which i take a snapshot of before i make any major changes, so if anything goes horribly wrong, i can recover the entire machine within minutes.

Re: New hosts not showing up in web interface

Posted: Wed Nov 28, 2012 7:41 pm
by jsmurphy
Well that completely blew that theory out of the water as soon as you posted your cgi.cfg where all users had full permissions. But I don't know what else could cause exactly this issue... A similar issue can be observed in 3.x versions of Nagios when multiple instances of Nagios start (missing hosts), but I don't think that's the case here. It's also easy to identify by weird messages in the event log about checks going missing.

Normally I would suggest debug logging but I don't think it tracks permissions. I might have to defer to some one else for this one I think...

Re: New hosts not showing up in web interface

Posted: Thu Nov 29, 2012 5:16 am
by Steffan
jsmurphy wrote:Well that completely blew that theory out of the water as soon as you posted your cgi.cfg where all users had full permissions. But I don't know what else could cause exactly this issue... A similar issue can be observed in 3.x versions of Nagios when multiple instances of Nagios start (missing hosts), but I don't think that's the case here. It's also easy to identify by weird messages in the event log about checks going missing.

Normally I would suggest debug logging but I don't think it tracks permissions. I might have to defer to some one else for this one I think...

well, thanks for your help anyway!! i really appreciate it!
I have my own theory, that maybe the problem is that when i restart the nagios service and thereby "reload" the config files, it has to write to some other files that the web interface reads from, and maybe theese files doesn't have the correct linux permissions anymore?
Do you know if any files like this exists?