-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sudo check-barman "no such file to load -- rbarman" #2
Comments
What do you get if you execute it without sudo? |
-sh-4.1$ /usr/lib64/nagios/plugins/check-barman/check-barman.rb -a pg -h /opt/data/MSA/barman -s KBILL-SAP -sh-4.1$ vim /usr/lib64/nagios/plugins/check-barman/check-barman.rb Because, I do not have the right to execute 'barman' with nagios user : -sh-4.1$ barman status KBILL-SAP I can execute barman with sudo, but it's not compatible with your code :) -sh-4.1$ sudo /usr/bin/barman status KBILL-SAP |
Yes, that's ok, just wanted to know if gem could be found. So it seems to be a problem with sudo. |
You're using rvm? |
I'm not familiar with rvm, but you should have a look at https://rvm.io/integration/sudo |
Thank you, this link https://rvm.io/integration/sudo helped me. I added this line on sudoers file : Defaults env_keep +="rvm_bin_path GEM_HOME IRBRC MY_RUBY_HOME rvm_path rvm_prefix rvm_version GEM_PATH rvmsudo_secure_path RUBY_VERSION rvm_ruby_string rvm_delete_flag PATH" And commented out this : Defaults secure_path Then, I added this line on bash_profile user : export rvmsudo_secure_path=0 And, with rvmsudo command, I can execute the plugin to check barman : -sh-4.1$ rvmsudo /usr/lib64/nagios/plugins/check-barman/check-barman.rb -a pg -h /opt/data/MSA/barman -s KBILL-SAP Thank you for your help ! |
Alright |
Hello,
I have an error when I try to execute the check with the user nagios and sudo :
-sh-4.1$ whoami
nagios
-sh-4.1$ sudo /usr/lib64/nagios/plugins/check-barman/check-barman.rb -a pg -h /opt/data/MSA/barman -s KBILL-SAP
/usr/lib64/nagios/plugins/check-barman/check-barman.rb:26:in `require': no such file to load -- rbarman (LoadError)
from /usr/lib64/nagios/plugins/check-barman/check-barman.rb:26
However, I have the rbarman gem installed :
-sh-4.1$ gem list rbarman
*** LOCAL GEMS ***
rbarman (0.0.13, 0.0.12)
And in sudoers file, I followed your advice and I added these lines :
Defaults:nagios !requiretty
nagios ALL=NOPASSWD: /usr/lib64/nagios/plugins/check-barman/check-barman.rb
And when I list gem with the command sudo, I also add rbarman gem :
-sh-4.1$ sudo gem list rbarman
*** LOCAL GEMS ***
rbarman (0.0.13, 0.0.12)
Isn't there something missing in your documentation to use check-barman with sudo command and nagios user?
The text was updated successfully, but these errors were encountered: