Problem with nrpe


#1

Hi

I tried to search if anyone else have had same kind of problem that I have. I made my own plugin that checks size of one file… everything works fine on local computer but with nrpe it won’t return any variables values.

plungin is basic shell script that echos values

echo “File OK - File size is $SIZE Mb”

this will return this: File OK - File size is Mb

does anyone have any ideas why variables values won’t be passed to nagios sever?

May by I have to write the plugin again using c/c++


#2

Is NRPE returning variable values or arguments for any other checks on remote hosts that you’re making?


#3

Yes, nrpe is working fine with nagios_plugins, but not with my own bash skripts.

#!/bin/bash

ECHO="/bin/echo"

if $# -ne 4 ]; then
$ECHO "Usage: $0 -w -c "
exit 127
fi

SIZE=wc -c /var/spool/qmailscan/qmail-queue.log |cut -d ' ' -f1
MB_SIZE=expr $SIZE / 100000

   if  $MB_SIZE -gt $2 ];
            then
                    if  $MB_SIZE -gt $4 ];
                   then
                            echo "FILE CRITICAL - Qmail file size $MB_SIZE MB"
                    else
                            echo "FILE WARNING - Qmail file size $MB_SIZE MB"

            fi
    else
            echo "FILE OK - Qmail file size $MB_SIZE' MB"

    fi

that is the skript … it is not that complitate

Edited Sun Dec 18 2005, 05:57PM ]


#4

Here are the macros that nagios understands.
nagios.sourceforge.net/docs/1_0/macros.html
You could define $USERn$ to be what you need in the resource.cfg file.


#5

Thanks that helped :slight_smile: