Sensu check results history

2k views Asked by At

I need history of "output" attribute for one check, but exploring Redis i understand that Sensu stores complete results of check only for last check execution? And history of status codes, but it is not important for me now.

I have come with solution to create handler for check, which will add check results to Redis with timestamp as a key. And later have a script which extracts data from Redis.

Is there any simpler way to do this?

Thanks for help :)

2

There are 2 answers

4
Enrique Arriaga On BEST ANSWER

Without using handlers, you could take a look at the output, return values, and get more information about the results, from the logs: /var/log/sensu/sensu-server.log. If you want to make something sophisticated, I think you need to use the API: https://sensuapp.org/docs/latest/api-results.

The API /results/:client/:check (GET) returns "output": "WARNING Found 0 matching processes\n",

0
miki On

Ok, i have understood everything i asked in a question, and i will give some explanations for future readers.

Sensu stores in Redis only last check results and history of exit codes for that check. By @Enrique Arriaga answer, there is log file in Sensu where history of ALL checks is written. It can be used for extracting data, but it is not intended for user log.

User has option of using Handler, which is triggered after every check (metric handler is triggered after every run, but other handler types are triggered after exit code changes value from previous execution!) run and provided with check results. It is up to user to decide what to do with results, should he add data to log file, store data to Redis, or something else.