Page 1 of 1

Unable to see second host in Nagios server

Posted: Fri Jun 10, 2016 4:04 am
by jim
Hi Al,

Followed same set of instructions on another host (Xubuntu 16.04) but it seems that is not visible in Nagios Server.

Here is a quick snapshot of nagios server hosts.cfg and services.cfg file.

Code: Select all

   [root@agent2 etc]# cat hosts.cfg
    ## Default Linux Host Template ##
    define host{
    name                            linux-box               ; Name of this template
    use                             generic-host            ; Inherit default values
    check_period                    24x7        
    check_interval                  5       
    retry_interval                  1       
    max_check_attempts              10      
    check_command                   check-host-alive
    notification_period             24x7    
    notification_interval           30      
    notification_options            d,r     
    contact_groups                  admins  
    register                        0                       ; DONT REGISTER THIS - ITS A TEMPLATE
    }
    
    ## Default
    define host{
    use                             linux-box               ; Inherit default values from a template
    host_name                       jim-Ubuntu1504                  ; The name we're giving to this server
    alias                           Ubuntu 16.04               ; A longer name for the server
    address                         192.168.1.2          ; IP address of Remote Linux host
    }
    
    ## Default
    define host{
    use                             linux-box               ; Inherit default values from a template
    host_name                       jim-VirtualBox          ; The name we're giving to this server
    alias                           Xubuntu 16.04               ; A longer name for the server
    address                         192.168.1.11          ; IP address of Remote Linux host
    [root@agent2 etc]# 
services.cfg

Code: Select all

    [root@agent2 etc]# cat services.cfg 
    define service{
            use                     generic-service
            host_name               jim-Ubuntu1504
            service_description     CPU Load
            check_command           check_nrpe!check_load
            }
    define service{
            use                     generic-service
            host_name               jim-Ubuntu1504
            service_description     Total Processes
            check_command           check_nrpe!check_total_procs
            }
    define service{
            use                     generic-service
            host_name               jim-Ubuntu1504
            service_description     Current Users
            check_command           check_nrpe!check_users
            }
    define service{
            use                     generic-service
            host_name               jim-Ubuntu1504
            service_description     SSH Monitoring
            check_command           check_nrpe!check_ssh
            }
    define service{
            use                     generic-service
            host_name               jim-Ubuntu1504
            service_description     FTP Monitoring
            check_command           check_nrpe!check_ftp
            }
    
    define service{
            use                     generic-service
            host_name                jim-VirtualBox
            service_description     CPU Load
            check_command           check_nrpe!check_load
            }
    define service{
            use                     generic-service
            host_name                jim-VirtualBox
            service_description     Total Processes
            check_command           check_nrpe!check_total_procs
            }
    define service{
            use                     generic-service
            host_name                jim-VirtualBox
            service_description     Current Users
            check_command           check_nrpe!check_users
            }
    define service{
            use                     generic-service
            host_name                jim-VirtualBox
            service_description     SSH Monitoring
            check_command           check_nrpe!check_ssh
            }
    define service{
            use                     generic-service
            host_name                jim-VirtualBox
            service_description     FTP Monitoring
            check_command           check_nrpe!check_ftp
            }
    [root@agent2 etc]# 
Not sure what is happening because of which Xubuntu(jim-Virtualbox) is not be able to be seen in Nagios server.

Any help would be very much appreciated.

P.S: NRPE is running on agent.

Code: Select all

    root@jim-VirtualBox:/tmp/nagios-plugins-2.1.1/nrpe-2.15# netstat -nap|grep nrpe
    tcp        0      0 0.0.0.0:5666            0.0.0.0:*               LISTEN      11019/nrpe      
    tcp6       0      0 :::5666                 :::*                    LISTEN      11019/nrpe      
    unix  2      [ ]         DGRAM                    46618    11019/nrpe          
    root@jim-VirtualBox:/tmp/nagios-plugins-2.1.1/nrpe-2.15# 
    root@jim-VirtualBox:/tmp/nagios-plugins-2.1.1/nrpe-2.15#

Re: Unable to see second host in Nagios server

Posted: Fri Jun 10, 2016 5:06 am
by jim
Well, it seems nagios server is not collection information from agent as there is no information about second agent in status.dat. What could be the reason for that ?

Re: Unable to see second host in Nagios server

Posted: Fri Jun 10, 2016 9:32 am
by jim
Moderator, Please close this thread. Problem identified and resolved. Closing brace in hosts.cfg was missing which caused it not to detect. There is another issue but I would investigate that separately.

Re: Unable to see second host in Nagios server

Posted: Fri Jun 10, 2016 9:33 am
by mcapra
Thanks for sharing your solution! Closing this.