[SOLVED] Unable to view remote hosts details in Nagios Browser Page
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
}
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.
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
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
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.
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.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
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.