Error when running grafanaAlerts command
we're using grafana 2.0.3-pre1, commit: v2.0.2+3-g2c52224 ; and grafanaAlerts 1.0.0.dev7
when I run in console grafanaAlerts command, I receive error:
[<grafana_alerts.alerting.AlertChecker instance at 0x1a30290>]
Traceback (most recent call last):
File "/usr/local/bin/grafanaAlerts", line 9, in
whet does it mean?, thanks :)
P.S.
here is full output:
:~# grafanaAlerts
{"dashboards":[{"id":11,"title":"testalerts","slug":"testalerts","tags":["monitored"],"isStarred":false}],"tags":[],"tagsOnly":false}
[{u'slug': u'testalerts', u'tags': [u'monitored'], u'isStarred': False, u'id': 11, u'title': u'testalerts'}]
Dashboard: testalerts
Contents is:
{"meta":{"isStarred":false,"isHome":false,"isSnapshot":false,"slug":"testalerts","expires":"0001-01-01T00:00:00Z","created":"0001-01-01T00:00:00Z"},"model":{"annotations":{"list":[]},"editable":true,"hideControls":false,"id":11,"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":"testalerts","rows":[{"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)"},"id":1,"legend":{"avg":false,"current":false,"max":false,"min":false,"show":true,"total":false,"values":false},"lines":true,"linewidth":2,"links":[],"nullPointMode":"connected","percentage":false,"pointradius":5,"points":false,"renderer":"flot","seriesOverrides":[],"span":6,"stack":false,"steppedLine":false,"targets":[{"target":"host.cpu.percent-user"}],"timeFrom":null,"timeShift":null,"title":"CPU-MYSQL","tooltip":{"shared":true,"value_type":"cumulative"},"type":"graph","x-axis":true,"y-axis":true,"y_formats":["short","short"]},{"content":"1\u003c=x\u003c=10; warning; [email protected]\n\n15\u003cx\u003c40; normal; [email protected]\n\nx\u003c=15; critical; [email protected]","editable":true,"error":false,"id":2,"links":[],"mode":"text","span":6,"style":{},"title":"alerts","type":"text"}],"title":"Row"}],"schemaVersion":6,"sharedCrosshair":false,"style":"dark","tags":["monitored"],"templating":{"list":[]},"time":{"from":"now-6h","to":"now"},"timezone":"browser","title":"testalerts","version":11}}
[{u'bars': False, u'timeFrom': None, u'links': [], u'nullPointMode': u'connected', u'renderer': u'flot', u'id': 1, u'linewidth': 2, u'steppedLine': False, u'targets': [{u'target': u'host.cpu.percent-user'}], u'fill': 1, u'span': 6, u'title': u'CPU-MYSQL', u'tooltip': {u'shared': True, u'value_type': u'cumulative'}, u'legend': {u'total': False, u'show': True, u'max': False, u'min': False, u'current': False, u'values': False, u'avg': False}, 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'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'short', u'short']}, {u'style': {}, u'span': 6, u'links': [], u'title': u'alerts', u'editable': True, u'content': u'1<=x<=10; warning; [email protected]\n\n15<x<40; normal; [email protected]\n\nx<=15; critical; [email protected]', u'mode': u'text', u'error': False, u'type': u'text', u'id': 2}]
{u'bars': False, u'timeFrom': None, u'links': [], u'nullPointMode': u'connected', u'renderer': u'flot', u'id': 1, u'linewidth': 2, u'steppedLine': False, u'targets': [{u'target': u'host.cpu.percent-user'}], u'fill': 1, u'span': 6, u'title': u'CPU-MYSQL', u'tooltip': {u'shared': True, u'value_type': u'cumulative'}, u'legend': {u'total': False, u'show': True, u'max': False, u'min': False, u'current': False, u'values': False, u'avg': False}, 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'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'short', u'short']}
graph
{u'style': {}, u'span': 6, u'links': [], u'title': u'alerts', u'editable': True, u'content': u'1<=x<=10; warning; [email protected]\n\n15<x<40; normal; [email protected]\n\nx<=15; critical; [email protected]', u'mode': u'text', u'error': False, u'type': u'text', u'id': 2}
text
[<grafana_alerts.alerting.AlertChecker instance at 0x1d26290>]
Traceback (most recent call last):
File "/usr/local/bin/grafanaAlerts", line 9, in
Hello Tetlika,
grafana-alerts is trying to make a HTTP Post to:
http://yourHost:youPort/api/datasources/proxy/1/render
with parameters:
target={target}&from=-60s&until=now&format=json&maxDataPoints=100
Did you set the grafana token? It is the parameter grafana_token in /etc/grafana_alerts/grafana_alerts.cfg
I did not test it with grafana 2.0.3. Please let me know hot it goes.
hey Pabloa, yes of course, the token is set (viewer permissions) , if it was not configured I would receive permission denied error
P.S
with what versions of grafana have you tested your software?
thanks
hey Pabloa, looks I've managed to fix the problem by doing this:
#_GRAFANA_URL_PATH_OBTAIN_METRICS = 'api/datasources/proxy/1/render' _GRAFANA_URL_PATH_OBTAIN_METRICS = 'api/datasources/proxy/2/render'
in alerting.py file, I think the problem is that datasource id in our case was 2 and not 1