I created a test check and now I want it deleted. It doesn't seem to go away from the clients. I'm using uchima as a frontend and the check is no longer listed in
/checks
But if I view a client it still has the check.
The only way I found to delete the check is to delete the node and let it re-add itself. I have 300 clients and I'd rather not do that.
So recently encountered an issue where we deployed some sensu checks via ansible and they recreated existing checks with incorrect names. There would be nothing wrong with letting this go except it looks bad in the uchiwa interface. I followed steps above, but they must have been from an outdated version of sensu. Here are the modified steps I did to remove these checks.
redis-cli
keys *server_name*
to list all checks related to the server in questionsmembers result:server_name
srem result:server_name check_to_remove
del history:server_name:check_to_remove result:server_name:check_to_remove
This should remove the check completely from Redis, and then from sensu.
Latest Uchiwa can do that itself http://docs.uchiwa.io/en/latest/features/deleting-check-results/
In case anyone comes to this and wants to do the same WITHOUT flushing the entire Redis DB, you can do the following:
Example: Client: SomeServer, check: check_nginx
Commands to run:
Since sensu 0.21.0 there is a
DELETE /results/:client/:check
API which should help here. See docs here: https://sensuapp.org/docs/0.29/api/results-api.html#resultsclientcheck-deleteAnd this can also be done from uchiwa: https://docs.uchiwa.io/reference/clients/#request-to-delete-check-result-data
So turns out you can't. You have to issue a
flushall
in redisA flushall is extreme overkill to resolve a single check.
To resolve a single check, you can issue the "resolve" api call, or click the resolve button.
On my servers I have a cron job that iterates over all the events with sensu-cli and resolves any that last checked > 1 week ago to prevent deleted checks from clogging the dashboard.
I want to add onto JonH's answer above:
You can find all the keys and checks via redis-cli:
and then go through and (e.g.)
this will make searching for whichever nodes having the old check easier to sort through as the code above will print out only the servers and the specific check as opposed to keys * which will print out all keys.
Hope this helps!