LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   NRPE problem (https://www.linuxquestions.org/questions/linux-newbie-8/nrpe-problem-875605/)

brownie_cookie 04-18-2011 06:00 AM

NRPE problem
 
Hi all

I've followed this tutorial for installing and configuring NRPE Daemon
link
and everything works (when i follow the tutorial)

now i've added a plugin of mine (so i did the changes from page 13 to 14)
and i restarted everything, but how can i execute a check from the monitor host?

For example, i have a check called check_file_age which checks the age of a file (ofcourse) on the remote host. When i execute this on the remote host itself everything is fine
Code:

./check_file_age -w 100 -c 200 -f filename
but HOW do i run this FROM the monitor host?

Can someone please help me with this? It's probably something easy, but i can't figure out what to do :(

Thanks in advance

Kind regards

Brownie

stoggy 04-18-2011 06:53 AM

check page 10 in the link you provided.

brownie_cookie 04-18-2011 07:22 AM

yeah, i've found it too :p
this is what i do now

Code:

./check_nrpe -H host -c check_file_age
so it's working
But now i want to go a little further, in the file nrpe.cfg (located at /usr/local/nagios/etc/ (in my case)) you can add commands (see page 13)
so i've added:
Code:

command[check_file_age]=/usr/local/nagios/libexec/check_file_age -w 100 -c 1000 -f filename
but in that same file (nrpe.cfg) there is something in comment
Quote:

# The following examples allow user-supplied arguments and can
# only be used if the NRPE daemon was compiled with support for
# command arguments *AND* the dont_blame_nrpe directive in this
# config file is set to '1'
. This poses a potential security risk, so
# make sure you read the SECURITY file before doing this.

#command[check_users]=/usr/local/nagios/libexec/check_users -w $ARG1$ -c $ARG2$
#command[check_load]=/usr/local/nagios/libexec/check_load -w $ARG1$ -c $ARG2$
#command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
#command[check_procs]=/usr/local/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
the piece I've put in bold i have also changed into 1 (it was in the same file).

Ok, with everything set up (and xinetd restarted) i go to my monitoring host and type something like:
Code:

./check_nrpe -H 193.191.168.59 -c check_file_age -w 100 -c 1000 -f /cronjob.txt
but then i get the following error:
Code:

./check_nrpe: invalid option -- w
./check_nrpe: invalid option -- f

NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad (nagios@nagios.org)
Version: 2.12
Last Modified: 03-10-2008
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required

Usage: check_nrpe -H <host> [-n] [-u] [-p <port>] [-t <timeout>] [-c <command>] [-a <arglist...>]

Options:
 -n        = Do no use SSL
 -u        = Make socket timeouts return an UNKNOWN state instead of CRITICAL
 <host>    = The address of the host running the NRPE daemon
 [port]    = The port on which the daemon is running (default=5666)
 [timeout]  = Number of seconds before connection times out (default=10)
 [command]  = The name of the command that the remote daemon should run
 [arglist]  = Optional arguments that should be passed to the command.  Multiple
              arguments should be separated by a space.  If provided, this must be
              the last option supplied on the command line.

Note:
This plugin requires that you have the NRPE daemon running on the remote host.
You must also have configured the daemon to associate a specific plugin command
with the [command] option you are specifying here.  Upon receipt of the
[command] argument, the NRPE daemon will run the appropriate plugin command and
send the plugin output and return code back to *this* plugin.  This allows you
to execute plugins on remote hosts and 'fake' the results to make Nagios think
the plugin is being run locally.

i've read this (i don't understand everything, like the Note..??) so i thought it got to do something with the '-a' or arglist, so then i tried this:
Code:

#./check_nrpe -H 193.191.168.59 -c check_file_age -a 100 -a 1000 -a /cronjob.txt
CHECK_NRPE: Received 0 bytes from daemon.  Check the remote server logs for error messages.

[root@monitor2 plugins]# ./check_nrpe -H 193.191.168.59 -c check_file_age -a 100 1000 /cronjob.txt
CHECK_NRPE: Received 0 bytes from daemon.  Check the remote server logs for error messages.

you see the error i get , i tried a couple of possibilities but i don't know what i'm doing wrong.

I know it's a lot of information and maybe hard to understand, but if you know it, feel free to help me :p
in the meantime i'll try to find the solution and if i do, i'll post it here ;)

Kind regards

Brownie

brownie_cookie 04-18-2011 07:36 AM

oke guys

i already found the solution :p

when you do
Code:

./configure
on the REMOTE host, USE
Code:

./configure --enable-command-args
and than do the other things that are described in the link ;) and then you should fine

maybe nice to know, if you did that special configure and want to use a check from the monitor host, use
Code:

./check_nrpe -H remote_host -c check_file_age -a 100 1000 /filename.txt
in order to your needs, you might to need to change the filenames, arguments ;)

Kind regards

P.S.: link


All times are GMT -5. The time now is 10:53 PM.