Hey guys,
I’m running into a wall doing something which should be pretty simple. I’m trying to install plugins and then use them for checks using puppet.
It looks like when we install sensu plugins via sensu_gem, there’s no way of knowing from a puppet perspective what the path to the gem actually is. I would expect once we’ve installed a plugin using sensu_gem, that we would not have to provide a fully qualified path to the files installed by that gem. It basically makes the sensu_gem provider totally useless for automating plugin/check deployment.
Since I assume it is not totally useless, I am clearly doing something wrong.
Here’s the manifest:
$config[‘checks’].each |$check| {
if ($check[‘plugin’] and !defined(Package[$check[‘plugin’]])) {
package { $check[‘plugin’]:
provider => sensu_gem;
}
}
sensu::check {
$check[‘name’]:
handlers => $check[‘handlers’],
command => $check[‘command’],
interval => $check[‘interval’],
standalone => true
}
}
``
Here’s the hiera:
checks:
- name: ‘disk-usage’
handlers:
- ‘default’
plugin: ‘sensu-plugins-disk-checks’
command: ‘check-disk-usage.rb -w :::disk.warning|90::: -c :::disk.critical|95:::’
interval: 60
``
You can see why I would expect that to work. Instead I get ‘sh: 1: check-disk-usage.rb: not found’ from sensu.
The path the file can be found at is /opt/sensu/embedded/lib/ruby/gems/2.2.0/gems/sensu-plugins-disk-checks-0.0.1/bin, which means to use that path I would have to pin version numbers for every check.
Here’s the check definition that puppet created:
{
“checks”: {
“disk-usage”: {
“command”: “check-disk-usage.rb -w :::disk.warning|90::: -c :::disk.critical|95:::”,
“handlers”: [
“default”
],
“interval”: 60,
“standalone”: true
}
}
}
``
What am I missing? I have embedded_ruby set to true.