https://docs.sensu.io/sensu-go/5.2/
https://blog.sensu.io/alert-fatigue-part-1-avoidance-and-course-correction
Published checks are run on a schedule by the sensu scheduler.
Un-published checks are ignored by the scheduler, but they can be run on demand using the API or by another check as part of it's remediation configuration. See automating triage
Bonsai is the registry of checks and handlers.
sudo curl https://raw.githubusercontent.com/sensu-plugins/sensu-plugins-cpu-checks/03a99bab0237c81121ce702b0c5a5a3b44908535/bin/check-cpu.sh \
-o /usr/local/bin/check-cpu.sh && \
sudo chmod +x /usr/local/bin/check-cpu.sh
sensuctl check create check-cpu \
--command 'check-cpu.sh -w 75 -c 90' \
--interval 60 \
--subscriptions linux
sudo curl https://raw.githubusercontent.com/sensu/sensu-go/5.1.0/examples/checks/http_check.sh \
-o /usr/local/bin/http_check.sh && \
sudo chmod +x /usr/local/bin/http_check.sh
check.json
{
"type": "CheckConfig",
"api_version": "core/v2",
"metadata": {
"name": "check-http",
"namespace": "default"
},
"spec": {
"command": "http_check.sh https://sensu.io",
"interval": 60,
"proxy_entity_name": "sensu-site",
"publish": true,
"subscriptions": [
"proxy"
]
}
}
sensuctl create --file check.json
Add the subscription to an agent.
subscriptions:
- "proxy"
sudo service sensu-agent restart
https://packagecloud.io/sensu/community
curl -s https://packagecloud.io/install/repositories/sensu/community/script.rpm.sh | sudo bash
sudo yum install sensu-plugins-ruby-0.2.0-1.el7.x86_64
Subscribe agent to checks
agent configuration
On the host running the agent; edit the subscriptions to match the desired checks.
sudo vi /etc/sensu/agent.yml
sudo systemctl restart sensu-agent
round robin checks
In Sensu core, adding the prefix "roundrobin:" to the subscription will make it a round robin check. E.g. roundrobin:webserver.
See round_robin on https://docs.sensu.io/sensu-go/5.3/reference/checks/#spec-attributes
Sensu-core docs: https://docs.sensu.io/sensu-core/1.1/reference/clients/#round-robin-client-subscriptions