Solved

Monitor an individual process on linux with Nagios NRPE

Posted on 2009-05-14
8
3,268 Views
Last Modified: 2013-12-16
Hi

I have a Groundwork/Nagios server setup to monitor a few Windows and Linux Machines. All my Linux monitoring I do by using NRPE. All works 100%, but I would like to monitor a single individual process on a few of the Linux Servers.

I found a page where they showed how it can be done by using nrpe, but for the life of me I can't find it now.
Anyone know how to do it?
0
Comment
Question by:Rigged
8 Comments
 
LVL 30

Expert Comment

by:Kerem ERSOY
Comment Utility
hi,

Does the process you want to monitor has a socket connection or you want to check it via ps or some other way? Will you please give some details on the proces and what is your preferred method to monitor it ?
0
 
LVL 1

Author Comment

by:Rigged
Comment Utility
Hi KeremE

Well all my current linux checks (disk, total procs, load....) are done by nrpe and then reported back to the Server.
The specific service I want to monitor is my squid proxy server process by the process name "squid".

From what I understand you can pass any nagios check commad through to nrpe.

Below code is the other commads I have placed in /usr/local/nagios/etc/nrpe.cfg (on the machine that is being monitored)  and below it is the command I run from the Nagios server to do the NRPE check:

[the server passes check_nrpe through to the monitored client.  -c xxxx is the check/command that is run locally on the monitored monitored client, that passes the results back to NRPE for the server]
Extract from nrpe.cfg for the check commands ran on the monitored client:

---------------------

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_disk]=/usr/local/nagios/libexec/check_disk -w 10% -c 5% -p /dev/sda1

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

command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%

_____________________________________________________________________

Below is a few of the commands I run from the Groundwork server to get the results for the above checks:

---------------------

check_nrpe -t 60 -H $HOSTADDRESS$ -c check_disk

check_nrpe -t 60 -H $HOSTADDRESS$ -c check_load

check_nrpe -t 60 -H $HOSTADDRESS$ -c check_total_procs

Open in new window

0
 
LVL 48

Accepted Solution

by:
Tintin earned 125 total points
Comment Utility
Just use the check_procs plugin.
0
 
LVL 30

Assisted Solution

by:Kerem ERSOY
Kerem ERSOY earned 125 total points
Comment Utility
I got it. Since the Squid uses port 800 we can check the port to iss if squid is alive.
- go to /usr/local/nagios/etc/objects
- create a file called proxies.cfg

The contents would be:

define service{
            use                               generic-service
            hostname                     prox1.localdomain
            service_description     Squid proxy service
            check_command          check_nrpe!check_squid
            notfications_nabled      1
}

Save Exit

In fact this sobject should be included in nagios.cfg in one line  cfg_file directives
 
edit client side nrpe to insert
command[check_squid]=/usr/local/nagios/libexec/check_tcp -p 800 -H 10.10.10.10

Save Exit..

This will connect to the port 800
and if it can you'll get a 0 if not you'll get error.

   
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 30

Assisted Solution

by:Kerem ERSOY
Kerem ERSOY earned 125 total points
Comment Utility
command[check_squid]=/usr/local/nagios/libexec/check_tcp -H 10.10.10.10  -p 800 -w 100 -c 200

you might as well use check_system_pp

edit cehck_system_pp script and add these lines:

PROCLIST_RED=\"squid\"
PROCLIST_YELLOW=\"less_critical_process other_stuffd\"
PORTLIST=\"800\"

command[check_squid]=/usr/local/nagios/libexec/check_system_pp -H 10.10.10.10


or snmp_ping, as tintitn suggwested with check_procs ....
you hacve los of alternatives to check something with nagios.

0
 
LVL 1

Author Comment

by:Rigged
Comment Utility
Hey guys thanks for all the help. I came right.

I added the following line for the Groundwork monitoring server Check:

check_nrpe -t 60 -H $HOSTADDRESS$ -c check_squid

and on the monitored client all you have to add is:

command[check_squid]=/usr/local/nagios/libexec/check_procs -C squid

Quite simple actually :)
0
 
LVL 1

Author Closing Comment

by:Rigged
Comment Utility
Thanks dudes
0
 

Expert Comment

by:rohitskapoor
Comment Utility
Hey,

I'm New to Nagios,
I have configured Nagios in my linux machine.
My requirement is to check whether mysql is up and apache is running.
If not Nagios has to trigger a mail to a specified user.

Please help

Thanks
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Online collaboration can help businesses be more efficient, help employees grow their skills and foster a team environment.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now