-
Notifications
You must be signed in to change notification settings - Fork 13
Added code to update grafana dashboards on monitoring-integration start #576
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,15 +30,21 @@ def upload_default_dashboards(): | |
datasource.create() | ||
dashboards = dashboard_utils.get_all_dashboards() | ||
for dashboard_json in dashboards: | ||
title.append(dashboard_json["uri"].split('/')[1]) | ||
|
||
for dashboard_json in NS.config.data["dashboards"]: | ||
if dashboard_json in title: | ||
msg = '\n' + "Dashboard " + str(dashboard_json) + \ | ||
" already exists" + '\n' | ||
dashboard = dashboard_json["uri"].split('/')[1] | ||
title.append(dashboard) | ||
# Deleting already existing dashboards if present | ||
response = dashboard_utils.delete_dashboard(dashboard) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't want to delete all dashboards in every sync. I think we need to find a better way of handling this situation. We need to see if there is an intersection/difference between the two files then only we need to update it. Otherwise, the will keep refreshing the dashboards and can cause a problem(while a user is at a particular dashboard) also it increases the number of calls on the server. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cloudbehl agreed, will see to it. |
||
if 'title' in response: | ||
msg = "\n Already existing %s deleted. \n" % dashboard | ||
logger.log("debug", NS.get("publisher_id", None), | ||
{'message': msg}) | ||
else: | ||
msg = "\n%s delete failed with error: %s \n" % (dashboard, | ||
str(response)) | ||
logger.log("debug", NS.get("publisher_id", None), | ||
{'message': msg}) | ||
continue | ||
|
||
for dashboard_json in NS.config.data["dashboards"]: | ||
response = dashboard_utils.create_dashboard(dashboard_json) | ||
|
||
if response.status_code == 200: | ||
|
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if condition is checking two completely different things:
["cluster-dashboard", "brick-dashboard", "host-dashboard", "volume-dashboard"] &
['tendrl-gluster-at-a-glance', 'tendrl-gluster-hosts', 'tendrl-gluster-volumes', 'tendrl-gluster-bricks']
But its not failing as we are going down straight to creating the dashboard again. The dashboards cannot get updated as the grafana rejects the request with : {u'status': u'name-exists', u'message': u'A dashboard with the same name already exists'} .