License
MIT License
v0.2.0 · public · Published about 4 years ago
The Sensu Chef Handler is a Sensu Event Handler that will
delete an entity with a failing keepalive check when its corresponding Chef
node no longer exists.
Help:
Usage:
sensu-chef-handler [flags]
sensu-chef-handler [command]
Available Commands:
help Help about any command
version Print the version number of this plugin
Flags:
-k, --client-key-path string The path to the Chef Client key to use when authenticating/querying the Chef Server API
-c, --client-name string The Chef Client name to use when authenticating/querying the Chef Server API
-e, --endpoint string The Chef Server API endpoint (URL)
-f, --flavor string The Chef Server flavor (enterprise or open_source)
-h, --help help for sensu-chef-handler
--node-name string The Chef node name to use for the entity when querying Chef
--sensu-api-key string The Sensu API key
--sensu-api-url string The Sensu API URL (default "http://localhost:8080")
--sensu-ca-cert string The Sensu Go CA Certificate
-p, --ssl-pem-path string The Chef SSL pem file use when querying the Chef Server API
-s, --ssl-verify If the SSL certificate will be verified when querying the Chef Server API (default true)
Assets are the best way to make use of this handler. 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/sensu-chef-handler
If you're using an earlier version of sensuctl, you can download the asset
definition from this project's Bonsai Asset Index
page.
Create the handler using the following handler definition:
---
api_version: core/v2
type: Handler
metadata:
namespace: default
name: sensu-chef-handler
spec:
type: pipe
command: sensu-chef-handler
timeout: 10
env_vars:
- CHEF_ENDPOINT=https://api.chef.io/organizations/replace-me
- CHEF_CLIENT_NAME=your-chef-client
- CHEF_CLIENT_KEY_PATH=/path/to/chef/client.pem
- SENSU_API_URL=https://sensu-backend-url:8080
- SENSU_API_KEY=sensu-api-key-here
filters:
- is_incident
runtime_assets:
- sensu/sensu-chef-handler
and then add the handler to the keepalive handler set:
---
api_version: core/v2
type: Handler
metadata:
name: keepalive
namespace: default
spec:
handlers:
- sensu-chef-handler
type: set
No check definition is needed. This handler will only trigger on keepalive
events after it is added to the keepalive handler set.
When querying Chef for a node, by default, Sensu will use the Sensu entity’s
name for the Chef node name. Individual Sensu entities can override the name of
their corresponding Chef node, using annotations:
# /etc/sensu/agent.yml example
annotations:
sensu.io/plugins/sensu-chef-handler/config/node-name: webserver01.example.com
Download the latest version of the sensu-chef-handler from releases,
or create an executable script from this source.
From the local path of the sensu-chef-handler repository:
go build -o /usr/local/bin/ .
To contribute to this plugin, see CONTRIBUTING
Please describe the reason for reporting this asset. Our moderators will be notified and will disable the asset if it is found to be inappropriate.
×