Page 1 of 1
Monitor a specific service on a Linux host
Posted: Wed Apr 25, 2018 8:29 am
by neworderfac33
Good afternoon,
This might seem like a daft question, but I'm trying to check whether a specific service named (for example) "dave" is running on a number of Linux hosts.
I'm familiar with monitoring both services and processes on Windows hosts with check_nt and with the installation of the Nagios plugins and NRPE on Linux hosts, I'm just having difficulty in Googling whether or not either of these will do the job for me, or if I'm going to have to download something different altogether.
Thanks in anticipation of your usual excellent level of service!
Pete
Re: Monitor a specific service on a Linux host
Posted: Wed Apr 25, 2018 4:05 pm
by cdienger
Check nrpe will be able to do this:
./check_nrpe -H $HOSTADDRESS$ -t 30 -c check_init_service -a '<service_name>'
Re: Monitor a specific service on a Linux host
Posted: Thu Apr 26, 2018 5:30 am
by neworderfac33
Good morning and thanks for your reply.
In my nrpe.cfg, I currently have:
Code: Select all
command[mycommand]=/usr/local/nagios/libexec/check_nrpe -c check_init_service -a 'myservicename'
define service{
use generic-service
#host_name MyHost
hostgroup_name MyHostGroup
service_description Description
check_command check_nrpe!mycommand
}
but this currently reports:
Code: Select all
Incorrect command line arguments supplied
in the UI.
I also tried this:
Code: Select all
command[mycommand]=/usr/local/nagios/libexec/check_nrpe -c check_init_service $ARG1$
define service{
use generic-service
#host_name MyHost
hostgroup_name MyHostGroup
service_description Description
check_command check_nrpe!mycommand!myservicename
}
and that returns the same result.
I have also set
in nrpe.cfg on the remote host and nrpe was compiled using the --enable-command-args argument
What am I missing?
Thanks - Pete
Re: Monitor a specific service on a Linux host
Posted: Thu Apr 26, 2018 8:48 am
by neworderfac33
I can't believe it - I finally realised that the reason why this doesn't work is because I don't have check_init_service installed on my remote host!
How do I get hold of it, please - as it doesn't come with the standard Nagios plugins?
Yours, stupidly
Pete
Re: Monitor a specific service on a Linux host
Posted: Thu Apr 26, 2018 12:43 pm
by cdienger
Re: Monitor a specific service on a Linux host
Posted: Fri Apr 27, 2018 3:30 am
by neworderfac33
Good morning - I installed nrpe using the following steps:
cd /home/downloads
tar xvfz nrpe-2.15.tar.gz
cd nrpe-2.15
yum install openssl-devel
./configure --enable-ssl –enable-command-args
make all
make install-plugin
make install-daemon
make install-daemon-config
yum install xinetd
make install-xinetd
And I'm using Core 4.3.4, not XI. So, when I unpack it, all I seem to get is check_nrpe in my /usr/local/nagios/libexec folder - nothing that looks like check_init_service.
I've since downloaded check_service.sh which is working fine - it's just that I wanted to have the minimum number of nor-"core" plugins installed, but not to worry.
Pete
Re: Monitor a specific service on a Linux host
Posted: Fri Apr 27, 2018 10:46 am
by lmiltchev
I've since downloaded check_service.sh which is working fine - it's just that I wanted to have the minimum number of nor-"core" plugins installed, but not to worry.
I am glad your issue has been resolved!
The check_init_service is actually in the tarball, that cdienger provided you with a link to...
https://assets.nagios.com/downloads/nag ... ent.tar.gz
It's in linux-nrpe-agent\subcomponents\extraplugins\plugins directory.
In addition to this, you could have used the "check_procs" plugin, which is a "native" nagios plugin. With it, you can filter processes by PPID, command, etc.
Example:
Code: Select all
# ./check_procs -C crond
PROCS OK: 8 processes with command name 'crond' | procs=8;;;0;
Let us know if you have any more questions or it is ok to lock this topic. Thank you!
Re: Monitor a specific service on a Linux host
Posted: Fri Apr 27, 2018 11:25 am
by neworderfac33
Thanks for your reply - can I use it to check services though, as well as processes?
Have a nice weekend all and thanks for your help.
Pete
Re: Monitor a specific service on a Linux host
Posted: Fri Apr 27, 2018 12:15 pm
by lmiltchev
I am sure you can. In Linux, it is more difficult to differentiate between a process and a service. All services are processes in a way - there could be one or more processes, that stem from a service . A process is not necessarily a "service", i.e. your web browser or email client. The bottom line - use whatever plugin fits your needs.
Have a nice weekend too!
Re: Monitor a specific service on a Linux host
Posted: Tue May 01, 2018 5:46 am
by neworderfac33
This thread can now be closed, by the way.
Thanks.