Trying to move to using embedded ruby but it's not being picked up


#1

I’m lost, I’ve restarted the service, I’ve rebooted the instance … no change.

cat /etc/default/sensu

EMBEDDED_RUBY=true

USER=sensu

ps aux | grep sensu

sensu 2134 0.0 0.8 652500 17328 ? Sl 16:22 0:00 /opt/sensu/embedded/bin/ruby /opt/sensu/bin/sensu-client -b -c /etc/sensu/config.json -d /etc/sensu/conf.d -e /etc/sensu/extensions -p /var/run/sensu/sensu-client.pid -l /var/log/sensu/sensu-client.log -L info

sudo -u sensu env

TERM=screen-256color-bce

LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arj=01;31:.taz=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.zip=01;31:.z=01;31:.Z=01;31:.dz=01;31:.gz=01;31:.lz=01;31:.xz=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.jpg=01;35:.jpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.axv=01;35:.anx=01;35:.ogv=01;35:.ogx=01;35:.aac=00;36:.au=00;36:.flac=00;36:.mid=00;36:.midi=00;36:.mka=00;36:.mp3=00;36:.mpc=00;36:.ogg=00;36:.ra=00;36:.wav=00;36:.axa=00;36:.oga=00;36:.spx=00;36:.xspf=00;36:

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

LANG=en_US.UTF-8

HOME=/root

LC_CTYPE=en_US.UTF-8

SHELL=/bin/bash

MAIL=/var/mail/sensu

LOGNAME=sensu

USER=sensu

USERNAME=sensu

SUDO_COMMAND=/usr/bin/env

SUDO_USER=root

SUDO_UID=0

SUDO_GID=0

sudo -u sensu ruby -v

ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]

sudo -u sensu /opt/sensu/embedded/bin/ruby -v

ruby 2.0.0p645 (2015-04-13 revision 50299) [x86_64-linux]

sudo -u sensu $PATH

sudo: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin: command not found

sudo -u sensu gem env

RubyGems Environment:

  • RUBYGEMS VERSION: 1.8.23

  • RUBY VERSION: 1.9.3 (2013-11-22 patchlevel 484) [x86_64-linux]

  • INSTALLATION DIRECTORY: /var/lib/gems/1.9.1

  • RUBY EXECUTABLE: /usr/bin/ruby1.9.1

  • EXECUTABLE DIRECTORY: /usr/local/bin

  • RUBYGEMS PLATFORMS:

  • ruby

  • x86_64-linux

  • GEM PATHS:

  • /var/lib/gems/1.9.1

  • /root/.gem/ruby/1.9.1

  • GEM CONFIGURATION:

  • :update_sources => true

  • :verbose => true

  • :benchmark => false

  • :backtrace => false

  • :bulk_threshold => 1000

  • “gem” => “–no-document”

  • REMOTE SOURCES:

  • http://rubygems.org/


#2

Should it also update the GEM_HOME and GEM_PATH to /opt/sensu as well?

···

On Tuesday, July 28, 2015 at 11:31:39 AM UTC-5, Adam Stracener wrote:

I’m lost, I’ve restarted the service, I’ve rebooted the instance … no change.

cat /etc/default/sensu

EMBEDDED_RUBY=true

USER=sensu

ps aux | grep sensu

sensu 2134 0.0 0.8 652500 17328 ? Sl 16:22 0:00 /opt/sensu/embedded/bin/ruby /opt/sensu/bin/sensu-client -b -c /etc/sensu/config.json -d /etc/sensu/conf.d -e /etc/sensu/extensions -p /var/run/sensu/sensu-client.pid -l /var/log/sensu/sensu-client.log -L info

sudo -u sensu env

TERM=screen-256color-bce

LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arj=01;31:.taz=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.zip=01;31:.z=01;31:.Z=01;31:.dz=01;31:.gz=01;31:.lz=01;31:.xz=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.jpg=01;35:.jpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.axv=01;35:.anx=01;35:.ogv=01;35:.ogx=01;35:.aac=00;36:.au=00;36:.flac=00;36:.mid=00;36:.midi=00;36:.mka=00;36:.mp3=00;36:.mpc=00;36:.ogg=00;36:.ra=00;36:.wav=00;36:.axa=00;36:.oga=00;36:.spx=00;36:.xspf=00;36:

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

LANG=en_US.UTF-8

HOME=/root

LC_CTYPE=en_US.UTF-8

SHELL=/bin/bash

MAIL=/var/mail/sensu

LOGNAME=sensu

USER=sensu

USERNAME=sensu

SUDO_COMMAND=/usr/bin/env

SUDO_USER=root

SUDO_UID=0

SUDO_GID=0

sudo -u sensu ruby -v

ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]

sudo -u sensu /opt/sensu/embedded/bin/ruby -v

ruby 2.0.0p645 (2015-04-13 revision 50299) [x86_64-linux]

sudo -u sensu $PATH

sudo: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin: command not found

sudo -u sensu gem env

RubyGems Environment:

  • RUBYGEMS VERSION: 1.8.23
  • RUBY VERSION: 1.9.3 (2013-11-22 patchlevel 484) [x86_64-linux]
  • INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
  • RUBY EXECUTABLE: /usr/bin/ruby1.9.1
  • EXECUTABLE DIRECTORY: /usr/local/bin
  • RUBYGEMS PLATFORMS:
  • ruby
  • x86_64-linux
  • GEM PATHS:
  • /var/lib/gems/1.9.1
  • /root/.gem/ruby/1.9.1
  • GEM CONFIGURATION:
  • :update_sources => true
  • :verbose => true
  • :benchmark => false
  • :backtrace => false
  • :bulk_threshold => 1000
  • “gem” => “–no-document”
  • REMOTE SOURCES:

#3

EMBEDDED_RUBY only affects processes that are spawned under the init
scripts. Sudo is unaware of it.

Here is what it affects:

cat /proc/2134/environ to see if the current sensu proc has those vars.

···

On Tue, Jul 28, 2015 at 10:14 AM, Adam Stracener <adamstracener@gmail.com> wrote:

Should it also update the GEM_HOME and GEM_PATH to /opt/sensu as well?

On Tuesday, July 28, 2015 at 11:31:39 AM UTC-5, Adam Stracener wrote:

I'm lost, I've restarted the service, I've rebooted the instance .. no
change.

cat /etc/default/sensu
EMBEDDED_RUBY=true
USER=sensu

ps aux | grep sensu
sensu 2134 0.0 0.8 652500 17328 ? Sl 16:22 0:00
/opt/sensu/embedded/bin/ruby /opt/sensu/bin/sensu-client -b -c
/etc/sensu/config.json -d /etc/sensu/conf.d -e /etc/sensu/extensions -p
/var/run/sensu/sensu-client.pid -l /var/log/sensu/sensu-client.log -L info

sudo -u sensu env
TERM=screen-256color-bce

LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LANG=en_US.UTF-8
HOME=/root
LC_CTYPE=en_US.UTF-8
SHELL=/bin/bash
MAIL=/var/mail/sensu
LOGNAME=sensu
USER=sensu
USERNAME=sensu
SUDO_COMMAND=/usr/bin/env
SUDO_USER=root
SUDO_UID=0
SUDO_GID=0

sudo -u sensu ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]

sudo -u sensu /opt/sensu/embedded/bin/ruby -v
ruby 2.0.0p645 (2015-04-13 revision 50299) [x86_64-linux]

sudo -u sensu $PATH
sudo: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:
command not found

sudo -u sensu gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.23
  - RUBY VERSION: 1.9.3 (2013-11-22 patchlevel 484) [x86_64-linux]
  - INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
  - RUBY EXECUTABLE: /usr/bin/ruby1.9.1
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /var/lib/gems/1.9.1
     - /root/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-document"
  - REMOTE SOURCES:
     - http://rubygems.org/


#4

Seems no matter what I do, it still uses the wrong ruby

TERM=screen-256color-bce^@OLDPWD=/^@PATH=/opt/sensu/embedded/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/etc/sensu/plugins:/etc/sensu/handlers^@PWD=/opt/sensu^@LANG=en_US.UTF-8^@SHLVL=2^@GEM_PATH=/opt/sensu/embedded/lib/ruby/gems/2.0.0:^@_=/sbin/start-stop-daemon^@HOME=/opt/sensu^@

root@ip-10-0-0-36:/proc/4259# sudo -u sensu which gem

/usr/bin/gem

root@ip-10-0-0-36:/proc/4259# /usr/bin/gem -v

1.8.23

root@ip-10-0-0-36:/proc/4259# /usr/bin/gem env

RubyGems Environment:

  • RUBYGEMS VERSION: 1.8.23

  • RUBY VERSION: 1.9.3 (2013-11-22 patchlevel 484) [x86_64-linux]

  • INSTALLATION DIRECTORY: /var/lib/gems/1.9.1

  • RUBY EXECUTABLE: /usr/bin/ruby1.9.1

  • EXECUTABLE DIRECTORY: /usr/local/bin

  • RUBYGEMS PLATFORMS:

  • ruby

  • x86_64-linux

  • GEM PATHS:

  • /var/lib/gems/1.9.1

  • /root/.gem/ruby/1.9.1

  • GEM CONFIGURATION:

  • :update_sources => true

  • :verbose => true

  • :benchmark => false

  • :backtrace => false

  • :bulk_threshold => 1000

  • “gem” => “–no-document”

  • REMOTE SOURCES:

  • http://rubygems.org/

root@ip-10-0-0-36:/proc/4259# sudo -u sensu /opt/sensu/embedded/bin/gem install sensu-plugin

root@ip-10-0-0-36:/proc/4259# sudo -u sensu /opt/sensu/embedded/bin/gem install sensu-plugin

Successfully installed sensu-plugin-1.2.0

Parsing documentation for sensu-plugin-1.2.0

Installing ri documentation for sensu-plugin-1.2.0

1 gem installed

root@ip-10-0-0-36:/proc/4259# sudo -u sensu gem which sensu-plugin

/var/lib/gems/1.9.1/gems/sensu-plugin-1.1.0/lib/sensu-plugin.rb

root@ip-10-0-0-36:/proc/4259# sudo -u sensu gem list

*** LOCAL GEMS ***

mixlib-cli (1.5.0)

sensu-plugin (1.1.0)

root@ip-10-0-0-36:/proc/4259# sudo -u sensu gem which sensu-plugin

/var/lib/gems/1.9.1/gems/sensu-plugin-1.1.0/lib/sensu-plugin.rb

···


Adam Stracener
Sent with Airmail

On July 28, 2015 at 9:14:29 PM, Kyle Anderson (kyle@xkyle.com) wrote:

EMBEDDED_RUBY only affects processes that are spawned under the init
scripts. Sudo is unaware of it.

Here is what it affects:
https://github.com/sensu/sensu-build/blob/master/sensu_configs/init.d/sensu-service#L165-L172

cat /proc/2134/environ to see if the current sensu proc has those vars.

On Tue, Jul 28, 2015 at 10:14 AM, Adam Stracener > adamstracener@gmail.com wrote:

Should it also update the GEM_HOME and GEM_PATH to /opt/sensu as well?

On Tuesday, July 28, 2015 at 11:31:39 AM UTC-5, Adam Stracener wrote:

I’m lost, I’ve restarted the service, I’ve rebooted the instance … no
change.

cat /etc/default/sensu
EMBEDDED_RUBY=true
USER=sensu

ps aux | grep sensu
sensu 2134 0.0 0.8 652500 17328 ? Sl 16:22 0:00
/opt/sensu/embedded/bin/ruby /opt/sensu/bin/sensu-client -b -c
/etc/sensu/config.json -d /etc/sensu/conf.d -e /etc/sensu/extensions -p
/var/run/sensu/sensu-client.pid -l /var/log/sensu/sensu-client.log -L info

sudo -u sensu env
TERM=screen-256color-bce

LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arj=01;31:.taz=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.zip=01;31:.z=01;31:.Z=01;31:.dz=01;31:.gz=01;31:.lz=01;31:.xz=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.jpg=01;35:.jpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.axv=01;35:.anx=01;35:.ogv=01;35:.ogx=01;35:.aac=00;36:.au=00;36:.flac=00;36:.mid=00;36:.midi=00;36:.mka=00;36:.mp3=00;36:.mpc=00;36:.ogg=00;36:.ra=00;36:.wav=00;36:.axa=00;36:.oga=00;36:.spx=00;36:.xspf=00;36:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LANG=en_US.UTF-8
HOME=/root
LC_CTYPE=en_US.UTF-8
SHELL=/bin/bash
MAIL=/var/mail/sensu
LOGNAME=sensu
USER=sensu
USERNAME=sensu
SUDO_COMMAND=/usr/bin/env
SUDO_USER=root
SUDO_UID=0
SUDO_GID=0

sudo -u sensu ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]

sudo -u sensu /opt/sensu/embedded/bin/ruby -v
ruby 2.0.0p645 (2015-04-13 revision 50299) [x86_64-linux]

sudo -u sensu $PATH
sudo: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:
command not found

sudo -u sensu gem env
RubyGems Environment:

  • RUBYGEMS VERSION: 1.8.23
  • RUBY VERSION: 1.9.3 (2013-11-22 patchlevel 484) [x86_64-linux]
  • INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
  • RUBY EXECUTABLE: /usr/bin/ruby1.9.1
  • EXECUTABLE DIRECTORY: /usr/local/bin
  • RUBYGEMS PLATFORMS:
  • ruby
  • x86_64-linux
  • GEM PATHS:
  • /var/lib/gems/1.9.1
  • /root/.gem/ruby/1.9.1
  • GEM CONFIGURATION:
  • :update_sources => true
  • :verbose => true
  • :benchmark => false
  • :backtrace => false
  • :bulk_threshold => 1000
  • “gem” => “–no-document”
  • REMOTE SOURCES:
  • http://rubygems.org/

#5

Seems no matter what I do, it still uses the wrong ruby

TERM=screen-256color-bce^@OLDPWD=/^@PATH=/opt/sensu/embedded/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/etc/sensu/plugins:/etc/sensu/handlers^@PWD=/opt/sensu^@LANG=en_US.UTF-8^@SHLVL=2^@GEM_PATH=/opt/sensu/embedded/lib/ruby/gems/2.0.0:^@_=/sbin/start-stop-daemon^@HOME=/opt/sensu^@

^ Its working.
EMBEDDED_RUBY effects the *process*, not the *user*. It only takes
effect on something that is invoked with the init scripts

root@ip-10-0-0-36:/proc/4259# sudo -u sensu which gem
/usr/bin/gem
root@ip-10-0-0-36:/proc/4259# /usr/bin/gem -v
1.8.23
root@ip-10-0-0-36:/proc/4259# /usr/bin/gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.23
  - RUBY VERSION: 1.9.3 (2013-11-22 patchlevel 484) [x86_64-linux]
  - INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
  - RUBY EXECUTABLE: /usr/bin/ruby1.9.1
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /var/lib/gems/1.9.1
     - /root/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-document"
  - REMOTE SOURCES:
     - http://rubygems.org/

This won't make a difference. The EMBEDDED_RUBY setting only affects
processes spawned via the sensu init scripts.

root@ip-10-0-0-36:/proc/4259# sudo -u sensu /opt/sensu/embedded/bin/gem
install sensu-plugin

root@ip-10-0-0-36:/proc/4259# sudo -u sensu /opt/sensu/embedded/bin/gem
install sensu-plugin
Successfully installed sensu-plugin-1.2.0
Parsing documentation for sensu-plugin-1.2.0
Installing ri documentation for sensu-plugin-1.2.0
1 gem installed

This installed (upgraded?) the sensu-plugin gem in the embedded ruby.
(because you used the full path)

root@ip-10-0-0-36:/proc/4259# sudo -u sensu gem which sensu-plugin
/var/lib/gems/1.9.1/gems/sensu-plugin-1.1.0/lib/sensu-plugin.rb

This is looking in the system ruby. You have the sensu-plugin (1.1.0)
installed in your system ruby.

root@ip-10-0-0-36:/proc/4259# sudo -u sensu gem list

*** LOCAL GEMS ***

mixlib-cli (1.5.0)
sensu-plugin (1.1.0)
root@ip-10-0-0-36:/proc/4259# sudo -u sensu gem which sensu-plugin
/var/lib/gems/1.9.1/gems/sensu-plugin-1.1.0/lib/sensu-plugin.rb

These are system-installed gems. The fact that you used the sensu user
to list them is a red-herring.

Remember, you don't *have* to use EMBEDDED_RUBY, just use the full
path to the embedded ruby interpreter if it makes it easier (that's
how I do it)
I like that personally as it is more explicit what that I'm using a
different ruby to do the job.

···

On Tue, Jul 28, 2015 at 8:55 PM, Adam Stracener <adamstracener@gmail.com> wrote:

--
Adam Stracener
Sent with Airmail

On July 28, 2015 at 9:14:29 PM, Kyle Anderson (kyle@xkyle.com) wrote:

EMBEDDED_RUBY only affects processes that are spawned under the init
scripts. Sudo is unaware of it.

Here is what it affects:
https://github.com/sensu/sensu-build/blob/master/sensu_configs/init.d/sensu-service#L165-L172

cat /proc/2134/environ to see if the current sensu proc has those vars.

On Tue, Jul 28, 2015 at 10:14 AM, Adam Stracener > <adamstracener@gmail.com> wrote:

Should it also update the GEM_HOME and GEM_PATH to /opt/sensu as well?

On Tuesday, July 28, 2015 at 11:31:39 AM UTC-5, Adam Stracener wrote:

I'm lost, I've restarted the service, I've rebooted the instance .. no
change.

cat /etc/default/sensu
EMBEDDED_RUBY=true
USER=sensu

ps aux | grep sensu
sensu 2134 0.0 0.8 652500 17328 ? Sl 16:22 0:00
/opt/sensu/embedded/bin/ruby /opt/sensu/bin/sensu-client -b -c
/etc/sensu/config.json -d /etc/sensu/conf.d -e /etc/sensu/extensions -p
/var/run/sensu/sensu-client.pid -l /var/log/sensu/sensu-client.log -L
info

sudo -u sensu env
TERM=screen-256color-bce

LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LANG=en_US.UTF-8
HOME=/root
LC_CTYPE=en_US.UTF-8
SHELL=/bin/bash
MAIL=/var/mail/sensu
LOGNAME=sensu
USER=sensu
USERNAME=sensu
SUDO_COMMAND=/usr/bin/env
SUDO_USER=root
SUDO_UID=0
SUDO_GID=0

sudo -u sensu ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]

sudo -u sensu /opt/sensu/embedded/bin/ruby -v
ruby 2.0.0p645 (2015-04-13 revision 50299) [x86_64-linux]

sudo -u sensu $PATH
sudo: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:
command not found

sudo -u sensu gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.23
- RUBY VERSION: 1.9.3 (2013-11-22 patchlevel 484) [x86_64-linux]
- INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
- RUBY EXECUTABLE: /usr/bin/ruby1.9.1
- EXECUTABLE DIRECTORY: /usr/local/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /var/lib/gems/1.9.1
- /root/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-document"
- REMOTE SOURCES:
- http://rubygems.org/