Horizon UI for Monasca
Go to file
Hervé Beraud ca55abec23 Use unittest.mock instead of mock
The mock third party library was needed for mock support in py2
runtimes. Since we now only support py36 and later, we can use the
standard lib unittest.mock module instead.

Bump horizon to 18.3.0 in lower-constraints.txt since it is the
first version with "Use unittest.mock instead of third party mock"
change [1]

[1] 7eeb9e14f9

Change-Id: Ic64fffaeded18ac11ce438c77526e60a37aeaa1d
2020-06-10 13:59:58 +02:00
debian Initial installer work 2014-04-29 14:09:19 -06:00
grafana-dashboards fix a typo in drilldown.js 2018-05-23 23:56:47 +08:00
monitoring Use unittest.mock instead of mock 2020-06-10 13:59:58 +02:00
releasenotes/notes [ussuri][goal] Drop python 2.7 support and testing 2019-11-16 16:59:02 +00:00
tools Stop to use the __future__ module. 2020-06-02 20:25:55 +02:00
.gitignore Update pep8 checks 2018-04-18 16:09:26 +02:00
.gitreview OpenDev Migration Patch 2019-04-19 19:44:03 +00:00
.zuul.yaml Add Python3 victoria unit tests 2020-04-23 21:30:16 +00:00
CONTRIBUTING.rst Add CONTRIBUTING.rst 2020-05-19 16:29:52 +02:00
LICENSE pypi packaging files 2014-05-30 16:52:14 -06:00
README.rst [ussuri][goal] Drop python 2.7 support and testing 2019-11-16 16:59:02 +00:00
babel-django.cfg translation: drop babel extractor definitions 2019-12-27 02:18:23 +09:00
babel-djangojs.cfg translation: drop babel extractor definitions 2019-12-27 02:18:23 +09:00
lower-constraints.txt Use unittest.mock instead of mock 2020-06-10 13:59:58 +02:00
manage.py Use django.conf.settings instead of local_settings 2019-09-16 15:19:32 +02:00
mkdocs.yml Change repositories from stackforge to openstack 2015-10-19 09:59:14 +05:30
requirements.txt Drop Django 1.11 support 2020-01-02 19:40:26 +00:00
run_tests.sh Move coverage reports to `cover` directory 2018-03-16 14:54:20 +01:00
setup.cfg Cleanup py27 support 2020-04-15 19:01:08 +02:00
setup.py Cleanup py27 support 2020-04-15 19:01:08 +02:00
test-requirements.txt Use unittest.mock instead of mock 2020-06-10 13:59:58 +02:00
tox.ini Update hacking for Python3 2020-04-01 12:22:43 +00:00

README.rst

Team and repository tags

image

monasca-ui

Monasca UI is implemented as a Horizon plugin that adds panels to Horizon. It is installed into devstack by the monasca-api plugin.

Devstack Deployment Set Up

  • cd /opt/stack/horizon
  • Install Openstack upper-constraints requirements pip install -c https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt -r requirements.txt
  • Clone monasca-ui: git clone https://opendev.org/openstack/monasca-ui.git
  • Add git+https://opendev.org/openstack/monasca-ui.git to requirements.txt.
  • Install monasca-ui required packages pip install -r requirements.txt (monasca-client packages will be installed.)
  • Edit openstack_dashboard/settings.py to include the following two lines:
    • import monitoring.enabled
    • monitoring.enabled, (Add this line to the settings_utils.update_dashboards list.)
  • Link monasca into Horizon:
ln -sf $(pwd)/../monasca-ui/monitoring/enabled/_50_admin_add_monitoring_panel.py \
    $(pwd)/openstack_dashboard/enabled/_50_admin_add_monitoring_panel.py
ln -sf $(pwd)/../monasca-ui/monitoring/conf/monitoring_policy.json \
    $(pwd)/openstack_dashboard/conf/monitoring_policy.json
ln -sfF $(pwd)/../monasca-ui/monitoring $(pwd)/monitoring
  • Collect static files, run tests
python manage.py collectstatic --noinput
python manage.py compress
./run_tests.sh
  • Restart apache service service apache2 restart

Development Environment Set Up

Get the Code

git clone https://opendev.org/openstack/monasca-ui.git  # clone monasca-ui
git clone https://opendev.org/openstack/horizon.git  # clone horizon
git clone https://github.com/monasca/grafana.git  # clone grafana
git clone https://github.com/openstack/monasca-grafana-datasource.git # clone grafana plugins

Set up Horizon

Since Monasca UI is a Horizon plugin, the first step is to get their development environment set up.

cd horizon
./run_tests.sh
cp openstack_dashboard/local/local_settings.py.example openstack_dashboard/local/local_settings.py

Pro Tip: Make sure you have Horizon running correctly before proceeding. For more details visit: https://docs.openstack.org/horizon/latest/#setup

Set up Monasca-UI

  • Edit openstack_dashboard/local/local_settings.py to modify the OPENSTACK_HOST IP address to point to devstack.
  • Add monasca-client to requirements.txt. Get the latest version from: https://pypi.org/project/python-monascaclient
  • Link monasca into Horizon:
ln -sf $(pwd)/../monasca-ui/monitoring/enabled/_50_admin_add_monitoring_panel.py \
    $(pwd)/openstack_dashboard/enabled/_50_admin_add_monitoring_panel.py
ln -sf $(pwd)/../monasca-ui/monitoring/conf/monitoring_policy.json \
    $(pwd)/openstack_dashboard/conf/monitoring_policy.json
ln -sfF $(pwd)/../monasca-ui/monitoring $(pwd)/monitoring
./run_tests #load monasca-client into virtualenv

Set up Grafana 4.1

Start Server

./run_tests.sh --runserver

Style checks

To check if the code follows python coding style, run the following command from the root directory of this project:

$ tox -e pep8

Coverage checks

To measure the code coverage, run the following command from the root directory of this project:

$ tox -e cover

Unit tests

To run all the unit test cases, run the following command from the root directory of this project:

$ tox -e py36