Page 1 of 1

passing perfdata to nrpe

Posted: Tue Jul 09, 2019 11:03 am
by teh0015
I can't get my nrpe script to pass numerical data via nrpe - I've done this before but it's been a while so I'm guessing I'm just doing something stupid.
This counts process on a ctbd samba server.

relevant portion of the nrpe script:
connections=`smbstatus -p|grep ^1|wc -l`
echo "SMB is running |connections=$connections;;; "
exit 0

If I run this locally I get:
SMB is running |connections=95;;;

If I run it via nrpe (it's defined in the nrpe.cfg) I get

SMB is running |connections=0;;;

It seems that when I pass a numeric variable to echo it's getting converted to 0 via nrpe.
If I put in a string it comes across via nrpe.
#connections=`smbstatus -p|grep ^1|wc -l`
connections=fred

Now via nrpe I get

SMB is running |connections=fred;;;

Re: passing perfdata to nrpe

Posted: Tue Jul 09, 2019 11:11 am
by teh0015
I figured it out.
My bad.

I forgot to check by logging in as the nrpe user and seeing what happens.
I did that and realized it was a permissions issue - setup sudoers and it's all going.

Re: passing perfdata to nrpe

Posted: Tue Jul 09, 2019 12:13 pm
by scottwilkerson
teh0015 wrote:I figured it out.
My bad.

I forgot to check by logging in as the nrpe user and seeing what happens.
I did that and realized it was a permissions issue - setup sudoers and it's all going.
great!

Locking