Skip to content

Instantly share code, notes, and snippets.

@john-auld
Last active March 13, 2019 19:48
Show Gist options
  • Save john-auld/13243616273fcea6c95300517ccc1ae7 to your computer and use it in GitHub Desktop.
Save john-auld/13243616273fcea6c95300517ccc1ae7 to your computer and use it in GitHub Desktop.
Sensu Go
@john-auld
Copy link
Author

john-auld commented Mar 10, 2019

Sensu checks

Bonsai is the registry of checks and handlers.

Create check from a script

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

source

Monitor an external resource (proxy entity)

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

source

Sensu ruby plugin install

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment