-2

I have a remote Ubuntu system, and I need to do the following checks on it in nagios:

  • check_users

  • check_procs

  • check_all_disks.

How do I do that on a remote system? I've looked around, but everything I've found seems to be from either early 2010 or ealier.

jrg
  • 219
  • 3
  • 12
  • 1
    Nothing of substance has changed with the Nagios code base since 2010 that would deprecate that documentation. – EEAA Jun 02 '12 at 18:58
  • @ErikA I deal in stuff that is fairly new and changes quick (i'm more of a programmer than a sysadmin), so I'm used to (and to a certain degree, assume) anything older than 6 months being outdated. – jrg Jun 02 '12 at 19:02

2 Answers2

9

Just because it's from 2 years ago doesn't make it irrelevant. Nagios is a stable, robust system, and as such plenty of useful information is that old.

The tool you want is NRPE (Nagios Remote Plugin Executor); it allows you to run Nagios plugins on a remote machine over the network, and collect the results in your local Nagios server. There's bucketloads of introductory documentation available, so I won't bother going into a detailed HOWTO here.

womble
  • 96,255
  • 29
  • 175
  • 230
  • I tend to prefer the check_snmp_* checks, as that eliminates having to deal with installing nrpe. But yes, nrpe will work fine for this – EEAA Jun 02 '12 at 19:02
  • 1
    I used to be like you, until I realised I'd spent far too much of my life trying to wire things into SNMP that really didn't fit well (including writing [an SNMP agent of my very own](http://theshed.hezmatt.org/rubysnmpd) and then I just gave in and started using NRPE. You can just as easily run everything over SSH, too, if NRPE bugs you (but that does leave Windows out in the cold, so we'd still have to support NRPE to some extent). – womble Jun 03 '12 at 09:51
3

Another option is too install these checks on the server that is to be monitored. Then create a user that on that server for these checks and setup ssh keys. You can then wrap these checks inside check_by_ssh. What happens then is Nagios user will ssh into the monitored server, execute the command, and the log out.

For example, the nagios command configuration would look something like:

define command{
        command_name check_procs
        command_line $USER1$/check_by_ssh -t $_HOSTPARAM_SSH_TIMEOUT$ -H $HOSTADDRESS$ -C "$USER1$/check_procs $ARG1$"
}

One downside to keep in mind is that ssh has more overhead than other options. However this not really a problem for smaller environments monitoring servers that are not too tight on resources.

Kyle Brandt
  • 83,619
  • 74
  • 305
  • 448
  • Took me too long to find this answer. I just wanted to run a local check with a custom script. I found this excellent answer with a question search "nagios remote local" on this site. – bgStack15 Jan 10 '17 at 15:22