Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'NoneType' object is not iterable -- File "/usr/local/lib/python2.7/site-packages/grafana_alerts/alerting.py", line 40 #14

Open
vtaneeru opened this issue Jan 14, 2016 · 3 comments

Comments

@vtaneeru
Copy link

While runnung grafanaAlerts, we are getting below error:
Traceback (most recent call last):
File "/usr/local/bin/grafanaAlerts", line 9, in
load_entry_point('grafana-alerts==1.0.0.dev7', 'console_scripts', 'grafanaAlerts')()
File "/usr/local/lib/python2.7/site-packages/grafana_alerts/init.py", line 12, in main
return the_launcher.launch()
File "/usr/local/lib/python2.7/site-packages/grafana_alerts/launcher.py", line 16, in launch
alert_checker.check()
File "/usr/local/lib/python2.7/site-packages/grafana_alerts/alerting.py", line 40, in check
for d in dashboard_data_list:
TypeError: 'NoneType' object is not iterable

This the data that we are getting after json.loads(data) in def obtain_dashboards(self)

request = urllib2.Request(self.grafana_url + _GRAFANA_URL_PATH_OBTAIN_DASHBOARDS,
headers={"Accept": "application/json",
"Authorization": "Bearer " + self.grafana_token})
contents = urllib2.urlopen(request).read()
print contents
data = json.loads(contents)

[{u'tags': [u'Landing page', u'home page', u'monitored', u'performance'], u'type': u'dash-db', u'title': u'Home Page - Performance Dashboard', u'uri': u'db/home-page-performance-dashboard', u'isStarred': False, u'id': 1}, {u'tags': [u'monitored'], u'type': u'dash-db', u'title': u'test', u'uri': u'db/test', u'isStarred': False, u'id': 11}]

But jmespath.search('dashboards', data) is not returning any values.

Grafana version: 2.1.3
Python verison: 2.7

@stefanocog
Copy link

Same error.
Grafana 2.6.0
grafana-alerts 1.0.0.dev7

@ahahtyler
Copy link

I'm getting the same error. The jmespath.search command in the DashboardScanner class in alerting.py is not returning anything. This is my "data" value being passed into jmespath.search:

[{u'tags': [u'monitored'], u'type': u'dash-db', u'title': u'Grafana Alerts Dashboard', u'uri': u'db/grafana-alerts-dashboard', u'isStarred': False, u'id': 2}]

Grafana 2.6.0
Grafana-alerts 1.0.0.dev7

@vivekranjan5
Copy link

I'm getting the same error of 'NoneType' object is not iterable

Is this issue resolved??
I have 1 dashboard marked monitored
[{"id":1,"title":"New dashboard Copy","uri":"db/new-dashboard-copy","type":"dash-db","tags":["monitored"],"isStarred":false}]

but jsmepath.search returns None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants