Hi!
I setup sensu for some monitoring years ago and it’s been left to rot a little so i’m just starting to look at re-doing it.
Obviously sensu-go has come along in the meantime, which looks good, so i’ve got an install of that to tests with.
I wonder what people are doing with regards to automation and configuration management of sensu checks/config?
What I used to do with the old sensu is all my checks were added by ansible when provisioning hosts. As I provisioned a host, ansible would go to the sensu server and add the appropriate checks (like ping checks for the host, checks on the ports for the applicable services, website checks for web servers, resolving tests for nameservers etc. It did this by dropping the appropriate JSON files in to /etc/sensu/conf.d on the sensu box.
Looking at the new documentation for Sensu Go, the documentation all resolves around the sensuctl command - which is brilliant as a user interface, but not for automation.
I expected to see both interfaces documentation, but the docs don’t seem to give any JSON examples anymore.
Am I missing something? - how are people automating their checks, handlers etc with Sensu Go?
Thanks,
Ian
Hi, you should use sensu-go ansible collection for that: https://github.com/sensu/sensu-go-ansible and
this are tasks an from ansible playbook which worked for me:
first you install plugin assets on your backend, but run playbook against agent server, {{url}} is your backend hostname/address, $url is url for asset, you can find it in the asset definition, sorry i’m new to this forum and have limit for number of url’s in a post :
- name: ubuntu ruby-runtime
asset:
auth:
user: admin
password: P@ssw0rd!
url: “{{ url }}”
name: sensu-ruby-runtime-2.4.4-debian
builds:
- url: $url
sha512: a28952fd93fc63db1f8988c7bc40b0ad815eb9f35ef7317d6caf5d77ecfbfd824a9db54184400aa0c81c29b34cb48c7e8c6e3f17891aaf84cafa3c134266a61a
filters:
- entity.system.os == ‘linux’
- entity.system.arch == ‘amd64’
- entity.system.platform_family == ‘debian’
- name: ubuntu ruby-runtime
asset:
auth:
user: admin
password: P@ssw0rd!
url: “{{ url }}”
name: sensu-plugins-disk-checks
builds:
- url: $url
sha512: 3864761b6bff79407173db3b849ffb974dfd521c279f4f7ec251f533c85eb1e400d7f8794bf8d79ca247d8f0b4592225103dfea59b3bfa44d06ef67d0f871b09
filters:
- entity.system.os == ‘linux’
- entity.system.arch == ‘amd64’
- entity.system.platform_family == ‘debian’
after you deploy the check itself to the agent server:
- name: Deploy disk usage checks
check:
name: check_disk_usage_new_rb2
auth:
user: admin
password: P@ssw0rd!
url: “{{ url }}”
command: check-disk-usage.rb -c 90
runtime_assets:
- sensu-plugins-disk-checks
- sensu-ruby-runtime-2.4.4-debian
subscriptions:
- linux
interval: 10
publish: yes
Thanks!
I’m in the process of moving to saltstack now instead of ansible, but i’ll have to have a play.
Ian