Request help monitoring custom commands on remote server

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
sergani
Posts: 3
Joined: Mon Sep 05, 2011 12:05 pm

Request help monitoring custom commands on remote server

Post by sergani »

Hello all,

Ok, so I'm new to Nagios, and I like the whole idea.

What I'm looking forward to, is having the ability to use Nagios to monitor the output of certain commands on different Linux machines.
My commands are application-specific, so they're not the regular disk space, temperature etc... kind of checkups.

Basically I have a few VoIP switches that I need to do a how-many-voice-channels-are-used-by-this-customer kind of checkup, and I have my local commands that do the job.

I've installed Nagios on a local CentOS server, can access the web interface, no problem. I've also read about NRPE, but did not install it yet on any of the remote servers, since I found out that NRPE will be running the original Nagios scripts over there, and this is not what I need to do. I need to run other commands over there and see the output(s) on Nagios live.

Can anyone help with this in anyway? If further info is required, I'd be offering them ASAP of course.

Thanks all...

//M
crfriend
Posts: 61
Joined: Thu Sep 01, 2011 7:53 am
Location: Central New England (USA)
Contact:

Re: Request help monitoring custom commands on remote server

Post by crfriend »

If the commands you run to gather those statistics are run on the VOIP gear then there are ways to get Nagios to do this for you.

One is to use SSH with a particular account and put the Nagios user's key in the VOIP server's "authorized_keys" file so passwordless access is possible. This will allow one to do things like "ssh user@remote-sys {mumble command} | local-interpretation-command" to cause the remote-system to run the command, return all the output to the local system, and pipe that output into the "local-interpretation-command" script which adheres to the Nagios plugin API. This works for some of the stuff I do, but can pose security risks if not done very carefully.

NRPE is another possibility, and one that may be a bit tighter from a security perspective because access-control is easier. It should be noted that the NRPE executable on the "remote system" (the one being monitored) will need to be provisioned with a proper Nagios-API-aware program which will get called from the NRPE daemon when the "check_nrpe" call gets made on the monitoring system. Using the above notional representation, the NRPE configuration on the VOIP server might call "{mumble command} | interpretation-command" and that would pass a proper Nagios API return value back to the monitoring system.

There may be other, possibly fancier, ways of doing it, but I've always found that the simplest mechanism is usually the one that breaks least frequently or in "interesting" ways.
sergani
Posts: 3
Joined: Mon Sep 05, 2011 12:05 pm

Re: Request help monitoring custom commands on remote server

Post by sergani »

Hello crfriend,

Thanks for the insight!

I believe it would be best in my case to follow method 2; using NRPE.
Since I have a lot of stuff to monitor, so multiple ssh logins are not that practical.

Can you help point me to a good tutorial on how to do this?
I have no perl experience, just bash.

Thanks again.

//M
crfriend
Posts: 61
Joined: Thu Sep 01, 2011 7:53 am
Location: Central New England (USA)
Contact:

Re: Request help monitoring custom commands on remote server

Post by crfriend »

sergani wrote:I believe it would be best in my case to follow method 2; using NRPE.
[...]
Can you help point me to a good tutorial on how to do this?
I have no perl experience, just bash.
The formal NRPE doco resides at http://nagios.sourceforge.net/docs/nrpe/NRPE.pdf and is precisely what I used to deploy several NRPE-based checks in the environment I have at work.

You will also want to read up on the Plugin API as the NRPE daemon is designed to make use of existing plugins that conform to that API. There is no requirement for a plugin to be written in any given language, and bash will do just fine so long as the scripts satisfy the API and the needs of the humans operating the monitoring system.

If there is information on the target system (or network) make sure that you have the NRPE listener process tuned to only accept connections from your monitoring system and even then to only execute certain pre-specified commands. Note that it is possible to "chain" NRPE requests, but this gets impractical after about two or three hops (and makes a confusing mess of things).
sergani
Posts: 3
Joined: Mon Sep 05, 2011 12:05 pm

Re: Request help monitoring custom commands on remote server

Post by sergani »

Thanks Carl, I'll try to make best use of this and let you know if I need further assistance.

//M
Locked