From the talk Chris Chandler, Principal Engineer at T-Mobile, gave at Sensu Summit 2018:
We all know and love sensu-client, but there are some times where deploying the client is either sub-optimal (e.g.: a box you don’t control) or impossible (e.g.: appliances, 3rd party services).
I opted to tackle these kind of challenges Serverless-style, running my own code, then shipping the check outcome to the /results API.
Some reasons for going this route include:
- Sometimes you simply need to do more than the community plugins offer, which means you’re already writing custom code anyway. All you need to do is do a POST to the /results API, and boom.
- I didn’t want to manage “bastion” clients that do proxy client style monitors, because I don’t live in a world where I can run Configuration Management tools against boxes at-will. Running in a PaaS/Serverless mode gave me more autonomy to iterate.
- Checks can be more dynamic vs having to re-run Configuration Management to change sensu-client configs. For example, I can pull a list of service endpoints from Service Registry in real-time, then iterate that list in your code. Having to re-trigger Ansible/Chef/Puppet when endpoints light up/die would cause a lot of churn in highly dynamic environments.
19. High-Level Monitoring Logic
1. Get all services in Consul via REST API
2. For each service, inspect nodes for IP and
ServicePort
3. If URI in metadata, add that to IP + Port
4. Poll HTTP endpoint
5. Send results to Sensu’s /results API
6. Delete any Sensu proxy clients that are no longer
registered in Consul
22. Self-Service via Metadata
• Devs can use Consul’s “ServiceMeta” to specify:
• Dependencies
• Subdue
• Handlers
• TTL
• Routing/contact info (e.g.: PagerDuty API key)
• URI to check
• $your_idea_here
24. Some caveats...
• No keepalives with proxy clients
• Use TTL in check payload
• Best if run in PaaS/FaaS/Container platform
• Reachability of servers
25.
26. Other Possibilities
• By passing a “type” k/v pair in the metadata,
you can specify what type of service this is:
• SNMP
• DBs
• $your_service_here