Introduction
To simplify the burden of providing a working Ruby environment in each Sensu plugin, Sensu is making available re-usable Ruby runtime assets, and corresponding docker images that can help make it easier to use the existing collection of Ruby assets.
This will be a quick guide to walk you through using Ruby assets that require the Ruby runtime asset to work correctly. If you want to know how you can build assets that make use of the Ruby runtime, please read the companion quickstart guide to contributing Ruby Sensu Plugin assets
Sensu Check Example
Here is an example of check-cpu.rb from the sensu-plugins-cpu-checks asset together with the Ruby runtime asset built for the Sensu Agent Docker image based on Alpine Linux.
----
type: CheckConfig
api_version: core/v2
metadata:
name: cpu-percentage
namespace: default
spec:
check_hooks: null
command: check-cpu.rb -w 70 -c 90
env_vars: null
handlers: []
high_flap_threshold: 0
interval: 60
low_flap_threshold: 0
output_metric_format: ""
output_metric_handlers: []
proxy_entity_name: ""
publish: true
round_robin: false
runtime_assets:
- sensu-plugins-cpu-checks
- sensu-ruby-runtime
stdin: false
subdue: null
subscriptions:
- example
timeout: 30
ttl: 0
Here’s the corresponding asset configurations referenced in the check:
---
type: Asset
api_version: core/v2
metadata:
name: sensu-plugins-cpu-checks
namespace: default
labels: {}
annotations: {}
spec:
url: https://github.com/sensu-plugins/sensu-plugins-cpu-checks/releases/download/4.0.0/sensu-plugins-cpu-checks_4.0.0_alpine_linux_amd64.tar.gz
sha512: b2da25ecd7642e6de41fde37d674fe19dcb6ee3d680e145e32289f7cfc352e6b5f9413ee9b701d61faeaa47b3 99aa30b25885dbc1ca432c4061c8823774c28f3
filters:
- entity.system.os == 'linux'
- entity.system.arch == 'amd64'
- entity.system.platform == 'alpine'
----
type: Asset
api_version: core/v2
metadata:
name: sensu-ruby-runtime
namespace: default
spec:
filters:
- entity.system.os == 'linux'
- entity.system.arch == 'amd64'
- entity.system.platform == 'alpine'
sha512: dc4c60215c8606062609b471d803147045a6855ccf55d4d3145d96ca528fac48a3b039a1563e4de65b9c9a9fb09445f3a133a6ab1a4d688c1b8164b1b1ba799d
url: https://github.com/sensu/sensu-ruby-runtime/releases/download/0.0.5/sensu-ruby-runtime_0.0.5_alpine_linux_amd64.tar.gz