Hello everybody,
I am using the sensu module for puppet to monitor all my hosts.
Now I’d like to add a ping test (sensu-plugins-network-checks/check-ping.rb at master · sensu-plugins/sensu-plugins-network-checks · GitHub) so that every registered host is being pinged by the sensu backend.
Has anybody done this before? How can I tell the sensu-backend to ping all those hosts?
Thanks for every hint
I just saw in the docs that I could make use of proxy_requests
. Is there any example of how to solve this using puppet and the ping-scenario?
hey,
I’m not sure the complexity of proxy requests is what you want. If all the registered hosts managed by puppet are running Sensu agents, the Sensu agents provide a keepalive event so if the sensu agent stops responding (and you don’t have auto deregistration enabled for that agent) the keepalive will result in a non zero status after a timeout. Is there a specific reason why the keepalive event isn’t sufficient logic for your situation?
Hi,
I am already sending messages via slack if keep alive is missing for 120sec. But we had currently the scenario where hosts were sending keepalive but ping had a package loss of 30%. I hope to get this into our Sensu monitoring somehow.
hmmm
And you don’t want to ping out from the agents right? You want to ping all the entities registered in Sensu from a central pinger?
Okay to do this with proxy-requests I think you’ll want to follow a pattern like this:
-
run a centralized agent subscribed to a special subscription that non of the remote agents you want to ping subscribe to (Ex: proxy-ping)
-
Create a proxy-ping check patterned like this
---
type: CheckConfig
api_version: core/v2
metadata:
name: proxy-ping
spec:
command: check-ping.rb ---host {{ .annotations.ping-host }}
interval: 60
proxy_requests:
entity_attributes:
- entity.entity_class == 'agent'
- entity.annotations.ping-enabled == 'true'
publish: true
runtime_assets:
- sensu-plugins-network-checks
- sensu-ruby-runtime
subscriptions:
- proxy-ping
This pattern instructs your centralized agent with subscription proxy-ping to run this check for each registered entity that matches the specified entity conditions: the entity is an agent
and has ping-enabled
annotation set to true
- make sure all the agents you want to ping with necessary annotations to drive the ping check. In my example pattern above you’d need the
proxy-host
and ping-enabled
annotation set with correct string values. Also make sure that none of the remote agents you want to ping are subscribed to proxy-ping subscription. You only want the centralized agent running on the same host as the sensu-backend participating in that subscription, its the only agent running the check.