-
Notifications
You must be signed in to change notification settings - Fork 13
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
Feature to create new dashboard in grafana #1
Conversation
rishubhjain
commented
Jul 27, 2017
- Create new dashboard in grafana.
- Updated README.md
e284965
to
f8c8ad3
Compare
@anivargi @r0h4n @GowthamShanmugam @cloudbehl Please review |
@@ -0,0 +1,66 @@ | |||
import __builtin__ |
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.
folder name should be monitoring_integration
f26873d
to
bfe6bac
Compare
Please link the corresponding spec no |
bfe6bac
to
3b2de67
Compare
README.rst
Outdated
|
||
:: | ||
|
||
$ cp tendrl/monitoring_integration/grafana/grafana.ini /etc/grafana/. |
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.
why you are maintaining grafana.ini in monitoring-integration and copying it to /etc/grafana/, Instead of that mention what is the changes in wants to do in /etc/grafana/grafana.ini
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.
There are few changes in grafana.ini which are system independent and requires no inputs from user. So in my opinion copying the file directly is a better approach
Few changes required for packaging prospective:
|
@@ -0,0 +1,407 @@ | |||
##################### Grafana Configuration Example ##################### |
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.
Move this file to etc/grafana/grafana.ini from tendrl/monitoring_integration/grafana/grafana.ini in this repo
Also move all screenshots to etc/grafana/screenshots/ in this repo
"Development Status :: 4 - Beta" | ||
], | ||
zip_safe=False, | ||
install_requires=[ |
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.
please explain more @GowthamShanmugam
grafana.conf.yml
Outdated
user: admin | ||
password: admin | ||
|
||
port: 3000 |
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.
Since we are assuming that grafana service will always run on tendrl-server (with API, etcd), we dont need to allow configurable port and host
cc @Tendrl/tendrl-core , @anivargi @anmolbabu
graphite.conf.sample.yml
Outdated
|
||
type: graphite | ||
|
||
host: '127.0.0.1' |
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.
Since we are assuming that graphite service will always run on tendrl-server (with API, etcd), we dont need to allow configurable port and host
cc @Tendrl/tendrl-core , @anivargi @anmolbabu
graphite.conf.sample.yml
Outdated
basicAuth: false | ||
|
||
isDefault: true | ||
|
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.
remove unused options
@@ -0,0 +1,60 @@ | |||
import os |
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 file should be called "tendrl/monitoring_integration/grafana/utils.py" instead of connection.py
import os | ||
import yaml | ||
import socket | ||
from grafana.exceptions import ConfigNotFoundException |
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.
from tendrl.monitoring_integration.grafana import exceptions
then use
exceptions.ConfigNotFoundException
@@ -0,0 +1,75 @@ | |||
import __builtin__ |
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.
fix imports as per below comments on other files
def main(): | ||
|
||
dashboards = [] | ||
config = get_conf("../../grafana.conf.yml") |
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.
Based on my comment below, you will now need to load the "/etc/tendrl/monitoring-integration/monitoring-integration.conf.yml" instead of loading ../../grafana.conf.yml and graphite.conf.yml
response_status = [] | ||
|
||
for datasource in config.datasource: | ||
datasource_config = get_conf("../../" + str(datasource) + ".conf.yml") |
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.
If this is loading graphite.conf.yml, please remove it and use /etc/monitoring-integration/monitoring-integration.conf.yml
e1447eb
to
96be3b8
Compare
README.rst
Outdated
|
||
* Grafana instance is set-up and running on the server node. | ||
|
||
* Graphite instance in set-up and running on the same server node. |
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.
@rishubhjain @anivargi @anmolbabu , Now graphite is dependency to monitoring-integration, I think we need have the below config files part of this:
What you guys think?
96be3b8
to
245e28d
Compare
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.
+pep8 fixes required
''' Create Datasource ''' | ||
|
||
|
||
def post_datasource(datasource_json): |
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.
Make post_datasource private method then (_post_datasource)
@@ -0,0 +1,96 @@ | |||
import __builtin__ |
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.
convert methods that are used only in this file as private methods
README.rst
Outdated
|
||
* Development setup | ||
|
||
* Create a json file in tendrl/monitoring-integration/grafana/dashboards and provide json |
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.
I would prefer to have the dashboards at /etc/tendrl/monitoring-integration/grafana/dashboards/
@@ -0,0 +1,42 @@ | |||
# Graphite Web Basic mod_wsgi vhost |
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.
etc/tendrl/monitoring-integration/graphite/graphite-web.conf.sample
sys.stdout.write('\n' + "Dashboard " + str(dashboard_json) + | ||
" already exists" + '\n') | ||
continue | ||
response = dashboard.create_dashboard(dashboard_json) |
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.
pass dashboard dir as "/etc/tendrl/grafana/dashboards" to create dashboard
response = post_dashboard(dashboard_json) | ||
return response | ||
|
||
except exceptions.ConnectionFailedException: |
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.
exceptions from post if any? Applicable whereever python-requests(post,get etc) are used
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.
Before making a post request I am checking if the port is open and handling exceptions during this check.
Will an additional exception handling required during post requests?
In my opinion if the port is open, and if there is any error in request then it will be received as a response instead of exception
sys.stdout.write('\n' + "Dashboard " + str(dashboard_json) + | ||
" already exists" + '\n') | ||
continue | ||
response = dashboard.create_dashboard(dashboard_json) |
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.
In the spec, we were talking about copying the json files only first time. Further it will be skipped. Where this is implemented?
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.
dashboards = dashboard.get_all_dashboards()
title = []
for dashboard_json in dashboards:
title.append(dashboard_json["uri"].split('/')[1])
for dashboard_json in config.dashboards:
if dashboard_json in title:
sys.stdout.write('\n' + "Dashboard " + str(dashboard_json) +
" already exists" + '\n')
continue
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.
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.
👍
245e28d
to
28c28ee
Compare
README.rst
Outdated
|
||
* Grafana instance is set-up and running on the server node. | ||
|
||
* Graphite instance in set-up and running on the same server node. |
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.
@rishubhjain /s/Graphite instance in/Graphite instance is
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.
Done
@Tendrl/tendrl-core please approve |
28c28ee
to
15fcc4f
Compare
15fcc4f
to
c4a8b6d
Compare