Page 1 of 1

nagios does not discover hosts properly, Error: Host Status

Posted: Tue Jun 12, 2012 3:13 am
by parthipan
when i configure nagios box to use linux box, i defined new host groups,new hosts and new services

but when i try to discover those details in my browser window
http://localhost/nagios/
there is only displaying localhost and new hostgroups only
there is no discover my new host and new services under the new host groups

but when i am clicking 7 or 8 times on services on nagios window , it is discovering all the hosts and services
but when i press on new host my result is
Host
remotehost
(remotehost)

Member of
MyhostGroup

172.30.0.70


Error: Host Status Information Not Found!

172.30.0.70 is connected in my network

i couldn't fine out the problem
please help me

my defined host code for myhost

Code: Select all

# Define a host for the local machine

define host{
        use                     linux-server           ; Name of host template to use
							; This host definition will inherit all variables that are defined
							; in (or inherited by) the linux-server host template definition.
        host_name               remotehost
        alias                   remotehost
        address                 172.30.0.70
	hostgroups		MyhostGroup
        }


 

###############################################################################
###############################################################################
#
# HOST GROUP DEFINITION
#
###############################################################################
###############################################################################

# Define an optional hostgroup for Linux machines

define hostgroup{
        hostgroup_name  MyhostGroup ; The name of the hostgroup
        alias           MyhostGroup ; Long name of the group
        members         remotehost     ; Comma separated list of hosts that belong to this group
        }



###############################################################################
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
###############################################################################


# Define a service to "ping" the local machine

define service{
        use                             local-service         ; Name of service template to use
        host_name                       remotehost
        service_description             PING
	check_command			check_ping!100.0,20%!500.0,60%
        }


# Define a service to check the disk space of the root partition
# on the local machine.  Warning if < 20% free, critical if
# < 10% free space on partition.

define service{
        use                             local-service         ; Name of service template to use
        host_name                       remotehost
        service_description             Root Partition
	check_command			check_local_disk!20%!10%!/
        }



# Define a service to check the number of currently logged in
# users on the local machine.  Warning if > 20 users, critical
# if > 50 users.

define service{
        use                             local-service         ; Name of service template to use
        host_name                       remotehost
        service_description             Current Users
	check_command			check_local_users!20!50
        }


# Define a service to check the number of currently running procs
# on the local machine.  Warning if > 250 processes, critical if
# > 400 users.

define service{
        use                             local-service         ; Name of service template to use
        host_name                       remotehost
        service_description             Total Processes
	check_command			check_local_procs!250!400!RSZDT
        }



# Define a service to check the load on the local machine. 

define service{
        use                             local-service         ; Name of service template to use
        host_name                       remotehost
        service_description             Current Load
	check_command			check_local_load!5.0,4.0,3.0!10.0,6.0,4.0
        }



# Define a service to check the swap usage the local machine. 
# Critical if less than 10% of swap is free, warning if less than 20% is free
i have included remote host in nagios.cfg
Code:
# Definitions for monitoring the local (Linux) host
cfg_file=/usr/local/nagios/etc/objects/localhost.cfg

cfg_file=/usr/local/nagios/etc/objects/myhost.cfg
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg i used it to verify
results is
Total Warnings: 0
Total Errors: 0

Re: nagios does not discover hosts properly, Error: Host Sta

Posted: Wed Jun 13, 2012 10:43 am
by agriffin
Do you have multiple nagios instances running? What's the output of the following command?

Code: Select all

# ps aux | grep nagios

Re: nagios does not discover hosts properly, Error: Host Sta

Posted: Thu Jun 14, 2012 12:34 am
by parthipan
Thank you for your reply mr. agriffin

this is my out put, i dont know that there is multiple nagios instances running
please make sure
and help me to solve this problem

nagios 1245 0.0 0.0 12924 1084 ? Ssl May17 7:43 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 8859 0.0 0.0 12796 1036 ? Ssl Jun13 0:10 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 12632 0.0 0.0 12928 700 ? S 11:00 0:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 12633 0.0 0.0 4036 804 ? S 11:00 0:00 /usr/local/nagios/libexec/check_ping -H 127.0.0.1 -w 3000.0,80% -c 5000.0,100% -p 5
nagios 12634 0.0 0.0 1840 544 ? S 11:00 0:00 /bin/ping -n -U -w 30 -c 5 127.0.0.1
root 12636 0.0 0.0 3920 660 pts/4 R+ 11:00 0:00 grep nagios
root 13557 0.0 0.0 4888 1292 pts/1 S+ Jun01 0:00 vi /usr/local/nagios/etc/commands.cfg
root 21694 0.0 1.3 101484 27456 ? S May22 1:18 gedit file:///usr/local/nagios/etc/objects/myhost.cfg
root 28603 0.0 4.9 213220 101952 ? Sl May14 7:13 evince file:///root/Desktop/osdc2005nagios.pdf

Re: nagios does not discover hosts properly, Error: Host Sta

Posted: Thu Jun 14, 2012 10:02 am
by lmiltchev
Try running in terminal:

Code: Select all

service nagios stop
killall -9 nagios
service nagios start
Let me know if this helped.

Re: nagios does not discover hosts properly, Error: Host Sta

Posted: Thu Jun 14, 2012 10:31 pm
by parthipan
Thank you so much mr. lmiltchev
Now it is properly working

I understood that there was multiple instance of nagios.cfg were running
thank you

and let me know what is the meaning of killall -9 nagios
why we are using -9 means process id?

Re: nagios does not discover hosts properly, Error: Host Sta

Posted: Fri Jun 15, 2012 5:19 am
by helzerr
One of the great features of Linux (and UNIX) is the excellent built-in documentation. There are two commands used to access the documentation, `man` (short for manual) and the newer `info` - so`info killall` and `man killall` will both provide documentation for the `killall` command.

The "-9" option specifies the signal to kill with, 9 meaning "KILL" which basically means "force quit" - from `info kill` we find:

The following signal names and numbers are supported on all POSIX compliant systems:

`HUP'
1. Hangup.

`INT'
2. Terminal interrupt.

`QUIT'
3. Terminal quit.

`ABRT'
6. Process abort.

`KILL'
9. Kill (cannot be caught or ignored).

`ALRM'
14. Alarm Clock.

`TERM'
15. Termination.