Problem with check_bind9.pl

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
achahine21
Posts: 8
Joined: Thu Jun 07, 2018 12:31 am

Problem with check_bind9.pl

Post 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 ?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Problem with check_bind9.pl

Post 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?
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
achahine21
Posts: 8
Joined: Thu Jun 07, 2018 12:31 am

Re: Problem with check_bind9.pl

Post 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 ?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Problem with check_bind9.pl

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Problem with check_bind9.pl

Post by scottwilkerson »

Then restart NRPE
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
achahine21
Posts: 8
Joined: Thu Jun 07, 2018 12:31 am

Re: Problem with check_bind9.pl

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Problem with check_bind9.pl

Post by scottwilkerson »

What are they currently

Code: Select all

ls -l /etc/bind/rndc.key
and what do they need to be?
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
achahine21
Posts: 8
Joined: Thu Jun 07, 2018 12:31 am

Re: Problem with check_bind9.pl

Post by achahine21 »

It was 640 and i changed it to 644
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Problem with check_bind9.pl

Post by scottwilkerson »

achahine21 wrote:It was 640 and i changed it to 644
Did that solve your issue?
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
achahine21
Posts: 8
Joined: Thu Jun 07, 2018 12:31 am

Re: Problem with check_bind9.pl

Post by achahine21 »

Yes, that solved my issue with the

Code: Select all

check_bind9.pl
Script.
Thank you so much.
Locked