-1

When trying to use sensu-install it fails as it cannot find Gem/Ruby:

C:\opt\sensu\bin\sensu-install.bat -p sensu-plugins-windows:0.0.10

[SENSU-INSTALL] installing Sensu plugins ...
[SENSU-INSTALL] provided Sensu plugins: ["sensu-plugins-windows:0.0.10"]
[SENSU-INSTALL] compiled Sensu plugin gems: ["sensu-plugins-windows:0.0.10"]
[SENSU-INSTALL] determining if Sensu plugin gem 'sensu-plugins-windows:0.0.10' is already installed ...
[SENSU-INSTALL] gem list -i sensu-plugins-windows --version '0.0.10'
[SENSU-INSTALL] Sensu plugin gem 'sensu-plugins-windows' has not been installed
[SENSU-INSTALL] Sensu plugin gems to be installed: ["sensu-plugins-windows:0.0.10"]
[SENSU-INSTALL] installing Sensu plugin gem 'sensu-plugins-windows:0.0.10'
[SENSU-INSTALL] gem install sensu-plugins-windows --version '0.0.10' --no-ri --no-rdoc --verbose
[SENSU-INSTALL] failed to install Sensu plugin gem 'sensu-plugins-windows'
[SENSU-INSTALL] please take note of any failure messages above
[SENSU-INSTALL] make sure you have build tools installed (e.g. gcc)
[SENSU-INSTALL] trying to determine the Sensu plugin homepage for sensu-plugins-windows ...
'gem' is not recognized as an internal or external command,
operable program or batch file.
ZZ9
  • 888
  • 3
  • 16
  • 47
  • This is why so many people prefer not to use server fault. This is an issue numerous people encountered on github and I'm trying to post an easily searchable fix for people who are following the numerous outdated sensu guides that cause this error. – ZZ9 Apr 25 '16 at 21:48

1 Answers1

1

This is caused by the installer's embedded ruby and gem binaries located in C:\opt\sensu\embedded\bin\ not being added to the system path.

This can be resolved by running the following in an elevated powershell which adds the embedded bin directory to the system path (persistent):

$CurrentPath=(Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).Path
$NewPath=$CurrentPath+’;C:\opt\sensu\embedded\bin\’
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH –Value $NewPath

You can now run the following successfully:

sensu-install -p sensu-plugins-windows:0.0.10
ZZ9
  • 888
  • 3
  • 16
  • 47