The theory of writing checks is intentionally rather simple. While you can do many, many different things, a check is basically
any executable script
that returns 0 if all is fine (OK)
that returns 1 if there is something that might be a problem (WARN)
that returns 2 if there is a critical flaw (CRITICAL)
that may return any other exit code for different results (UNKNOWN)
A check that produces a metric will also
- write the metric(s) to stdout in graphite syntax (some.metric.name.grouped.by.dots float unix_timestamp, e.g. kronos.sensors.coretemp-isa-0000.core1 34.0 1489162933)
These scripts do not have to be in Ruby, but it would preferable since they’ll be accepted should you want to contribute yours to the community repositories (and we’d like you to )
I think I’m also supposed to mention this: https://github.com/sensu-plugins/sensu-plugin ; it’s a framework so you don’t need to write all the code yourself - however I’ve not used it in depth yet.
On Friday, May 5, 2017 at 7:27:53 AM UTC+2, Kaye wrote:
We would just like to seek for your expert opinion.
We have a Sensu and ELK Stack integration project and we need to create a Sensu check that will parse a raw XML file to convert its output as a metric. Then, we can send this output directly to Elastic Stack thru logstash. We wanted to fully utilize the capability of Sensu and do all the alerting in it which is why we can’t consider parsing the XML directly in logstash.
We are beginners in Ruby and we are not really sure how to start writing a custom plugin/check. We’d truly appreciate if anyone can guide us on where to start. Thanks in advanced!