I am working on creating my first check using the sensu plugin. I am calling a REST API, that returns a JSON file with an array of services names and the status that service is in. If the status is set to false, then I would send an alert.
I have all the logic working, what I am missing is how to not have the check exist when it finds one service down but has not finished looking at all the other services. I want to loop through all the services, and send an alert for any of the services that are down. It appears when you send critical “message” the check script will exit. I tried looking through various community plugins for an example of what I am trying to do but have not been able to find any.
The services that I pull back from the API can be dynamic, so passing the check script a list of services to check individually won’t work.
I notice that a metric check will not exit, if I changed the check to be a metric, is there a way to have a handler send an email if anything is marked critical, or do metric event handlers always send the output of the check no matter the results?