Page 1 of 2
Issue with Nagios Monitoring
Posted: Fri Jun 10, 2016 11:18 pm
by jim
Hi All,
I need some help with Nagios monitoring.
I installed on server and agents but when I go to main screen I see only two services being monitored and what is says is that two services in "Critical"
I have attached screenshots for the same but what is says is the below two services monitored on agents ?? I thought they should be eight ?
Current Users
CPU Load
The following services are critical with command not found error:
SH Monitoring -- NRPE: Command 'check_ssh' not defined
FTP Monitoring-- NRPE: Command 'check_ftp' not defined
Any help would be greatly appreciated.
Thanks in advance.
Re: Issue with Nagios Monitoring
Posted: Sat Jun 11, 2016 2:23 am
by jim
Code: Select all
[root@agent2 libexec]# ./check_ssh puppet
SSH OK - OpenSSH_7.2p2 Ubuntu-4ubuntu1 (protocol 2.0) | time=0.025016s;;;0.000000;10.000000
[root@agent2 libexec]# ./check_ssh Xubuntu
SSH OK - OpenSSH_7.2p2 Ubuntu-4ubuntu1 (protocol 2.0) | time=0.025308s;;;0.000000;10.000000
[root@agent2 libexec]# pwd
/usr/local/nagios/libexec
[root@agent2 libexec]#
If I can do ssh from Nagios server to agents why does the UI say NRPE: Command 'check_ssh' not defined ??
Re: Issue with Nagios Monitoring
Posted: Sun Jun 12, 2016 3:35 am
by nozlaf
in your nagios configuration you have not defined the check_ssh command and check_ftp command
maybe a little confusing but having the binaries in the libexec folder doesn't actually "install" the plugin , you need to define the command somewhere like this
Code: Select all
define command {
command_name check_ftp
command_line $USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_ssh
command_line $USER1$/check_ssh $ARG1$ $HOSTADDRESS$
}
so i have a check_commands.cfg file that holds all of my commnands
Re: Issue with Nagios Monitoring
Posted: Sun Jun 12, 2016 9:18 am
by jim
Hello,
Please forgive me if I ask silly questions. I am new to Nagios but loving it and finding it super confusing too.
The command which you have gives should be defined where? (
Nagios Server or Remote Host/Agent?) and also in which configuration file?(
commands.cfg ? I believe main configuration file is nagios.cfg on Nagios server
and the configuration files should have refereces in nagios.cf ?
My current set up on
Nagios server is as follows so I am not sure why it is still complaining?
Code: Select all
[root@agent2 etc]# cat nagios.cfg |grep -i command
cfg_file=/usr/local/nagios/etc/objects/commands.cfg
[root@agent2 etc]# cat objects/commands.cfg |grep ssh
# 'check_ssh' command definition
command_name check_ssh
command_line $USER1$/check_ssh $ARG1$ $HOSTADDRESS$
[root@agent2 etc]# cat objects/commands.cfg |grep ftp
# 'check_ftp' command definition
command_name check_ftp
command_line $USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$
[root@agent2 etc]#
I could figure it out why I see only four services in Nagios for two remote servers. The reason is beacsue of 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]#
[root@agent2 etc]# pwd
/usr/local/nagios/etc
[root@agent2 etc]# ls services.cfg
services.cfg
[root@agent2 etc]#
In the case above ssh and ftp are defined so why it is saying
SSH Monitoring -- NRPE: Command 'check_ssh' not defined
FTP Monitoring-- NRPE: Command 'check_ftp' not defined
Also what is the role of nrpe.cfg configuration file on remote host ??
Code: Select all
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200
# The following examples allow user-supplied arguments and can
# only be used if the NRPE daemon was compiled with support for
# command arguments *AND* the dont_blame_nrpe directive in this
# config file is set to '1'. This poses a potential security risk, so
# make sure you read the SECURITY file before doing this.
#command[check_users]=/usr/local/nagios/libexec/check_users -w $ARG1$ -c $ARG2$
#command[check_load]=/usr/local/nagios/libexec/check_load -w $ARG1$ -c $ARG2$
#command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
#command[check_procs]=/usr/local/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
root@jim-Ubuntu1504:/usr/local/nagios/etc# pwd
/usr/local/nagios/etc
root@jim-Ubuntu1504:/usr/local/nagios/etc# cat nrpe.cfg
Re: Issue with Nagios Monitoring
Posted: Mon Jun 13, 2016 10:58 am
by rkennedy
Since you're using NRPE, and checking through an agent what @nozlaf mentioned does not apply. What you need to do is define commands in NRPE, so that when check_nrpe executes from Nagios, it then knows how to pass check_ftp or check_ssh to the client machine. Your example here isn't using NRPE, but rather local files. So you would need to decide what you're ultimately trying to do.
Code: Select all
[root@agent2 libexec]# ./check_ssh puppet
SSH OK - OpenSSH_7.2p2 Ubuntu-4ubuntu1 (protocol 2.0) | time=0.025016s;;;0.000000;10.000000
[root@agent2 libexec]# ./check_ssh Xubuntu
SSH OK - OpenSSH_7.2p2 Ubuntu-4ubuntu1 (protocol 2.0) | time=0.025308s;;;0.000000;10.000000
Changing these around would mean to change your check_command to check_ssh, which @nozlaf was checking.
Code: Select all
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
}
The nrpe.cfg is where you would add any plugins that you want to monitor, and also define commands that can be used on that client machine. What you've pasted, for example, are 5 different commands that can be executed using NRPE.
Code: Select all
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200
At this point, if your check_ssh and check_ftp can be executed using nagios, then change your check_command to check_ssh and not check_nrpe!check_ssh. If you need to execute these plugins using NRPE, create a definition and then restart NRPE (possibly xinetd depending how you installed) for check_ssh.
Re: Issue with Nagios Monitoring
Posted: Tue Jun 14, 2016 4:55 pm
by jim
Thank you very much now my monitoring works but my fundamentals are not yet clear.
I have not done any customisation for out of box nagios.
Here is my services.cfg which is referenced in nagios.cfg
Code: Select all
[root@agent2 nagios]# cat etc/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_ssh
}
define service{
use generic-service
host_name jim-Ubuntu1504
service_description FTP Monitoring
check_command 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_ssh
}
define service{
use generic-service
host_name jim-VirtualBox
service_description FTP Monitoring
check_command check_ftp
}
[root@agent2 nagios]#
What I wonder is for ssh and ftp why I have to remove "check_nrpe" whereas for others I have to keep it? Is this standard configuration? If it is standard configuration why the source doesn't come with standard configuration?
Please guide me here. Thanks again !
Jim
Re: Issue with Nagios Monitoring
Posted: Tue Jun 14, 2016 5:01 pm
by rkennedy
jim wrote:Thank you very much now my monitoring works but my fundamentals are not yet clear.
I have not done any customisation for out of box nagios.
Here is my services.cfg which is referenced in nagios.cfg
Code: Select all
[root@agent2 nagios]# cat etc/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_ssh
}
define service{
use generic-service
host_name jim-Ubuntu1504
service_description FTP Monitoring
check_command 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_ssh
}
define service{
use generic-service
host_name jim-VirtualBox
service_description FTP Monitoring
check_command check_ftp
}
[root@agent2 nagios]#
What I wonder is for ssh and ftp why I have to remove "check_nrpe" whereas for others I have to keep it? Is this standard configuration? If it is standard configuration why the source doesn't come with standard configuration?
Please guide me here. Thanks again !
Jim
Some checks require an 'agent' which is used to check internal metrics. The checks you were previously using, didn't need NRPE, they were able to check externally. However, when it comes to the load of a machine, you usually needed to use this in conjunction with NRPE because it's an internal metric.
Nagios can see if port 80, 22 are open for example by probing the external ports.
However, it can't tell you how much ram is currently in use -- this is an internal check.
Does that help to explain it?
Re: Issue with Nagios Monitoring
Posted: Wed Jun 15, 2016 12:53 am
by jim
Yes Sir, perfectly. Thank you very much.
Any good book to recommend to understand the basics of Nagios? I mean where it is documented that x y z are internal checks and p q r are external checks by Nagios, I hope you get what I am trying to say.
Regards,
Jim
Re: Issue with Nagios Monitoring
Posted: Wed Jun 15, 2016 9:49 am
by rkennedy
There really isn't. Generally, if a plugin has an input that asks for a hostname / IP, then it can be ran from the Nagios machine. If the plugin doesn't require input to connect / contact a server, then it's usually internal and needs to be ran through an agent.
This isn't always the case, but may help in figuring out the difference.
Re: Issue with Nagios Monitoring
Posted: Thu Jun 16, 2016 7:29 am
by jim
Thank you very much. You can close this thread as its resolved.