-
Notifications
You must be signed in to change notification settings - Fork 66
[init] add optional client deregisration on stop #148
[init] add optional client deregisration on stop #148
Conversation
The deregistration handler was released in version 0.1.0 of sensu-plugins-sensu (see sensu-plugins/sensu-plugins-sensu#1) |
@@ -197,6 +197,12 @@ wait_for_stop() { | |||
return $stopped | |||
} | |||
|
|||
deregister_client() { | |||
log_action_msg "Deregistering sensu-client" | |||
echo "{ \"name\": \"api_call\", \"output\": \"delete\", \"process\": \"init\", \"user\": \"root\", \"status\": 2, \"handler\": \"${CLIENT_DEREGISTER_HANDLER}\"}" > \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this a warning (1
)? As the event will temporarily display via the API/Dashboard.
we're opting to use status '1' for warning so that deregistration events don't show up on dashboards
[init] add optional client deregisration on stop
@johntdyer Uchiwa allows event view to be filtered by status (e.g. warning, critical, unknown, all). You're right that using the warning status here does not fully hide these events. |
Yea, this is less then ideal for is because we want to see general warnings but we don't want to see deregister events cluttering up the dashboard Sent from mobile
|
@cwjohnston so how do you clear the warning alert on uchiwa ? |
@johntdyer This change to the init script only emits this deregistration event when the value of If you have enabled this behavior, you should also configure your Sensu server to process such events using the deregistration handler (shipped in sensu-plugins-sensu version 0.1.0). When this handler processes an event, it deletes the associated client via the Sensu API, which will, in turn, resolve any events associated with that client. |
@cwjohnston sorry to be so "dense" here but here is what I have I have added the handler in Sensu {
"handlers": {
"deregister": {
"type": "pipe",
"severities": [
"warning"
],
"command": "handler-sensu-deregister.rb"
}
}
} and then I degister an client and I see the following in the logs
|
I had the same issue as @johntdyer. More better solution is that to add 'interval: 1, refresh: 1' to deregister event json here: https://github.com/sensu/sensu-build/pull/148/files#diff-32a7b82f0e4d5b8e858da79847107666R202 Hope this will help. |
Provided that
CLIENT_DEREGISTER_ON_STOP
environment variable is set totrue
andCLIENT_DEREGISTER_HANDLER
is set toderegister
, the init script will send the following event to sensu-client on port 3030:This event is intended to be processed by the "deregister" handler.