Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Welcome to LinuxQuestions.org, a friendly and active Linux Community.

You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.

Introduction to Linux - A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

My question is about checking remote services under Nagios. I have installed nrpe and the standard plugins on my Nagios server (RHEL 5.4) and the systems I want to monitor. I have been able to create hostgroups. I am somewhat confused as to how to add a new service. I want to check to see if tomcat is running on the remote servers. I found a plugin check_procs. If I run the following command on one of the remotes it works.

Quote:

check_procs -u tomcat6
PROCS OK: 1 process with UID = 101 (tomcat6)

My question is how to I add this service to the Nagios server. I tried the following.

I don't see where you modified the nrpe.cfg on the target host. Instead it appears you're simply trying to call the command line from the remote host via the check_nrpe on the Nagios master. That isn't how it works.

The link above talks about the master setup but not the nrpe.cfg. On the remote host have a look at <installdir>/etc/nrpe.cfg (usually /usr/local/nagios/etc/nrpe.cfg).

Essentially you need a line in that file that the check_nrpe on the master will read.

Glad it worked. If you have a lot of servers you want to monitor, you can prepare the nrpe.cfg file to include all the commands you want to use as described by MensaWater, copy that file over to your servers to the right location and restart your nrpe daemon if not configured with xinetd. That way all your nodes will be prepared to run the commands you have included and all you have to do is create the services and assign it to the hosts you define in Nagios.

You can run commands from Nagios master to clients without NRPE (e.g. SNMP checks, web checks etc...). However, NRPE, itself is designed to run on the client and therefore has its own configuration file. The check_nrpe command on master is designed to work on the master and interact with NRPE on the clients. Note that NRPE/check_nrpe are a plugin and not part of Nagios itself though they are clearly designed to interact with it. Personally I like being able to customize each server. However what you could do is simply create a master nrpe.cfg and roll it out to all your clients. The check_tomcat command in such a master nrpe.cfg would only be invoked when you checked it from the master for that client and not those that you don't check it for.

Of course you can write any script you want using the Nagios framework and run it from the master to the client using ssh and not even use NRPE. The main thing in such a script is to set the standard Nagios exit status values.

You'd then have to set your tests so that they gave the expected return codes. (That is to say if the normal exit code of the command you're calling is 1 you'd want to catch that and interpret as 2 to make it critical.)

The downside of such an approach is you'd have to make Nagios master a trusted host to ssh to the remote client as opposed to using the framkework (and even SSL) understood by Nagios and NRPE that doesn't require an actual login from the master to the client.

I have done such scripts for things that run on the master to compare things (e.g. I have scripts to determine which node of a cluster gives me an "OK" response for given cluster services so I can have Nagios note which is the active node.) Also I've written scripts to check web URLs from the master. Also of course you can write scripts that are designed to run on the client itself and put that script in nrpe.cfg to be checked by check_nrpe from the master. I have such a script for checking memory on Linux because the standard check_memory plugin doesn't deal with the special way Linux handles buffers and caching differently than most UNIX flavors do it.

P.S. By the way I called it "check_tomcat". You could call it "billybob" or anything else you want. The important thing being that the name you use in [] in nrpe.cfg is the same name you call from check_nrpe on master.

I thank both of you. One hindrance I've had, is I thought NRPE was part of the Nagios core. All the quick install pages I found talk about installing it along with Nagios. I guess its' just really popular. I will take the advice you both gave and create a master nrpe.cfg file and push it out to all the clients. Since I have nrpe running under xinetd I don't have to worry about restarting the service. Simply pushing a file out to all my clients is easy or will be since my next project is a puppet server. For puppet though we have a guy here who took the classes.