pabloa / grafana-alerts

Grafana Alerts - Alerts generated using metrics from Grafana dashboards - This project is looking for a maintainer. Send me a message if you are interested.
Other
40 stars 14 forks source link

target key error #8

Closed flyersa closed 2 years ago

flyersa commented 9 years ago

Hi Pabloa,

after the update its stil there, just with target now instead of hide:

Hi,

checked out latest from git and now its another error, same but not with hide but "target"

grafanaAlerts {"dashboards":[{"id":8,"title":"Berlin Office","slug":"berlin-office","tags":["monitored"],"isStarred":false}],"tags":[],"tagsOnly":false} [{u'slug': u'berlin-office', u'tags': [u'monitored'], u'isStarred': False, u'id': 8, u'title': u'Berlin Office'}] Dashboard: Berlin Office Contents is: {"meta":{"isStarred":false,"isHome":false,"isSnapshot":false,"slug":"berlin-office","expires":"0001-01-01T00:00:00Z","created":"0001-01-01T00:00:00Z"},"model":{"annotations":{"list":[]},"editable":true,"hideControls":false,"id":8,"nav":[{"collapse":false,"enable":true,"notice":false,"now":true,"refresh_intervals":["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"],"status":"Stable","time_options":["5m","15m","1h","6h","12h","24h","2d","7d","30d"],"type":"timepicker"}],"originalTitle":"Berlin Office","refresh":"5m","rows":[{"collapse":false,"editable":true,"height":"250px","panels":[{"aliasColors":{},"bars":false,"datasource":null,"decimals":2,"editable":true,"error":false,"fill":1,"grid":{"leftLogBase":1,"leftMax":null,"leftMin":null,"rightLogBase":1,"rightMax":null,"rightMin":null,"threshold1":27,"threshold1Color":"rgba(234, 93, 8, 0.27)","threshold2":30,"threshold2Color":"rgba(241, 0, 0, 0.22)","thresholdLine":false},"height":"500","id":1,"legend":{"alignAsTable":true,"avg":false,"current":true,"max":true,"min":true,"rightSide":true,"show":true,"total":false,"values":true},"lines":true,"linewidth":2,"links":[],"nullPointMode":"connected","percentage":false,"pointradius":5,"points":false,"renderer":"flot","seriesOverrides":[],"span":12,"stack":false,"steppedLine":false,"targets":[{"alias":"Temperatur","column":"temperature","condition":"","function":"mean","groupby_field":"temperature","interval":"","query":"select temperature from \"homatic\" where $timeFilter","rawQuery":true,"series":"logstash"}],"timeFrom":null,"timeShift":null,"title":"Serverroom Temperature","tooltip":{"shared":false,"value_type":"cumulative"},"type":"graph","x-axis":true,"y-axis":true,"y_formats":["celsius","short"]},{"content":"x\u003c=35; critical; enrico.kern@glispamedia.com","editable":true,"error":false,"id":3,"links":[],"mode":"markdown","span":3,"style":{},"title":"alerts","type":"text"}],"title":"Row"},{"collapse":false,"editable":true,"height":"250px","panels":[{"aliasColors":{},"bars":false,"datasource":null,"editable":true,"error":false,"fill":1,"grid":{"leftLogBase":1,"leftMax":null,"leftMin":null,"rightLogBase":1,"rightMax":null,"rightMin":null,"threshold1":null,"threshold1Color":"rgba(216, 200, 27, 0.27)","threshold2":null,"threshold2Color":"rgba(234, 112, 112, 0.22)"},"height":"300","id":2,"legend":{"alignAsTable":true,"avg":false,"current":true,"max":true,"min":true,"rightSide":true,"show":true,"total":false,"values":true},"lines":true,"linewidth":2,"links":[],"nullPointMode":"connected","percentage":false,"pointradius":5,"points":false,"renderer":"flot","seriesOverrides":[],"span":12,"stack":false,"steppedLine":false,"targets":[{"alias":"Humidy","column":"value","function":"mean","query":"select humidy from \"homatic\" where $timeFilter","rawQuery":true}],"timeFrom":null,"timeShift":null,"title":"Humidity","tooltip":{"shared":false,"value_type":"cumulative"},"type":"graph","x-axis":true,"y-axis":true,"y_formats":["humidity","short"]}],"title":"New row"}],"schemaVersion":6,"sharedCrosshair":false,"style":"dark","tags":["office","in-house","monitored"],"templating":{"list":[]},"time":{"from":"now-6h","to":"now"},"timezone":"browser","title":"Berlin Office","version":17}} [{u'bars': False, u'timeFrom': None, u'links': [], u'height': u'500', u'renderer': u'flot', u'linewidth': 2, u'steppedLine': False, u'id': 1, u'fill': 1, u'span': 12, u'title': u'Serverroom Temperature', u'tooltip': {u'shared': False, u'value_type': u'cumulative'}, u'legend': {u'rightSide': True, u'total': False, u'min': True, u'max': True, u'show': True, u'current': True, u'values': True, u'alignAsTable': True, u'avg': False}, u'targets': [{u'function': u'mean', u'groupby_field': u'temperature', u'rawQuery': True, u'column': u'temperature', u'series': u'logstash', u'interval': u'', u'alias': u'Temperatur', u'query': u'select temperature from "homatic" where $timeFilter', u'condition': u''}], u'seriesOverrides': [], u'percentage': False, u'type': u'graph', u'x-axis': True, u'error': False, u'editable': True, u'grid': {u'leftMax': None, u'threshold2': 30, u'rightLogBase': 1, u'rightMax': None, u'threshold1': 27, u'leftLogBase': 1, u'thresholdLine': False, u'threshold2Color': u'rgba(241, 0, 0, 0.22)', u'rightMin': None, u'threshold1Color': u'rgba(234, 93, 8, 0.27)', u'leftMin': None}, u'nullPointMode': u'connected', u'stack': False, u'y-axis': True, u'timeShift': None, u'aliasColors': {}, u'lines': True, u'points': False, u'datasource': None, u'pointradius': 5, u'decimals': 2, u'y_formats': [u'celsius', u'short']}, {u'style': {}, u'span': 3, u'links': [], u'title': u'alerts', u'editable': True, u'content': u'x<=35; critical; enrico.kern@glispamedia.com', u'mode': u'markdown', u'error': False, u'type': u'text', u'id': 3}] {u'bars': False, u'timeFrom': None, u'links': [], u'height': u'500', u'renderer': u'flot', u'linewidth': 2, u'steppedLine': False, u'id': 1, u'fill': 1, u'span': 12, u'title': u'Serverroom Temperature', u'tooltip': {u'shared': False, u'value_type': u'cumulative'}, u'legend': {u'rightSide': True, u'total': False, u'min': True, u'max': True, u'show': True, u'current': True, u'values': True, u'alignAsTable': True, u'avg': False}, u'targets': [{u'function': u'mean', u'groupby_field': u'temperature', u'rawQuery': True, u'column': u'temperature', u'series': u'logstash', u'interval': u'', u'alias': u'Temperatur', u'query': u'select temperature from "homatic" where $timeFilter', u'condition': u''}], u'seriesOverrides': [], u'percentage': False, u'type': u'graph', u'x-axis': True, u'error': False, u'editable': True, u'grid': {u'leftMax': None, u'threshold2': 30, u'rightLogBase': 1, u'rightMax': None, u'threshold1': 27, u'leftLogBase': 1, u'thresholdLine': False, u'threshold2Color': u'rgba(241, 0, 0, 0.22)', u'rightMin': None, u'threshold1Color': u'rgba(234, 93, 8, 0.27)', u'leftMin': None}, u'nullPointMode': u'connected', u'stack': False, u'y-axis': True, u'timeShift': None, u'aliasColors': {}, u'lines': True, u'points': False, u'datasource': None, u'pointradius': 5, u'decimals': 2, u'y_formats': [u'celsius', u'short']} graph {u'style': {}, u'span': 3, u'links': [], u'title': u'alerts', u'editable': True, u'content': u'x<=35; critical; enrico.kern@glispamedia.com', u'mode': u'markdown', u'error': False, u'type': u'text', u'id': 3} text [{u'bars': False, u'timeFrom': None, u'links': [], u'height': u'300', u'renderer': u'flot', u'linewidth': 2, u'steppedLine': False, u'id': 2, u'fill': 1, u'span': 12, u'title': u'Humidity', u'tooltip': {u'shared': False, u'value_type': u'cumulative'}, u'legend': {u'rightSide': True, u'total': False, u'min': True, u'max': True, u'show': True, u'current': True, u'values': True, u'alignAsTable': True, u'avg': False}, u'targets': [{u'column': u'value', u'alias': u'Humidy', u'function': u'mean', u'rawQuery': True, u'query': u'select humidy from "homatic" where $timeFilter'}], u'seriesOverrides': [], u'percentage': False, u'type': u'graph', u'x-axis': True, u'error': False, u'editable': True, u'grid': {u'leftMax': None, u'threshold2': None, u'rightLogBase': 1, u'rightMax': None, u'threshold1': None, u'leftLogBase': 1, u'threshold2Color': u'rgba(234, 112, 112, 0.22)', u'rightMin': None, u'threshold1Color': u'rgba(216, 200, 27, 0.27)', u'leftMin': None}, u'nullPointMode': u'connected', u'stack': False, u'y-axis': True, u'timeShift': None, u'aliasColors': {}, u'lines': True, u'points': False, u'datasource': None, u'pointradius': 5, u'y_formats': [u'humidity', u'short']}] {u'bars': False, u'timeFrom': None, u'links': [], u'height': u'300', u'renderer': u'flot', u'linewidth': 2, u'steppedLine': False, u'id': 2, u'fill': 1, u'span': 12, u'title': u'Humidity', u'tooltip': {u'shared': False, u'value_type': u'cumulative'}, u'legend': {u'rightSide': True, u'total': False, u'min': True, u'max': True, u'show': True, u'current': True, u'values': True, u'alignAsTable': True, u'avg': False}, u'targets': [{u'column': u'value', u'alias': u'Humidy', u'function': u'mean', u'rawQuery': True, u'query': u'select humidy from "homatic" where $timeFilter'}], u'seriesOverrides': [], u'percentage': False, u'type': u'graph', u'x-axis': True, u'error': False, u'editable': True, u'grid': {u'leftMax': None, u'threshold2': None, u'rightLogBase': 1, u'rightMax': None, u'threshold1': None, u'leftLogBase': 1, u'threshold2Color': u'rgba(234, 112, 112, 0.22)', u'rightMin': None, u'threshold1Color': u'rgba(216, 200, 27, 0.27)', u'leftMin': None}, u'nullPointMode': u'connected', u'stack': False, u'y-axis': True, u'timeShift': None, u'aliasColors': {}, u'lines': True, u'points': False, u'datasource': None, u'pointradius': 5, u'y_formats': [u'humidity', u'short']} graph [<grafana_alerts.alerting.AlertChecker instance at 0xcf8fc8>, <grafana_alerts.alerting.AlertChecker instance at 0xcf8290>] Traceback (most recent call last): File "/usr/bin/grafanaAlerts", line 9, in load_entry_point('grafana-alerts==1.0.0.dev7', 'console_scripts', 'grafanaAlerts')() File "/usr/lib/python2.6/site-packages/grafana_alerts-1.0.0.dev7-py2.6.egg/grafana_alerts/init.py", line 12, in main return the_launcher.launch() File "/usr/lib/python2.6/site-packages/grafana_alerts-1.0.0.dev7-py2.6.egg/grafana_alerts/launcher.py", line 16, in launch alert_checker.check() File "/usr/lib/python2.6/site-packages/grafana_alerts-1.0.0.dev7-py2.6.egg/grafana_alerts/alerting.py", line 50, in check alert_checker.check() File "/usr/lib/python2.6/site-packages/grafana_alerts-1.0.0.dev7-py2.6.egg/grafana_alerts/alerting.py", line 100, in check target = grafana_target['target'] KeyError: 'target'

pabloa commented 9 years ago

Hello flyersa,

I think it is related to the datasource type. Where are the data store it? Graphite? InfluxDb? I tested grafana-alerts with graphite. But it seems grafana queries are different if the datasource is, for example, InfluxDb.

Please let me know to confirm the issue.

koksan83 commented 9 years ago

Hi pabloa,

I'm experiencing the same issue and I'm on Grafana with InfluxDB 0.8.8 with stats from cAdvisor.

pabloa commented 9 years ago

Hello Koksan83. Thank you for the feedback. I am changing this issue from bug to new feature. I think it is safe to work on this using http://play.grafana.org/dashboard/db/influxdb

flyersa commented 9 years ago

yeah also using it with influxdb 0.8