This plugin provides native instrumentation for monitoring Chef, including service health checks (via chef-server-ctl) and chef node status, and a Sensu handler for removing stale Sensu clients.
check-chef-node Checks if a node exists.
check-chef-nodes Reports nodes from your cluster that were last seen before the specified number of seconds.
check-chef-server
Uses Chef Server's chef-server-ctl
to check whether any component of the Chef Server is not running. You must run this plugin with elevated privileges (sudo) or it will fail with unknown state.
handler-chef-node Removes a Sensu client if its Chef node data no longer exists.
check-chef-node.rb
Usage: check-chef-node.rb (options)
-U, --url CHEF-SERVER-URL URL of Chef server
-C, --client CLIENT-NAME Client name
-i, --ignore-ssl Ignore SSL certificate verification
-K, --keys CLIENT-KEY Client's key
-n, --node-name NODE-NAME Check if this node name exists
handler-chef-node.rb
Usage: handler-chef-node.rb (options)
--map-go-event-into-ruby Enable Sensu Go to Sensu Ruby event mapping. Alternatively set envvar SENSU_MAP_GO_EVENT_INTO_RUBY=1.
Assets are the best way to make use of this plugin. If you're not using an asset, please consider doing so! If you're using sensuctl 5.13 or later, you can use the following command to add the asset:
sensuctl asset add sensu-plugins/sensu-plugins-chef
If you're using an earlier version of sensuctl, you can download the asset definition from this project's Bonsai asset index page.
---
type: Asset
api_version: core/v2
metadata:
name: sensu-plugins-chef
spec:
url: https://assets.bonsai.sensu.io/94e44dc0b89b7cd8318c38db5f64f788642140d8/sensu-plugins-chef_7.0.0_centos_linux_amd64.tar.gz
sha512: f468ea0060ab890004a3f5bd09deff5bdd98db9e7a4c9ffc0ad1c8809b0e5a8198737f23ec850e9f5181fd590aafa5b895dd948b264244770c77b5f03fa523ef
---
type: CheckConfig
spec:
command: "check-chef-nodes.rb"
handlers: []
high_flap_threshold: 0
interval: 10
low_flap_threshold: 0
publish: true
runtime_assets:
- sensu-plugins/sensu-plugins-chef
- sensu/sensu-ruby-runtime
subscriptions:
- linux
{
"checks": {
"check-chef-nodes": {
"command": "check-chef-nodes.rb",
"subscribers": ["linux"],
"interval": 10,
"refresh": 10,
"handlers": ["influxdb"]
}
}
}
See the instructions above for asset registration.
Install and setup plugins on Sensu Core.
The Sensu assets packaged from this repository are built against the Sensu Ruby runtime environment. When using these assets as part of a Sensu Go resource (check, mutator, or handler), make sure to include the corresponding Sensu Ruby Runtime Asset in the list of assets needed by the resource.
To use handler-chef-node.rb
with Sensu Go, you will need to use the event mapping command line option. See handler-chef-node.rb --help
for details. Read the sensu-plugin README for more information about the event mapping functionality.
See CONTRIBUTING.md for information about contributing to this plugin.