Simple YAML & Graphite based monitoring script that notifies via NMA
Currently only the Graphite metric source is implemented. You can see an example configuration in config.yaml.
The basic principle on how to configure a new metric is this:
metrics:
cpu:
graphite:
host: http://mygraphiteserver/graph/
query: server.cpu_usageThis will make the variable "cpu" available to be used in your rules.
A simple rule that alerts if the cpu usage is above 60% works like this:
rules:
cpu_usage_high:
if: cpu > 60
message: "CPU usage is above 60% ({{cpu}}"message is any valid jinja2 template, all metric are available in the template, no matter which one was used in the if: block. Additionally the variable rule_name is available.
You can optionally set the urgency attribute which will be passed on to the notifications.
notifications:
NMA: # name of the notification, currently not used. Should be unique thought
notify_my_android: # notification type, currently the only implemented one
tokens: [ 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx' ] # list of tokens to notify
application: 'Revelation Online Status' # application var of NMA
event: 'Issue' # even var of NMA
description: '{% for (urgency, message) in messages %}{{message}}
{%endfor%}' # abitrary jinja2 template, messages is a tuple of the urgency and message generated by rules
url: 'http://graphite.rammhold.de/tessera/dashboards/6/revelation?from=-1h' # url to pass along with the notification, usually some way for the notified person to react/confirm the reported issue