sensu / sensu-plugin-sdk

A framework for creating Sensu plugins
MIT License
7 stars 8 forks source link

How to keep a state between two handler's executions? #80

Open r00ta opened 2 years ago

r00ta commented 2 years ago

Hi Sensu team,

I see that the handler execution is stateless, but in some use cases it's useful to keep a state between two executions. Is there any existing solution for this use case?

If not, do you think it's something that might be implemented in the future?

Thank you

echlebek commented 1 year ago

I think that generally, the retention of state between handler executions will be quite specific to the handler in question, and I don't see a useful way to support it in the SDK.

As to how it's implemented: I'd expect handlers to have a string config option that specifies a path to a state file, with the handler using its own logic for determining what that state means.