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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
It doesn't work. I'm not sure how to format the service. I've found gobs of documentation on how to setup and install Nagios, done. I've not been so lucky on how to setup a new service.
Any help will be appreciated. Any link to a good set of documentation on this will be really appreciated.
This should be easy to follow: http://wiki.centos.org/HowTos/Nagios...ddff62a0314b8d
Also check that you've set up access to your remote machines with NRPE correctly and that you've set the permissions to execute the scripts.
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.
Am I correct to believe this means I have to edit every nagios client for every service I want to add? I can't just make the changes on the nagios server? Ouch, yuk
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.
Last edited by MensaWater; 05-16-2011 at 12:30 PM.
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.
First, EricTRA, I like the documentation at the link you provided.
Second, MensaWater, yuk, but it worked. I edited the nrpe.cfg file on one of the hosts and put the following in
I then added the following to the services.cfg file on the nagios server
Am I correct to believe this means I have to edit every nagios client for every service I want to add? I can't just make the changes on the nagios server? Ouch, yuk
But it worked, Thanks
How to check Tomcat 7 using nagios .User runs tomcat as a root.
Krushna - Please do not append to old threads. Create a new one. A new thread will get wider exposure than old threads which may only be viewed by those who subscribed at the time.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.