-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature to create new dashboard in grafana
- Loading branch information
1 parent
edb9c82
commit 245e28d
Showing
34 changed files
with
4,866 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
.idea/ | ||
htmlcov/ | ||
.tox/ | ||
/.tox | ||
.testrepository/ | ||
.coverage/ | ||
cover/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
.hypothesis/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# IPython Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# dotenv | ||
.env | ||
|
||
# virtualenv | ||
venv/ | ||
ENV/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# conf file | ||
graphite.conf.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Style Commandments | ||
================== | ||
|
||
- Tendrl coding style is inspired by one of the largest python projects, OpenStack | ||
http://docs.openstack.org/developer/hacking/ (excluding the license and trademark sections) | ||
|
||
|
||
Developer Workflow | ||
------------------ | ||
Refer: http://nvie.com/posts/a-successful-git-branching-model/ | ||
|
||
|
||
Creating Unit Tests | ||
------------------- | ||
For every new feature, unit tests should be created that both test and | ||
(implicitly) document the usage of said feature. If submitting a pull request for a | ||
bug that had no unit test, a new passing unit test should be added. If a | ||
submitted bug fix does have a unit test, be sure to add a new one that fails | ||
without the patch and passes with the patch. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
|
||
|
||
Monitoring-Integration | ||
======================= | ||
|
||
|
||
Functionalities | ||
---------------- | ||
|
||
- Create a new dashboard in Grafana | ||
|
||
|
||
Environment Setup | ||
----------------- | ||
|
||
#. Clone the monitoring-integration repository | ||
|
||
:: | ||
|
||
$ git clone https://github.com/Tendrl/monitoring-integration.git | ||
$ cd monitoring-integration | ||
|
||
|
||
.. note:: | ||
|
||
All the commands mentioned below are run as a regular user that has ``sudo`` | ||
privileges. | ||
These commands are assumbed to be run from a single directory, which | ||
contains the code of monitoring-integration. | ||
|
||
#. Install python pip | ||
|
||
|
||
https://pip.pypa.io/en/stable/installing/ | ||
|
||
|
||
#. Install python dependencies | ||
|
||
:: | ||
|
||
$ python setup.py install | ||
|
||
|
||
#. Install Grafana | ||
|
||
|
||
http://docs.grafana.org/installation/ | ||
|
||
|
||
#. Configure grafana for anonymous login. | ||
|
||
:: | ||
|
||
$ cp etc/grafana/grafana.ini /etc/grafana/. | ||
|
||
.. note:: | ||
|
||
This will overwrite present grafana.ini. | ||
|
||
Prerequisites | ||
-------------- | ||
|
||
* Grafana instance is set-up and running on the server node. | ||
|
||
* Graphite instance in set-up and running on the same server node. | ||
|
||
* Monitoring-Integration is installed on same server node. | ||
|
||
|
||
Usage Details | ||
-------------- | ||
|
||
.. note:: | ||
|
||
Configuration file needed by monitoring-integration is present under | ||
|
||
' /etc/tendrl/monitoring-integration/monitoring-integration.conf.yaml' | ||
|
||
If configuration file is not present. | ||
|
||
:: | ||
|
||
$ cp etc/tendrl/monitoring-integration/monitoring-integration.conf.yaml.sample | ||
/etc/tendrl/monitoring-integration/monitoring-integration.conf.yaml | ||
|
||
|
||
* Development setup | ||
|
||
* Create a json file in tendrl/monitoring-integration/grafana/dashboards and provide json | ||
for the dashboard that is to be created. | ||
|
||
* Provide the file-name of the json file created in above step under "dashboards" | ||
in /etc/tendrl/monitoring-integration/monitoring-integration.conf.yaml. | ||
|
||
* Make one of the dashboards listed under "dashboards" as home_dashboard. | ||
|
||
* Provide grafana instance's credential under "credentials" in monitoring-integration.conf.yaml file | ||
|
||
* Provide name of datasource to be created in grafana under "datasource_name" in | ||
monitoring-integration.conf.yaml file | ||
|
||
* Make sure a datasource with same name as given in monitoring-integration.conf.yaml file | ||
doesnot exist in grafana. | ||
|
||
* By default true is passed under "isDefault" in monitoring-integration.conf.yaml | ||
to set the datasource as the default datasource in grafana. | ||
|
||
* Follow the commands provided below to run __init__.py file to create dashboards and datasource | ||
in grafana. | ||
|
||
:: | ||
|
||
$ cd tendrl/monitoring_integration/ | ||
$ python __init__.py | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/python | ||
|
||
import os | ||
|
||
import requests | ||
|
||
commit_msg = str(os.environ['TRAVIS_COMMIT_MSG']) | ||
tendrl_bug_id = None | ||
tendrl_spec = None | ||
github_base_url = "http://github.com" | ||
|
||
|
||
# Extract "tendrl-bug-id" and "tendrl-spec" name from the commit message | ||
for line in commit_msg.split("\n"): | ||
if "tendrl-bug-id" in line: | ||
try: | ||
tendrl_bug_id = line.split("tendrl-bug-id:")[-1].strip() | ||
except Exception as ex: | ||
print(ex) | ||
|
||
if "tendrl-spec" in line: | ||
try: | ||
tendrl_spec = line.split("tendrl-spec:")[-1].strip() | ||
except Exception as ex: | ||
print(ex) | ||
|
||
if tendrl_bug_id is None: | ||
raise Exception("Please add 'tendrl-bug-id:Tendrl/<tendrl_repo>#issue_id'" | ||
" to your commit msg") | ||
|
||
if tendrl_bug_id: | ||
issue = "%s/%s" % (github_base_url, tendrl_bug_id.replace("#", "/issues/")) | ||
if requests.get(issue).status_code != 200: | ||
raise Exception("Tendrl Bug specified in git commit msg not " | ||
"found!!\n" | ||
"%s" % issue) | ||
print("Tendrl Bug specified in git commit msg found!!\n%s" % issue) | ||
|
||
if tendrl_spec: | ||
spec = "%s/%s.adoc" % ("https://github.com/Tendrl/specifications/tree" | ||
"/master/specs", tendrl_spec) | ||
if requests.get(spec).status_code != 200: | ||
raise Exception("Tendrl Spec specified in git commit msg not found\n" | ||
"%s" % spec) | ||
print("Tendrl Spec specified in git commit msg found!!\n%s" % spec) |
Oops, something went wrong.