LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Unable to view remote hosts details in Nagios Browser Page (http://www.linuxquestions.org/questions/linux-software-2/unable-to-view-remote-hosts-details-in-nagios-browser-page-830355/)

vikas027 09-04-2010 02:49 PM

Unable to view remote hosts details in Nagios Browser Page
 
1 Attachment(s)
Dear All,

I am new to Nagios and I have configured Nagios Server and Client on my RHEL 5.4 machines using these links and help html files in tar balls.

http://www.thegeekstuff.com/2008/05/...configuration/
http://www.thegeekstuff.com/2008/06/...ing-nagios-30/


I have this scenario.

Nagios Server - 192.168.1.200
Nagios Client - 192.168.1.201
(This is the remote-host I am trying to monitor)


I firmly believe I have at least configured it right as this command on Nagios Server does not show any errors.

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg


Code:

[root@ser ~]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 3.2.2
Copyright (c) 2009-2010 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 09-01-2010
License: GPL

Website: http://www.nagios.org
Reading configuration data...
  Read main config file okay...
Processing object config file '/usr/local/nagios/etc/objects/commands.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/contacts.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/timeperiods.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/templates.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/localhost.cfg'...
  Read object config files okay...

Running pre-flight check on configuration data...

Checking services...
        Checked 8 services.
Checking hosts...
        Checked 1 hosts.
Checking host groups...
        Checked 1 host groups.
Checking service groups...
        Checked 0 service groups.
Checking contacts...
        Checked 1 contacts.
Checking contact groups...
        Checked 1 contact groups.
Checking service escalations...
        Checked 0 service escalations.
Checking service dependencies...
        Checked 0 service dependencies.
Checking host escalations...
        Checked 0 host escalations.
Checking host dependencies...
        Checked 0 host dependencies.
Checking commands...
        Checked 24 commands.
Checking time periods...
        Checked 5 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:  0

Things look okay - No serious problems were detected during the pre-flight check
[root@ser ~]#


Also, my addone nrpe daemon is working correctly as I am able to run the below command succesfully.

Code:

[root@ser ~]# /usr/local/nagios/libexec/check_nrpe -H 192.168.1.201
NRPE v2.12

Also, the below commands on remote-host (192.168.1.201) are running properly.

Code:

[root@ser ~]# /usr/local/nagios/libexec/check_nrpe -H localhost -c check_users
USERS OK - 1 users currently logged in |users=1;5;10;0
[root@ser ~]#
[root@ser ~]# /usr/local/nagios/libexec/check_nrpe -H localhost -c check_load
OK - load average: 0.00, 0.00, 0.00|load1=0.000;15.000;30.000;0; load5=0.000;10.000;25.000;0; load15=0.000;5.000;20.000;0;
[root@ser ~]#
[root@ser ~]# /usr/local/nagios/libexec/check_nrpe -H localhost -c check_sda
DISK OK - free space: / 5290 MB (62% inode=94%);| /=3169MB;7136;8028;0;8920
[root@ser ~]#
[root@ser ~]# /usr/local/nagios/libexec/check_nrpe -H localhost -c check_total_procs
PROCS OK: 79 processes
[root@ser ~]#
[root@ser ~]# /usr/local/nagios/libexec/check_nrpe -H localhost -c check_zombie_procs
PROCS OK: 0 processes with STATE = Z
[root@ser ~]#

Now, my problem starts here. Though, as per manuals I have correct entries in my remotehost.cfg, still I am unable to view it in my browser at http://192.168.1.200/nagios/. Please see attached snapshot.

Code:

[root@ser ~]# cat /usr/local/nagios/etc/objects/remotehost.cfg
define host{
use linux-server
host_name ser.box3.com
alias Remote Host
address 192.168.1.201
contact_groups admins
}


define service{
use generic-service
service_description Root Partition
contact_groups admins
check_command check_nrpe!check_disk
}


kforbus 09-05-2010 07:44 PM

I always love to see people starting to use Nagios. With all the available plugins and addons, there isn't much you can't do with it. I should probably try using NRPE sometime as I've always done most of my checks using the Check By SSH plugin.

Anyway, on to your problem. I always like to try the simple things first, so with that in mind, have you added a cfg_file=/etc/nagios/objects/remotehost.cfg entry to /etc/nagios/nagios.cfg? Or if you're going to be dumping most of your config files into the /etc/nagios/objects directory you could just add a line like cfg_dir=/etc/nagios/objects to nagios.cfg. Without one of these entries, Nagios won't know it's supposed to process your remotehost.cfg file and will just ignore it.

Just something to check. If you already have that in place, we can try something else.

EDIT: The directories I mentioned above will probably be /usr/local/nagios/etc for you instead of just /etc, so hopefully that won't create too much confusion.

vikas027 09-06-2010 12:35 PM

1 Attachment(s)
Quote:

Originally Posted by kforbus (Post 4089009)
I've always done most of my checks using the Check By SSH plugin.

Is it easy to use ? I will also try this.

Quote:

Originally Posted by kforbus (Post 4089009)
Anyway, on to your problem. I always like to try the simple things first, so with that in mind, have you added a cfg_file=/etc/nagios/objects/remotehost.cfg entry to /etc/nagios/nagios.cfg?

Many thanks to you kforbus.
This was the problem. I have added this line
cfg_file=/usr/local/nagios/etc/objects/remotehost.cfg
to
/usr/local/nagios/etc/nagios.cfg

I am now can see my remote host (192.168.1.201 ser.box3.com). Please see attached pic. :)

But, the problem is that I cannot see other details or checks I have done for this remotehost except the critical alerts like server is UP or DOWN.

Actually, I have tested it by creating the below service /usr/local/nagios/etc/objects/remotehost.cfg on Nagios Server (192.168.1.200)

Code:

define service{
use generic-service
contact_groups admins
service_description /dev/sda1 Free Space
check_command check_nrpe!check_sda1
}

And, the corresponding check in /usr/local/nagios/etc/nrpe.cfg in RemoteHost 192.168.1.201
Code:

command[check_sda1]=/usr/local/nagios/libexec/check_disk -w 97% -c 98% -p /dev/sda1
As per manuals, it should send a warning alert when my disk is 3% utilized and a critical alert when my disk is 2% utilized, but even though my /dev/sda1 is 38% utilized, I am not getting any alerts. :(
Code:

[root@ser ~]# hostname
ser.box3.com
[root@ser ~]# df -kh /dev/sda1
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1            8.8G  3.2G  5.2G  38% /

Also, after making the above changes, I have restarted Nagios Service in Nagios Server and xinetd Service on RemoteHost.

Any ideas brother ?

vikas027 09-07-2010 01:59 PM

Mission Accomplished
 
Hi Kforbus,

I am glad to tell you that finally I have made it working, though it took me few hours. :)

Well, the problem was with my commands.cfg. I just reconfigured it and tried running
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

This was giving me the below errors :-
Code:

Error: Service check command 'check_nrpe' specified in service '/dev/sda1 Free Space' for host 'ser.box3.com' not defined anywhere!
Error: Service check command 'check_nrpe' specified in service 'Checking HTTP' for host 'ser.box3.com' not defined anywhere!
        Checked 10 services.

I further digged into it and found that I had a misplaced path of commands.cfg, this was not included in the How-To which I was referring.

It was /usr/local/nagios/etc/commands.cfg
instead of
/usr/local/nagios/etc/objects/commands.cfg


I am happy man now.:D Many thanks for your time and help.

Now, I will further dig more options of it, Will trouble you again if I will get stuck somewhere :)

vikas027 09-07-2010 02:09 PM

And now I also understood what check_by_ssh plugin you were talking about. :)

It works somewhat like this.

Code:

[root@ser ~]# /usr/local/nagios/libexec/check_procs  -w 2:6 -c 2:1024 -C mingetty
PROCS OK: 6 processes with command name 'mingetty'
[root@ser ~]#
[root@ser ~]#
[root@ser ~]#  /usr/local/nagios/libexec/check_by_ssh -p 22 -l root -H localhost -C '/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /'
root@localhost's password:
DISK OK - free space: / 5265 MB (62% inode=94%);| /=3194MB;7136;8028;0;8920


kforbus 09-07-2010 06:22 PM

Hey, I'm glad you got your problem figured out. And yes, it was the check_by_ssh plugin I was referring to in my earlier comment. I like it because it is pretty easy to setup on the remote machines -- just add a nagios user, create public/private keys, and add whatever plugins you want to run. In retrospect, setting up NRPE is probably just as easy if not easier, but everybody has their own way of doing things. Well, good luck to you and I hope you enjoy Nagios.

vikas027 09-08-2010 12:44 PM

I also find check_by_ssh pretty easy :)


All times are GMT -5. The time now is 02:52 AM.