Coder Social home page Coder Social logo

Comments (7)

hamann avatar hamann commented on August 27, 2024

What do you get if you execute it without sudo?

from check-barman.

bernard-c avatar bernard-c commented on August 27, 2024

-sh-4.1$ /usr/lib64/nagios/plugins/check-barman/check-barman.rb -a pg -h /opt/data/MSA/barman -s KBILL-SAP
/usr/local/rvm/gems/ruby-2.1.0/gems/mixlib-shellout-1.3.0/lib/mixlib/shellout.rb:253:in invalid!': Expected process to exit with [0], but received '1' (Mixlib::ShellOut::ShellCommandFailed) ---- Begin output of /usr/bin/barman show-server KBILL-SAP ---- STDOUT: STDERR: ERROR: please run barman as 'barman' user ---- End output of /usr/bin/barman show-server KBILL-SAP ---- Ran /usr/bin/barman show-server KBILL-SAP returned 1 from /usr/local/rvm/gems/ruby-2.1.0/gems/mixlib-shellout-1.3.0/lib/mixlib/shellout.rb:239:inerror!'
from /usr/local/rvm/gems/ruby-2.1.0/gems/rbarman-0.0.13/lib/rbarman/cli_command.rb:345:in run_barman_command' from /usr/local/rvm/gems/ruby-2.1.0/gems/rbarman-0.0.13/lib/rbarman/cli_command.rb:88:inserver'
from /usr/local/rvm/gems/ruby-2.1.0/gems/rbarman-0.0.13/lib/rbarman/server.rb:65:in by_name' from /usr/lib64/nagios/plugins/check-barman/check-barman.rb:56:incheck_pg'
from /usr/lib64/nagios/plugins/check-barman/check-barman.rb:196:in `

'
-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
ERROR: please run barman as 'barman' user

I can execute barman with sudo, but it's not compatible with your code :)

-sh-4.1$ sudo /usr/bin/barman status KBILL-SAP
Server KBILL-SAP:
Description: KBILL-SAP PostgreSQL Database
...

from check-barman.

hamann avatar hamann commented on August 27, 2024

Yes, that's ok, just wanted to know if gem could be found. So it seems to be a problem with sudo.
Could you paste your /etc/sudoers? Which distribution?

from check-barman.

hamann avatar hamann commented on August 27, 2024

You're using rvm?

from check-barman.

hamann avatar hamann commented on August 27, 2024

I'm not familiar with rvm, but you should have a look at https://rvm.io/integration/sudo

from check-barman.

bernard-c avatar bernard-c commented on August 27, 2024

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
PG connection ok

Thank you for your help !

from check-barman.

hamann avatar hamann commented on August 27, 2024

Alright

from check-barman.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.