Page 1 of 2

Problem with check_bind9.pl

Posted: Thu Jun 28, 2018 5:31 am
by achahine21
Hello,

I'm trying to monitor a Bind service and i'm using the script check_bind9.pl
https://raw.githubusercontent.com/thorf ... k_bind9.pl

The script works fine by running it directly from the remote server and giving me the below output:

Code: Select all

BIND9 OK ; PID 2726 ; Running: 0/1900/2000 UDP, 0/100 TCP, 0 xfers; 0 deferred xfers; 94 zones ; | success=11516c referral=0c nxrrset=642c nxdomain=10207c recursion=0c failure=1c duplicate=0c dropped=0c cpus=2 workers=2 zones=94 debug=0;1 xfers_running=0 xfers_deferred=0 soa_running=0 udp_running=0;1900;2000 udp_soft_limit=1900 udp_hard_limit=2000 tcp_running=0;;100 tcp_hard_limit=100
but by running it from the Nagios server i got " BIND9 Failed to find status data in: 'rndc status'"
example :
./check_nrpe -H my_bind_server_ip -c check_bind

Code: Select all

BIND9 Failed to find status data in: 'rndc status'. ; PID 2726 ; Running: 0/0/0 UDP, 0/0 TCP, 0 xfers; 0 deferred xfers; 0 zones ; | success=7807c referral=0c nxrrset=398c nxdomain=7133c recursion=0c failure=1c duplicate=0c dropped=0c cpus=0 workers=0 zones=0 debug=0;1 xfers_running=0 xfers_deferred=0 soa_running=0 udp_running=0 udp_soft_limit=0 udp_hard_limit=0 tcp_running=0 tcp_hard_limit=0

what could be the problem ?

Re: Problem with check_bind9.pl

Posted: Thu Jun 28, 2018 7:46 am
by scottwilkerson
Can you share your check_bind command from your nrpe.cfg

Also, when you ran it fine from the remote server were you it running as the nagios user?

From the help it looks like it needs sudo access, was that configured?

Re: Problem with check_bind9.pl

Posted: Thu Jun 28, 2018 7:54 am
by achahine21
Hi @ scottwilkerson Thank you for replying
Can you share your check_bind command from your nrpe.cfg

Code: Select all

command[check_bind]=/usr/lib/nagios/plugins/check_bind9.pl
Also, when you ran it fine from the remote server were you it running as the nagios user?
In face I gave this script chmod 777 in order to avoid any permission problem at this moment.
From the help it looks like it needs sudo access, was that configured?
I already install the sudo on the remote server, But how could i allow the sudo acces ?

Re: Problem with check_bind9.pl

Posted: Thu Jun 28, 2018 9:22 am
by scottwilkerson
change this

Code: Select all

command[check_bind]=/usr/lib/nagios/plugins/check_bind9.pl
to this

Code: Select all

command[check_bind]=sudo /usr/lib/nagios/plugins/check_bind9.pl

Re: Problem with check_bind9.pl

Posted: Thu Jun 28, 2018 9:23 am
by scottwilkerson
Then restart NRPE

Re: Problem with check_bind9.pl

Posted: Fri Jun 29, 2018 12:53 am
by achahine21
After many modification, I understood that the problem is related to the permission for the File

Code: Select all

/etc/bind/rndc.key
But i'm not sure how should i change the permission.

Re: Problem with check_bind9.pl

Posted: Fri Jun 29, 2018 7:44 am
by scottwilkerson
What are they currently

Code: Select all

ls -l /etc/bind/rndc.key
and what do they need to be?

Re: Problem with check_bind9.pl

Posted: Fri Jun 29, 2018 9:25 am
by achahine21
It was 640 and i changed it to 644

Re: Problem with check_bind9.pl

Posted: Fri Jun 29, 2018 9:37 am
by scottwilkerson
achahine21 wrote:It was 640 and i changed it to 644
Did that solve your issue?

Re: Problem with check_bind9.pl

Posted: Sat Jun 30, 2018 1:04 am
by achahine21
Yes, that solved my issue with the

Code: Select all

check_bind9.pl
Script.
Thank you so much.