Solved

Monitor an individual process on linux with Nagios NRPE

Posted on 2009-05-14
8
3,286 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
 
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Our Group Policy work started with Small Business Server in 2000. Microsoft gave us an excellent OU and GPO model in subsequent SBS editions that utilized WMI filters, OU linking, and VBS scripts. These are some of experiences plus our spending a lo…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

867 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

19 Experts available now in Live!

Get 1:1 Help Now