6

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.

Mike
  • 21,910
  • 7
  • 55
  • 79

7 Answers7

9

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.

  • Log in to Redis CLI redis-cli
  • Execute keys *server_name* to list all checks related to the server in question
  • type smembers 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.

Dan Bowling
  • 309
  • 1
  • 3
  • 12
jonh
  • 106
  • 1
  • 4
3

Latest Uchiwa can do that itself http://docs.uchiwa.io/en/latest/features/deleting-check-results/

ipeacocks
  • 321
  • 1
  • 3
  • 10
1

In case anyone comes to this and wants to do the same WITHOUT flushing the entire Redis DB, you can do the following:

  • Log into redis (redis-cli from the command line)
  • Execute "keys *" to list all the keys
  • Locate both the history key and the execution key for the server / check combination that you want to delete

Example: Client: SomeServer, check: check_nginx

Commands to run:

del execution:SomeServer:check_nginx
del history:SomeServer:check_nginx
1

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-delete

And this can also be done from uchiwa: https://docs.uchiwa.io/reference/clients/#request-to-delete-check-result-data

0

So turns out you can't. You have to issue a flushall in redis

Mike
  • 21,910
  • 7
  • 55
  • 79
0

A 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.

  • its not to resolve a check.. if I added a check to a host and then deleted it.. it was still there and the way I wad told to handle it by a developer was to flush redis – Mike Nov 16 '14 at 21:13
0

I want to add onto JonH's answer above:

You can find all the keys and checks via redis-cli:

keys *:*:name_of_check

and then go through and (e.g.)

del history:hostname:name_of_check

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!

E.Z.
  • 1
  • 1