Monitor a specific service on a Linux host
-
- Posts: 329
- Joined: Fri Jul 24, 2015 11:04 am
Monitor a specific service on a Linux host
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
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
Check nrpe will be able to do this:
./check_nrpe -H $HOSTADDRESS$ -t 30 -c check_init_service -a '<service_name>'
./check_nrpe -H $HOSTADDRESS$ -t 30 -c check_init_service -a '<service_name>'
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
- Posts: 329
- Joined: Fri Jul 24, 2015 11:04 am
Re: Monitor a specific service on a Linux host
Good morning and thanks for your reply.
In my nrpe.cfg, I currently have:
but this currently reports:
in the UI.
I also tried this:
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
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
}
Code: Select all
Incorrect command line arguments supplied
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
}
I have also set
Code: Select all
dont_blame_nrpe=1
What am I missing?
Thanks - Pete
-
- Posts: 329
- Joined: Fri Jul 24, 2015 11:04 am
Re: Monitor a specific service on a Linux host
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
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
How did you install the agent? The service check should be a part of the linux-npre-agent:
https://assets.nagios.com/downloads/nag ... ent.tar.gz
https://assets.nagios.com/downloads/nag ... _Agent.pdf
https://assets.nagios.com/downloads/nag ... ent.tar.gz
https://assets.nagios.com/downloads/nag ... _Agent.pdf
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
- Posts: 329
- Joined: Fri Jul 24, 2015 11:04 am
Re: Monitor a specific service on a Linux host
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
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
I am glad your issue has been resolved!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.
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;
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
- Posts: 329
- Joined: Fri Jul 24, 2015 11:04 am
Re: Monitor a specific service on a Linux host
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
Have a nice weekend all and thanks for your help.
Pete
Re: Monitor a specific service on a Linux host
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!
Have a nice weekend too!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
- Posts: 329
- Joined: Fri Jul 24, 2015 11:04 am
Re: Monitor a specific service on a Linux host
This thread can now be closed, by the way.
Thanks.
Thanks.