Page 1 of 1

barman plugin

Posted: Tue Mar 01, 2016 9:24 am
by amicohen1
hi,
whenver i use barman plugin, the NRPE respond with "NRPE: Unable to read output".

i was adding nagios to sudo without password for this script, and when i execute the command in command line (from root), it apears fine:
sudo /usr/lib/nagios/plugins/check-barman.rb -a backups_available -s angus -w 5 -c 6.
same thing happen also when i do it with: barman check --nagios .....
any idea ?
Thanks,
Ami

Re: barman plugin

Posted: Tue Mar 01, 2016 10:39 am
by rkennedy
What happens if you execute it as the nagios user (no sudo)?

Also - what are the permissions on the file? ls -l check-barman.rb

Re: barman plugin

Posted: Tue Mar 01, 2016 2:20 pm
by amicohen1
actually i moved to work directly on barman (barman check --nagios angus) and still same thing happening, also without sudo (when executing it directly with sudo account, its working fine)

sudo -U nagios -l
Matching Defaults entries for nagios on localhost:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin

User nagios may run the following commands on localhost:
(root) NOPASSWD: /usr/lib/nagios/plugins/check-barman.rb, /usr/bin/barman
(ALL : ALL) ALL


-rwxr-xr-x 1 root root 851 Nov 16 11:51 /usr/bin/barman*

Re: barman plugin

Posted: Tue Mar 01, 2016 5:53 pm
by tgriep
Can you post how the command is setup in the nrpe,cfg file on the remote sysrem and how you are running the check on the Nagios system?

Re: barman plugin

Posted: Tue Mar 01, 2016 5:55 pm
by lmiltchev
Does adding the line below to sudors help?

Code: Select all

nagios ALL=NOPASSWD: /usr/lib/nagios/plugins/check-barman.rb *

Re: barman plugin

Posted: Wed Mar 02, 2016 1:38 am
by amicohen1
i tryed both options:
command[check_barman]=sudo /usr/bin/barman check --nagios angus
and
command[check_barman]=sudo /usr/lib/nagios/plugins/check-barman.rb -a backups_available -s angus -w 5 -c 6

(and also without the sudo).

i also tried the advise of adding * to sudoers file (nagios ALL=NOPASSWD:/usr/bin/barman * ), and same result

Re: barman plugin

Posted: Wed Mar 02, 2016 12:58 pm
by tgriep
On your remote system that the check is installed, can you run the following and post the output here?

Code: Select all

/usr/lib/nagios/plugins/check-barman.rb -a backups_available -s angus -w 5 -c 6
su nagios
/usr/lib/nagios/plugins/check-barman.rb -a backups_available -s angus -w 5 -c 6
Thanks

Re: barman plugin

Posted: Mon Mar 07, 2016 5:32 am
by amicohen1
sorry for late response: when i logged in as root i get the following:

/usr/lib/nagios/plugins/check-barman.rb -a backups_available -s angus -w 5 -c 6

1 backups available


su -l nagios -c '/usr/lib/nagios/plugins/check-barman.rb -a backups_available -s angus -w 5 -c 6'

no output

Re: barman plugin

Posted: Mon Mar 07, 2016 8:48 am
by amicohen1
found the problem...
nagios ALL=(root) NOPASSWD:/usr/bin/barman need to apear after the definitions of the groups. as described in: http://askubuntu.com/questions/504652/a ... oesnt-work

thanks alot for those who were trying to assist!!!

Re: barman plugin

Posted: Mon Mar 07, 2016 2:32 pm
by hsmith
I'm glad you got it! Are we all right to close this topic?