Solved

Monitor an individual process on linux with Nagios NRPE

Posted on 2009-05-14
8
3,301 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
ID: 24382426
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
ID: 24382711
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
ID: 24382952
Just use the check_procs plugin.
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 30

Assisted Solution

by:Kerem ERSOY
Kerem ERSOY earned 125 total points
ID: 24382959
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
 
LVL 30

Assisted Solution

by:Kerem ERSOY
Kerem ERSOY earned 125 total points
ID: 24383059
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
ID: 24383201
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
ID: 31581339
Thanks dudes
0
 

Expert Comment

by:rohitskapoor
ID: 24711395
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
wipe a usb using python 5 47
How yum repo uses sqlite3 to keep metadata about the repository? 2 34
Windows Folder Permissions 9 46
linux 13 49
In this guide, I outline 7 key steps to help technology professionals grow their careers. Whether you have been working in technology for 10 years or for 10 days, follow these steps to help you achieve your career goals and pursue your passions.
Email signature management is something that is often overlooked in many organizations or is simply not implemented effectively. Let's take a look at what methods are available for managing this important piece of corporate branding.
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.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to moveā€¦

770 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