send_nsca without Perl

Hello guys,

I’have a trouble with send_nsca.
I’d like to run send_nsca plugin without perl because my box is hardened, so there isn’t perl and gcc :frowning: .

Exist a little .sh client ? how can i perform that task?

Thank you in advanced :cry:

I’m a bit confused, send_nsca is a compiled c program, no need for perl. Are you looking for an example of invoking it using a shell script? If so, here you go:

#!/bin/bash

/usr/local/nagios/libexec/check_somecommand | /usr/local/nagios/bin/send_nsca -H www.domain.com -c /usr/local/nagios/etc/send_nsca.cfg 2>&1 >> /dev/null

and then for libexec/check_somecommand, for example, one that counts the number of processes and warns if less than 5 and goes critical if less then 2 (example only, doesn’t take into account that some ps’s throw in a header line):

#!/bin/bash

HOST="Some_Hostname"
SERVNAME=“Bogus Service Name”

numprocs=ps ax | wc -l

outtext=""
outcode=2

if “$numprocs” -lt 2 ]] ; then

outcode=2
outtext=“Critical! Not many processes at all!”

elif “$numprocs” -lt 5 ]] ; then

outcode=1
outtext=“Warning! Too few processes, run some more!”

else

outcode=0
outtext=“Ahh, just right.”

fi

echo -e “$HOST\t$SERVNAME\t${outcode}\t${outtext}\n”

-mike

Edited Wed Dec 28 2005, 11:24PM ]

Thank you mh720,

There are three version of send_nsca , .pl .c and .exe.
I done a little bash script with all paramenters to send to nscad but the client doesn’t works because I can’t use perl fo nsca.pl or gcc to compile nsca.c.

:expressionless: