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
41 stars 14 forks source link

No dashboards detected #13

Open javiermarcon opened 8 years ago

javiermarcon commented 8 years ago

I installed grafana Alerts (grafana_alerts-1.0.0.dev7.tar.gz) with pip and configured it, but it first gave me this error:

javier@javier-System-Product-Name:~/prueba/monitoreo$ grafanaalerts [] None Traceback (most recent call last): File "/usr/local/bin/grafanaalerts", line 11, in sys.exit(main()) File "/usr/local/lib/python2.7/dist-packages/grafana_alerts/init.py", line 12, in main return the_launcher.launch() File "/usr/local/lib/python2.7/dist-packages/grafana_alerts/launcher.py", line 16, in launch alert_checker.check() File "/usr/local/lib/python2.7/dist-packages/grafana_alerts/alerting.py", line 40, in check for d in dashboard_data_list: TypeError: 'NoneType' object is not iterable javier@javier-System-Product-Name:~/prueba/monitoreo$

I solved it replacing lines 39 and 40 of alerting.py with:

    print dashboard_data_list
    if not dashboard_data_list:
        return
    for d in dashboard_data_list:

But grafanaalerts does not recognize the dashboards, it allways claim that there are no dashboards and I have 2 unstarred dashboards (and no starred dashboards).

javiermarcon commented 8 years ago

I forgot to mention that if I markthe dashboards as starred, I get the same result. I am using grafana/grafana docker image that runs grafana 2.5 with port 3000 exposed.

The output of grafanaalerts is:

javier@javier-System-Product-Name:~/prueba/monitoreo$ grafanaalerts [] None javier@javier-System-Product-Name:~/prueba/monitoreo$

javiermarcon commented 8 years ago

If I manually run the http query of DashboardScanner::obtain_dashboards() I get:

javier@javier-System-Product-Name:~/prueba/monitoreo$ curl -H "Authorization: Bearer eyJrIjoiaGZ6YjNDRzRwdGExQmhnbzhRbEdFQXVxVTZZTzBITHkiLCJuIjoiZ3JhZmFuYS1lZGl0b3IiLCJpZCI6MX0=" http://127.0.0.1:3000/api/search?limit=10&query=&tag=monitored [1] 17717 [2] 17718 javier@javier-System-Product-Name:~/prueba/monitoreo$ [{"id":1,"title":"Datos de servers","uri":"db/datos-de-servers","type":"dash-db","tags":[],"isStarred":false},{"id":2,"title":"Valores_individuales para uptime robot","uri":"db/valores_individuales-para-uptime-robot","type":"dash-db","tags":[],"isStarred":false}]

vmironenko commented 8 years ago

I think you didn't mark dashboards with the tag "monitored" : "Dashboards to be monitored for alerts must be marked with the tag "monitored""

javiermarcon commented 8 years ago

Thanks, I can't find the option to mark the dashboards as monitored. is there a tutorial?

Thanks,

Javier.

El 13/11/15 a las 00:15, VMironenko escribió:

I think you didn't mark dashboards with the tag "monitored" : "Dashboards to be monitored for alerts must be marked with the tag "monitored""

— Reply to this email directly or view it on GitHub https://github.com/pabloa/grafana-alerts/issues/13#issuecomment-156310990.

moandcompany commented 8 years ago

I think the error is at #160 of alerting.py DashboardScanner.obtain_dashboards() when used with Grafana 2.5.x+

dashboards = jmespath.search('dashboards', data)

The returned object from the DashboardScanner is None because it is searching for a field dashboards that is not contained within the Grafana server response. It is possible this was changed since prior Grafana versions. The relevant field for Grafana 2.5.x+ appears to be "type":"dash-db"

There appear to be a bunch of other field name changes downstream too

Update: many of these errors appear to occur for Grafana 2.0.2+ and later)

vtaneeru commented 8 years ago

@moandcompany Tried looking for "dash-db". But it didn't work. What field should we look for in json?