diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000000000000000000000000000000000000..df9cfe5926f28a63e4b8b83841cd23f2f2c0a418 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,10 @@ +Before reporting an issue on Gnocchi, please be sure to provide all necessary +information. + +### Which version of Gnocchi are you using + +### How to reproduce your problem + +### What is the result that you get + +### What is result that you expected diff --git a/.gitignore b/.gitignore index 5599e5cd49a51cd02aa760681893dc4103641e3a..415c6ca086365424877c9cc43373360672723fcf 100644 --- a/.gitignore +++ b/.gitignore @@ -5,8 +5,12 @@ AUTHORS ChangeLog etc/gnocchi/gnocchi.conf +gnocchi/rest/gnocchi-api doc/build doc/source/rest.rst +doc/source/gnocchi.conf.sample +releasenotes/build cover .coverage dist +upgrade/ diff --git a/.gitreview b/.gitreview deleted file mode 100644 index e4b8477df8eaeabe217e8ac419c64e326d680c71..0000000000000000000000000000000000000000 --- a/.gitreview +++ /dev/null @@ -1,4 +0,0 @@ -[gerrit] -host=review.openstack.org -port=29418 -project=openstack/gnocchi.git diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000000000000000000000000000000000000..caddbe0ce35df96a915c196352f398efbe3601ad --- /dev/null +++ b/.mailmap @@ -0,0 +1 @@ +gord chung diff --git a/.mergify.yml b/.mergify.yml new file mode 100644 index 0000000000000000000000000000000000000000..3bc9ae1ebb8cac68643a2561e4e4601824ab7967 --- /dev/null +++ b/.mergify.yml @@ -0,0 +1,66 @@ +pull_request_rules: + - name: automatic merge + actions: + merge: + method: rebase + rebase_fallback: merge + strict: true + conditions: + - label!=work-in-progress + - '#approved-reviews-by>=1' + - status-success=continuous-integration/travis-ci/pr + - name: automatic merge backports from Mergify + actions: + merge: + method: rebase + rebase_fallback: merge + strict: true + conditions: + - base~=^stable/.* + - label!=work-in-progress + - author=mergify[bot] + - status-success=continuous-integration/travis-ci/pr + +# Backports to stable branches + - actions: + backport: + branches: + - stable/3.0 + conditions: + - label=backport-to-3.0 + name: backport stable/3.0 + - actions: + backport: + branches: + - stable/3.1 + conditions: + - label=backport-to-3.1 + name: backport stable/3.1 + - actions: + backport: + branches: + - stable/4.0 + conditions: + - label=backport-to-4.0 + name: backport stable/4.0 + - actions: + backport: + branches: + - stable/4.1 + conditions: + - label=backport-to-4.1 + name: backport stable/4.1 + - actions: + backport: + branches: + - stable/4.2 + conditions: + - label=backport-to-4.2 + name: backport stable/4.2 + - actions: + backport: + branches: + - stable/4.3 + conditions: + - label=backport-to-4.3 + name: backport stable/4.3 diff --git a/.testr.conf b/.testr.conf index 899933061ff105d0d6f4357890805138762d2422..6e2e4a5e0d1d14880c3f0cf509d24efaca74fb99 100644 --- a/.testr.conf +++ b/.testr.conf @@ -1,5 +1,5 @@ [DEFAULT] -test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} ${PYTHON:-python} -m subunit.run discover -t . ${OS_TEST_PATH:-gnocchi/tests} $LISTOPT $IDOPTION +test_command=${PYTHON:-python} -m subunit.run discover -t . ${GNOCCHI_TEST_PATH:-gnocchi/tests} $LISTOPT $IDOPTION test_id_option=--load-list $IDFILE test_list_option=--list -group_regex=(gabbi\.driver.test_gabbi_[^_]+)_ +group_regex=(gabbi\.suitemaker\.test_gabbi((_live_|_)([^_]+)))_ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..6a41c9de9b3c39f1607dd0e8787cb94413e68f7f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,81 @@ +dist: bionic +language: generic +sudo: required + +services: + - docker + +cache: + directories: + - ~/.cache/pip +env: + - TARGET: pep8 + - TARGET: docs + - TARGET: docs-gnocchi-web + + - TARGET: py36-mysql-ceph-upgrade-from-4.3 + - TARGET: py36-postgresql-file-upgrade-from-4.3 + + - TARGET: py36-mysql + - TARGET: py36-postgresql + +before_script: + # NOTE(sileht): We need to fetch all tags/branches for documentation. + # For the multiversioning, we change all remotes refs to point to + # the pull request checkout. So the "master" branch will be the PR sha and not + # real "master" branch. This ensures the doc build use the PR code for initial + # doc setup. + - if \[ "$TRAVIS_PULL_REQUEST" != "false" -o -n "$TRAVIS_TAG" \]; then + set -x; + case $TARGET in + docs*) + git config --get-all remote.origin.fetch; + git config --unset-all remote.origin.fetch; + git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/*; + git config --get-all remote.origin.fetch; + git fetch --unshallow --tags; + ;; + esac ; + case $TARGET in + docs-gnocchi-web) + git branch -a | sed -n "/\/HEAD /d; /\/master$/d; s,remotes/origin/,,p;" | xargs -i git branch {} origin/{} ; + git branch -D master; + git checkout -b master; + git remote set-url origin file:///home/tester/src; + git ls-remote --heads --tags | grep heads; + ;; + esac ; + set +x; + fi +install: + - if \[ "$TRAVIS_PULL_REQUEST" != "false" -o -n "$TRAVIS_TAG" \]; then + docker pull gnocchixyz/ci-tools:latest; + fi +script: + - if \[ "$TRAVIS_PULL_REQUEST" != "false" -o -n "$TRAVIS_TAG" \]; then + docker run -v ~/.cache/pip:/home/tester/.cache/pip -v $(pwd):/home/tester/src gnocchixyz/ci-tools:latest tox -e ${TARGET} ; + fi + +notifications: + email: false + irc: + on_success: change + on_failure: always + skip_join: true + channels: + - "irc.freenode.org#gnocchi" + +before_deploy: + - pip install --user --upgrade pip + - pip install --user --upgrade six + +deploy: + provider: pypi + user: jd + password: + secure: c+Ccx3SHCWepiy0PUxDJ7XO9r3aNYnHjkzxF5c/kjV8QaCJayAJEgXJnBKhvjroqwgn7JPUgpD6QdSWdB4FqjbZYQ3I3oHOO1YL0vYYa8wHG5HuMsMp4J8qvzgs3QNQDECPI1mXsPevn3VMfGszUN+6BQrHB3FbZsTtOmE+Kmgok5NCT+obsfEhVea/UOD0XFUkVW9VJhPjQ2ytvYvFIc46/73GQf2Er/5DCa/4GGDEBSD++bDJgp3kQj438xslCAFeZWDwGsa+cTc43PI0Y0+E144ySVY7QyVbZ1B66a1BGWVrXJuM+gW/eIBCMN1FJXmD7CDdPa22azKI8dfMF7qaH3Oiv3cVovPWpubOvhTUHUFwG8+W7Fx+zUKktCWiLer/fZvEd3W8tcgby2kNOdcUfKfDB2ImZJ+P694/OJ4jJ8T5TQerruNoP2OstzcBMon77Ry0XawXR15SZd4JhbqhSi+h7XV6EYmct1UN4zoysA7fx/cWHcBxdnm2G6R0gzmOiiGUd74ptU8lZ3IlEP6EZckK/OZOdy1I8EQeUe7aiTooXZDAn07iPkDZliYRr2e36ij/xjtWCe1AjCksn/xdKfHOKJv5UVob495DU2GuNObe01ewXzexcnldjfp9Sb8SVEFuhHx6IvH5OC+vAq+BVYu2jwvMcVfXi3VSOkB4= + skip_existing: true + on: + all_branches: true + tags: true + distributions: "sdist bdist_wheel" diff --git a/MANIFEST.in b/MANIFEST.in index 8f248e6e12d9374c22fbf7468a538342ee15af11..54a0a8cb0d1ae224ed8cbfab03e8285d73b257d1 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,4 @@ -include etc/gnocchi/gnocchi.conf +include ChangeLog +include AUTHORS +exclude .gitignore +exclude .github diff --git a/README.rst b/README.rst index a6cc77ea7d5eec28baba27d9262a83f2f8a0723a..9012f7167e8b5120dc4aec17d16988fdad59c7db 100644 --- a/README.rst +++ b/README.rst @@ -2,16 +2,33 @@ Gnocchi - Metric as a Service =============================== -.. image:: doc/source/gnocchi-logo.jpg +.. image:: https://travis-ci.org/gnocchixyz/gnocchi.png?branch=master + :target: https://travis-ci.org/gnocchixyz/gnocchi + :alt: Build Status -Gnocchi is a multi-tenant timeseries, metrics and resources database. It -provides an `HTTP REST`_ interface to create and manipulate the data. It is -designed to store metrics at a very large scale while providing access to -metrics and resources information to operators and users. +.. image:: https://badge.fury.io/py/gnocchi.svg + :target: https://badge.fury.io/py/gnocchi -Gnocchi is part of the `OpenStack` project. While Gnocchi has support for -OpenStack, it is fully able to work stand-alone. +.. image:: doc/source/_static/gnocchi-logo.png -You can read the full documentation online at http://gnocchi.xyz. +Gnocchi is an open-source time series database. -.. _`HTTP REST`: https://en.wikipedia.org/wiki/Representational_state_transfer +The problem that Gnocchi solves is the storage and indexing of time series +data and resources at a large scale. This is useful in modern cloud platforms +which are not only huge but also are dynamic and potentially multi-tenant. +Gnocchi takes all of that into account. + +Gnocchi has been designed to handle large amounts of aggregates being stored +while being performant, scalable and fault-tolerant. While doing this, the goal +was to be sure to not build any hard dependency on any complex storage system. + +Gnocchi takes a unique approach to time series storage: rather than storing +raw data points, it aggregates them before storing them. This built-in feature +is different from most other time series databases, which usually support +this mechanism as an option and compute aggregation (average, minimum, etc.) at +query time. + +Because Gnocchi computes all the aggregations at ingestion, getting the data +back is extremely fast, as it just needs to read back the pre-computed results. + +You can read the full documentation online at http://gnocchi.osci.io. diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000000000000000000000000000000000000..cec7d65e272e062e5534ac1496ce5434176b99e3 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,2 @@ +Note that even though dbconfig-common proposes such a choice, this package +currently doesn't support using SQLite. You've been warned. diff --git a/debian/bin/gnocchi-config-generator b/debian/bin/gnocchi-config-generator new file mode 100755 index 0000000000000000000000000000000000000000..f825aef6ee9f1a2e46c724a911a93e90231041d7 --- /dev/null +++ b/debian/bin/gnocchi-config-generator @@ -0,0 +1,8 @@ +#!/usr/bin/python3 + +import sys + +from gnocchi.cli import config_generator + +if __name__ == "__main__": + sys.exit(config_generator()) diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000000000000000000000000000000000000..a935e5965bd6951c962cabb2d2e0747808d9f640 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,347 @@ +gnocchi (4.4.0-3) UNRELEASED; urgency=medium + + * Bump debhelper from old 10 to 13. + + Replace python_distutils buildsystem with pybuild. + + debian/rules: Drop --fail-missing argument to dh_missing, which is now the + default. + * Set upstream metadata fields: Bug-Database, Bug-Submit, Repository, + Repository-Browse. + + -- Debian Janitor Thu, 09 Sep 2021 23:31:44 -0000 + +gnocchi (4.4.0-2) unstable; urgency=medium + + * Tune gnocchi-api-uwsgi.ini for performance. + * Upload to unstable. + + -- Thomas Goirand Wed, 17 Mar 2021 13:32:56 +0100 + +gnocchi (4.4.0-1) unstable; urgency=medium + + * New upstream release. + * Fixed debian/watch. + * Add a debian/salsa-ci.yml. + * Removed py3-compat.patch. + * Add a debian/README.Debian telling the package cannot be used with SQLite. + * Add add-header = Connection: close in gnochi-api-uwsgi.ini. + * Configure with threads = 32 by default (as per Gnocchi's doc). + * Add listen = 100 in the default UWSGI config. + + -- Thomas Goirand Mon, 19 Oct 2020 23:04:47 +0200 + +gnocchi (4.3.4-3) unstable; urgency=medium + + * Rebuild source-only. + + -- Thomas Goirand Thu, 07 Nov 2019 21:03:26 +0100 + +gnocchi (4.3.4-2) unstable; urgency=medium + + * Rebuilt source-only. + + -- Michal Arbet Fri, 01 Nov 2019 14:44:21 +0100 + +gnocchi (4.3.4-1) unstable; urgency=medium + + [ Ondřej Nový ] + * Use debhelper-compat instead of debian/compat. + * d/changelog: Remove trailing whitespaces. + + [ Michal Arbet ] + * New upstream version + + -- Michal Arbet Mon, 09 Sep 2019 13:19:28 +0200 + +gnocchi (4.3.1-4) unstable; urgency=medium + + [ Marcin Juszkiewicz ] + * Updated upstream URL in control/copyright/watch. + + [ Michal Arbet ] + * d/control: + - Bump openstack-pkg-tools to version 99 + - Add me to uploaders field + * d/copyright: Add me to copyright file + * d/rules: Remove python3 from oslo-config-generator + + -- Michal Arbet Fri, 03 May 2019 17:39:11 +0200 + +gnocchi (4.3.1-3) unstable; urgency=medium + + * Add a gnocchi logrotate file. + + -- Thomas Goirand Wed, 14 Nov 2018 14:37:07 +0100 + +gnocchi (4.3.1-2) unstable; urgency=medium + + * Uploading to unstable: + - This makes the build reproducible (Closes: #892419). + - Fix FTBFS (Closes: #911405). + * Fix gnocchi-statsd python3 depends. + + -- Thomas Goirand Wed, 14 Nov 2018 13:10:39 +0000 + +gnocchi (4.3.1-1) experimental; urgency=medium + + [ Ondřej Nový ] + * d/control: Use team+openstack@tracker.debian.org as maintainer + + [ Thomas Goirand ] + * New upstream release. + * Fixed (build-)depends for this release. + * Refreshed patches. + * export SETUPTOOLS_SCM_PRETEND_VERSION=. + * Do not call setup.py clean. + * Add install-missing-files.patch. + + -- Thomas Goirand Sat, 25 Aug 2018 15:18:34 +0200 + +gnocchi (4.2.0-5) unstable; urgency=medium + + * Switch gnocchi to openstack-pkg-tools >= 81~ style of uwsgi app. + + -- Thomas Goirand Tue, 05 Jun 2018 15:50:00 +0200 + +gnocchi (4.2.0-4) unstable; urgency=medium + + * Add patch to remove dependency on distutils (Closes: #896594). + + -- Thomas Goirand Sun, 03 Jun 2018 10:41:46 +0200 + +gnocchi (4.2.0-3) unstable; urgency=medium + + * Add missing gnocchi-statsd daemon package and init script. + + -- Thomas Goirand Mon, 07 May 2018 09:23:50 +0200 + +gnocchi (4.2.0-2) unstable; urgency=medium + + [ Ondřej Nový ] + * Running wrap-and-sort -bast + + [ Thomas Goirand ] + * Fixed dbc postrm. + + -- Thomas Goirand Mon, 26 Mar 2018 16:43:11 +0000 + +gnocchi (4.2.0-1) unstable; urgency=medium + + [ Ondřej Nový ] + * d/control: Set Vcs-* to salsa.debian.org + + [ Thomas Goirand ] + * New upstream release. + * Fixed (build-)depends for this release. + * Standards-Version is now 4.1.3. + * Add patch for Py3 compat, courtesy of James Page from Canonical. + * Blacklist test_gnocchi_config_generator_run(), we don't care about it + anyway, as we're using oslo-config-generator. + * Fixed uwsgi params. + * Dropped debconf templates, using openstack-pkg-tools >= 70~. + + -- Thomas Goirand Tue, 27 Feb 2018 13:12:12 +0000 + +gnocchi (4.0.4-1) unstable; urgency=medium + + * New upstream release. + * Fixed gnocchi-api UWSGI startup. + + -- Thomas Goirand Mon, 05 Feb 2018 14:25:47 +0100 + +gnocchi (4.0.3-3) unstable; urgency=medium + + * python3-gnocchi breaks+replaces python-gnocchi, therefore allowing + upgrades from older Gnocchi that was using Python 2.7 (Closes: #881247). + * Fixed encoding of pt.po. + + -- Thomas Goirand Fri, 17 Nov 2017 22:40:08 +0000 + +gnocchi (4.0.3-2) unstable; urgency=medium + + * Fixed version of python-sqlalchemy-utils (>= 0.32.14). + * Updated pt.po (Closes: #876172). + * Running gnocchi-upgrade instead of dbsync (Closes: #853121). + * Uploading to unstable. + * Add missing build-depends: python-all, python-pbr, python-setuptools, + python3-testresources. + + -- Thomas Goirand Wed, 15 Nov 2017 11:31:24 +0000 + +gnocchi (4.0.3-1) experimental; urgency=medium + + * New upstream release. + * Fixed (build-)depends for this release. + * Updating vcs fields. + * Updating copyright format url. + * Updating maintainer field. + * Running wrap-and-sort -bast. + * Standards-Version is now 4.1.1. + * Switch the package to Python 3 only, drop Python 2. + * Add debian/bin with gnocchi-config-generator entrypoint. + * Fixed oslo-config-generator namespace list for this release. + * Fixed source location for policy.json and api-paste.ini. + + -- Thomas Goirand Thu, 26 Oct 2017 06:33:31 +0200 + +gnocchi (3.0.4-4) unstable; urgency=medium + + * German debconf translation update (Closes: #842481). + + -- Thomas Goirand Mon, 03 Apr 2017 18:13:32 +0200 + +gnocchi (3.0.4-3) unstable; urgency=medium + + * Team upload. + * Revert net-tools dependency. + * Bump build dependency on openstack-pkg-tools (Closes: #858697). + + -- David Rabel Sat, 01 Apr 2017 11:35:30 +0200 + +gnocchi (3.0.4-2) unstable; urgency=medium + + * Team upload. + * Add missing dependency net-tools (Closes: #858697) + + -- David Rabel Sat, 25 Mar 2017 12:06:03 +0100 + +gnocchi (3.0.4-1) unstable; urgency=medium + + * Team upload. + + [ Ondřej Nový ] + * Bumped debhelper compat version to 10 + * Added lsb-base to depends + + [ Ondřej Kobližek ] + * New upstream release (Closes: #852991) + + -- Ondřej Kobližek Thu, 02 Feb 2017 14:44:31 +0100 + +gnocchi (3.0.0-2) unstable; urgency=medium + + [ Ondřej Nový ] + * d/s/options: extend-diff-ignore of .gitreview + + [ Thomas Goirand ] + * Uploading to unstable. + * Debconf translation: + - it (Closes: #839198). + + -- Thomas Goirand Tue, 04 Oct 2016 09:14:26 +0200 + +gnocchi (3.0.0-1) experimental; urgency=medium + + * New upstream release. + * Fixed (build-)depends for this release. + * Using OpenStack's Gerrit as VCS URLs. + + -- Thomas Goirand Fri, 23 Sep 2016 16:38:32 +0200 + +gnocchi (2.0.2-7) unstable; urgency=medium + + [ Ondřej Nový ] + * d/watch: Fixed upstream URL + + [ Thomas Goirand ] + * Updated Danish translation of the debconf templates (Closes: #830650). + * Now using gnocchi-upgrade, and not gnocchi-dbsync (Closes: #832792). + + -- Thomas Goirand Mon, 08 Aug 2016 12:21:06 +0000 + +gnocchi (2.0.2-6) unstable; urgency=medium + + * Fixed section to be net instead of python (Closes: #825364). + + -- Thomas Goirand Thu, 02 Jun 2016 07:16:10 +0000 + +gnocchi (2.0.2-5) unstable; urgency=medium + + [ Ondřej Nový ] + * Standards-Version is 3.9.8 now (no change) + * d/rules: Removed UPSTREAM_GIT with default value + * d/copyright: Changed source URL to https protocol + + [ Thomas Goirand ] + * Added Japanese debconf templates translation update (Closes: #820769). + * Updated Dutch debconf templates (Closes: #823439). + * Updated Brazilian Portuguese debconf templates (Closes: #824292). + + -- Thomas Goirand Sat, 23 Apr 2016 18:54:09 +0200 + +gnocchi (2.0.2-4) unstable; urgency=medium + + * Uploading to unstable. + * Updated ja.po debconf translation (closes: #819135). + + -- Thomas Goirand Tue, 05 Apr 2016 11:02:48 +0200 + +gnocchi (2.0.2-3) experimental; urgency=medium + + * Added missing (build-)depends: python-lz4. + + -- Thomas Goirand Tue, 29 Mar 2016 13:29:28 +0000 + +gnocchi (2.0.2-2) experimental; urgency=medium + + * Do not use Keystone admin auth token to register API endpoints. + + -- Thomas Goirand Tue, 29 Mar 2016 13:10:49 +0000 + +gnocchi (2.0.2-1) experimental; urgency=medium + + * New upstream release. + * Fixed (build-)depends for this release. + * Rename again GNOCCHI_INDEXER_URL env var (upstream constantly changes it). + * Standards-Version: 3.9.7 (no change). + + -- Thomas Goirand Wed, 09 Mar 2016 14:05:32 +0100 + +gnocchi (1.3.4-1) experimental; urgency=medium + + * New upstream release. + * Clean /var/{lib,log}/gnocchi on purge (Closes: #810700). + * Added nl.po debconf translation (Closes: #812356). + * Fixed running tests with pgsql (ie: GNOCCHI_TEST_INDEXER_URL env var). + * HTTPS VCS URLs. + + -- Thomas Goirand Tue, 02 Feb 2016 09:15:03 +0000 + +gnocchi (1.3.3+2016.01.27.git.e1339d77a9-1) unstable; urgency=medium + + * New upstream release based on commit e1339d77a9. + * Removed influxdb and influxdb-dev from build-depends-indep. + * Do not build-depends on python-ceilometer. + * Fixed python-future version to be >= 0.15. + * Fixed (build-)depends for this release. + * Pushes app.wsgi to /usr/share/gnocchi-common. + * Fixed debian/copyright ordering. + * Follow upstream rename of GNOCCHI_TEST_INDEXER_URL to GNOCCHI_INDEXER_URL. + * Fixed namespaces when generating config file. + + -- Thomas Goirand Thu, 28 Jan 2016 04:13:02 +0000 + +gnocchi (1.3.0-4) unstable; urgency=medium + + * French debconf templates translation update (Closes: #806506). + + -- Thomas Goirand Wed, 02 Dec 2015 10:21:02 +0100 + +gnocchi (1.3.0-3) unstable; urgency=medium + + * Added missing dbconfig-common dependency (Closes: #806538). + + -- Thomas Goirand Wed, 02 Dec 2015 08:22:21 +0000 + +gnocchi (1.3.0-2) unstable; urgency=medium + + * Adds missing config file: api-paste.ini. + * Fixed auth_protocol to be http by default. + * Added debconf translations imported from Glance. + + -- Thomas Goirand Wed, 25 Nov 2015 13:18:12 +0000 + +gnocchi (1.3.0-1) unstable; urgency=medium + + * Initial release. (Closes: #799374) + + -- Thomas Goirand Fri, 27 Mar 2015 10:32:47 +0100 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000000000000000000000000000000000000..7aa42f46dd3d661ba44233892025f3602bbd8f09 --- /dev/null +++ b/debian/control @@ -0,0 +1,210 @@ +Source: gnocchi +Section: net +Priority: optional +Maintainer: Debian OpenStack +Uploaders: + Thomas Goirand , + Michal Arbet , +Build-Depends: + debhelper-compat (= 13), + dh-python, + openstack-pkg-tools (>= 99~), + python3-all, + python3-pbr, + python3-setuptools, + python3-setuptools-scm, + python3-sphinx, +Build-Depends-Indep: + alembic, + libpq-dev, + postgresql, + postgresql-server-dev-all, + python3-boto3, + python3-botocore (>= 1.5), + python3-cachetools, + python3-cotyledon (>= 1.5.0), + python3-coverage (>= 3.6), + python3-daiquiri, + python3-doc8, + python3-fixtures, + python3-future (>= 0.15), + python3-gabbi (>= 1.37.0), + python3-iso8601, + python3-jsonpatch, + python3-keystoneclient (>= 1:1.6.0), + python3-keystonemiddleware (>= 4.0.0), + python3-lz4 (>= 0.9.0), + python3-mock, + python3-monotonic, + python3-mysqldb, + python3-numpy, + python3-os-testr, + python3-oslo.config (>= 1:3.22.0), + python3-oslo.db (>= 4.29.0), + python3-oslo.middleware (>= 3.22.0), + python3-oslo.policy, + python3-paste, + python3-pastedeploy, + python3-pecan, + python3-prettytable, + python3-protobuf, + python3-psycopg2, + python3-pymysql, + python3-pyparsing (>= 2.2.0), + python3-pytimeparse, + python3-redis, + python3-six, + python3-snappy, + python3-sphinx-bootstrap-theme, + python3-sphinx-rtd-theme, + python3-sphinxcontrib.httpdomain, + python3-sqlalchemy, + python3-sqlalchemy-utils (>= 0.32.14), + python3-stevedore, + python3-swiftclient (>= 3.1.0), + python3-sysv-ipc, + python3-tenacity (>= 4.6.0), + python3-testresources, + python3-testscenarios, + python3-testtools (>= 0.9.38), + python3-tooz (>= 1.38), + python3-ujson, + python3-voluptuous, + python3-webob, + python3-webtest (>= 2.0.16), + python3-werkzeug, + python3-wsgi-intercept (>= 1.4.1), + python3-yaml, + subunit (>= 0.0.18), + testrepository, +Standards-Version: 4.1.3 +Vcs-Browser: https://salsa.debian.org/openstack-team/services/gnocchi +Vcs-Git: https://salsa.debian.org/openstack-team/services/gnocchi.git +Homepage: https://gnocchi.xyz/ + +Package: gnocchi-api +Architecture: all +Depends: + adduser, + debconf, + gnocchi-common (= ${binary:Version}), + lsb-base, + python3-keystoneclient, + python3-openstackclient, + python3-pastescript, + q-text-as-data, + uwsgi-plugin-python3, + ${misc:Depends}, + ${python3:Depends}, +Description: Metric as a Service - API daemon + Gnocchi is a service for managing a set of resources and storing metrics about + them, in a scalable and resilient way. Its functionalities are exposed over an + HTTP REST API. + . + This package contains the API server. + +Package: gnocchi-common +Architecture: all +Depends: + adduser, + dbconfig-common, + debconf, + python3-gnocchi (= ${binary:Version}), + ${misc:Depends}, + ${python3:Depends}, +Description: Metric as a Service - common files + Gnocchi is a service for managing a set of resources and storing metrics about + them, in a scalable and resilient way. Its functionalities are exposed over an + HTTP REST API. + . + This package contains the common files. + +Package: gnocchi-metricd +Architecture: all +Depends: + gnocchi-common (= ${binary:Version}), + lsb-base, + ${misc:Depends}, + ${python3:Depends}, +Description: Metric as a Service - metric daemon + Gnocchi is a service for managing a set of resources and storing metrics about + them, in a scalable and resilient way. Its functionalities are exposed over an + HTTP REST API. + . + This package contains the metric daemon. + +Package: gnocchi-statsd +Architecture: all +Depends: + gnocchi-common (= ${binary:Version}), + lsb-base, + ${misc:Depends}, + ${python3:Depends}, +Description: Metric as a Service - statsd daemon + Gnocchi is a service for managing a set of resources and storing metrics about + them, in a scalable and resilient way. Its functionalities are exposed over an + HTTP REST API. + . + This package contains the statsd daemon. + +Package: python3-gnocchi +Section: python +Architecture: all +Depends: + alembic, + python3-boto3, + python3-botocore (>= 1.5), + python3-cachetools, + python3-cotyledon (>= 1.5.0), + python3-daiquiri, + python3-future (>= 0.15), + python3-iso8601, + python3-jsonpatch, + python3-keystoneclient (>= 1:1.6.0), + python3-keystonemiddleware (>= 4.0.0), + python3-lz4 (>= 0.9.0), + python3-monotonic, + python3-numpy, + python3-oslo.config (>= 1:3.22.0), + python3-oslo.db (>= 4.29.0), + python3-oslo.middleware (>= 3.22.0), + python3-oslo.policy, + python3-oslosphinx (>= 2.2.0.0), + python3-paste, + python3-pastedeploy, + python3-pbr, + python3-pecan, + python3-prettytable, + python3-protobuf, + python3-psycopg2, + python3-pymysql, + python3-pyparsing (>= 2.2.0), + python3-pytimeparse, + python3-redis, + python3-six, + python3-snappy, + python3-sqlalchemy, + python3-sqlalchemy-utils (>= 0.32.14), + python3-stevedore, + python3-swiftclient (>= 3.1.0), + python3-tenacity (>= 4.6.0), + python3-tooz (>= 1.38), + python3-ujson, + python3-voluptuous, + python3-webob, + python3-werkzeug, + python3-yaml, + ${misc:Depends}, + ${python3:Depends}, +Breaks: + python-gnocchi, +Replaces: + python-gnocchi, +Suggests: + gnocchi-doc, +Description: Metric as a Service - Python 3.x + Gnocchi is a service for managing a set of resources and storing metrics about + them, in a scalable and resilient way. Its functionalities are exposed over an + HTTP REST API. + . + This package contains the Python 3.x module. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000000000000000000000000000000000000..74cdd6df832a697a7cadd91299f38610e20d27ce --- /dev/null +++ b/debian/copyright @@ -0,0 +1,35 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: gnocchi +Upstream-Contact: Julien Danjou +Source: https://github.com/gnocchixyz/gnocchi + +Files: * +Copyright: (c) 2014-2015, Julien Danjou + (c) 2014-2015, Mirantis INC. + (c) 2014-2015, Red Hat INC. + (c) 2014-2015, Objectif Libre + (c) 2010-2017, OpenStack Foundation + (c) 2014-2016, eNovance + (c) 2016, Prometheus Team +License: Apache-2 + +Files: debian/* +Copyright: (c) 2014-2018, Thomas Goirand + (c) 2019, Michal Arbet +License: Apache-2 + +License: Apache-2 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + . + http://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + . + On Debian-based systems the full text of the Apache version 2.0 license + can be found in /usr/share/common-licenses/Apache-2.0. diff --git a/debian/gnocchi-api-uwsgi.ini b/debian/gnocchi-api-uwsgi.ini new file mode 100644 index 0000000000000000000000000000000000000000..45e17f16156c2b865505fe4bd3ee70ef44f4338d --- /dev/null +++ b/debian/gnocchi-api-uwsgi.ini @@ -0,0 +1,76 @@ +[uwsgi] +############################ +### Generic UWSGI config ### +############################ + +# Override the default size for headers from the 4k default. +buffer-size = 65535 + +# This avoids error 104: "Connection reset by peer" +#rem-header = Content-Length + +# This is running standalone +master = true + +# Threads and processes +enable-threads = true + +# uwsgi recommends this to prevent thundering herd on accept. +thunder-lock = true + +plugins = python3 + +# This ensures that file descriptors aren't shared between the WSGI application processes. +lazy-apps = true + +# Log from the wsgi application: needs python3-pastescript as runtime depends. +paste-logger = true + +# automatically kill workers if master dies +no-orphans = true + +# exit instead of brutal reload on SIGTERM +die-on-term = true + +########################## +### Performance tuning ### +########################## +# Threads and processes +enable-threads = true + +# For max perf, set this to number of core*2 +processes = 8 + +# This was benchmarked as a good value +threads = 32 + +# This is the number of sockets in the queue. +# It improves a lot performances. This is comparable +# to the Apache ServerLimit/MaxClients option. +listen = 100 + +################################## +### OpenStack service specific ### +################################## +add-header = Connection: close + +# This is the standard port for the WSGI application, listening on all available IPs +logto = /var/log/gnocchi/gnocchi-api.log +name = gnocchi-api +uid = gnocchi +gid = gnocchi +chdir = /var/lib/gnocchi +wsgi = gnocchi.rest.wsgi + +# This is controled by the init script using the --http-socket +# or using the --https thing. https will be activated if a file +# /etc/gnocchi/ssl/private/*.pem is found. In both case, port 9292 +# on all IPs will be used. +# The partern to search for the private key file is: +# find /etc/gnocchi/ssl/private -type f -iname '*.pem' | head -n 1 +# and for the certificate: +# find /etc/gnocchi/ssl/private -type f -iname '*.crt' | head -n 1 +# just drop files there and restart the daemon, and you'll have +# SSL up and running. +#http-socket = [::]:8041 +#https-socket = [::]:8041,foobar.crt,foobar.key diff --git a/debian/gnocchi-api.config.in b/debian/gnocchi-api.config.in new file mode 100644 index 0000000000000000000000000000000000000000..2cb26ee91dda3eaf4a8cf5e601863ad9876d42d7 --- /dev/null +++ b/debian/gnocchi-api.config.in @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +. /usr/share/debconf/confmodule + +#PKGOS-INCLUDE# + +pkgos_register_endpoint_config gnocchi + +exit 0 diff --git a/debian/gnocchi-api.init.in b/debian/gnocchi-api.init.in new file mode 100644 index 0000000000000000000000000000000000000000..55225d6080311502e4bdd3811a106fad7bfdf46b --- /dev/null +++ b/debian/gnocchi-api.init.in @@ -0,0 +1,20 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: gnocchi-api +# Required-Start: $network $local_fs $remote_fs $syslog +# Required-Stop: $remote_fs +# Should-Start: postgresql mysql keystone rabbitmq-server ntp +# Should-Stop: postgresql mysql keystone rabbitmq-server ntp +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: gnocchi Api +# Description: gnocchi-api +### END INIT INFO + +# Author: Thomas Goirand +DESC="OpenStack Gnocchi Api" +PROJECT_NAME=gnocchi +NAME=${PROJECT_NAME}-api +UWSGI_PORT=8041 +UWSGI_INI_PATH=/etc/gnocchi/gnocchi-api-uwsgi.ini +UWSGI_INI_APP=/usr/lib/python3/dist-packages/gnocchi/rest/wsgi.py diff --git a/debian/gnocchi-api.install b/debian/gnocchi-api.install new file mode 100644 index 0000000000000000000000000000000000000000..15739f18be4968d68ea70b630fd9f1cccb32d055 --- /dev/null +++ b/debian/gnocchi-api.install @@ -0,0 +1 @@ +debian/gnocchi-api-uwsgi.ini /etc/gnocchi diff --git a/debian/gnocchi-api.postinst.in b/debian/gnocchi-api.postinst.in new file mode 100644 index 0000000000000000000000000000000000000000..45507567005626f4e3e96d1d4dd056f49a24a5d7 --- /dev/null +++ b/debian/gnocchi-api.postinst.in @@ -0,0 +1,15 @@ +#!/bin/sh + +set -e + +#PKGOS-INCLUDE# + +if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then + . /usr/share/debconf/confmodule + pkgos_register_endpoint_postinst gnocchi gnocchi metric "OpenStack Metric Service" 8041 "" + db_stop +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/gnocchi-common.config.in b/debian/gnocchi-common.config.in new file mode 100644 index 0000000000000000000000000000000000000000..3f7a1d9c8c7ae9ee5708bfa8f0330c382d089cc3 --- /dev/null +++ b/debian/gnocchi-common.config.in @@ -0,0 +1,15 @@ +#!/bin/sh + +set -e + +. /usr/share/debconf/confmodule + +CONF=/etc/gnocchi/gnocchi.conf + +#PKGOS-INCLUDE# + +pkgos_var_user_group gnocchi +pkgos_dbc_read_conf -pkg gnocchi-common ${CONF} indexer url gnocchi $@ +pkgos_read_admin_creds ${CONF} keystone_authtoken gnocchi + +exit 0 diff --git a/debian/gnocchi-common.install b/debian/gnocchi-common.install new file mode 100644 index 0000000000000000000000000000000000000000..dd8f549db6c1b788b36da0808248f0e5976e85fb --- /dev/null +++ b/debian/gnocchi-common.install @@ -0,0 +1,2 @@ +gnocchi/rest/api-paste.ini /usr/share/gnocchi-common +gnocchi/rest/policy.json /usr/share/gnocchi-common diff --git a/debian/gnocchi-common.logrotate b/debian/gnocchi-common.logrotate new file mode 100644 index 0000000000000000000000000000000000000000..3e2bd66db0ba4d01a0b7473650b0b29716fa0756 --- /dev/null +++ b/debian/gnocchi-common.logrotate @@ -0,0 +1,8 @@ +/var/log/gnocchi/*.log { + daily + missingok + compress + delaycompress + notifempty + copytruncate +} diff --git a/debian/gnocchi-common.postinst.in b/debian/gnocchi-common.postinst.in new file mode 100644 index 0000000000000000000000000000000000000000..e0b1e0d77b8c9348669fcd165a7b0b76834eabe8 --- /dev/null +++ b/debian/gnocchi-common.postinst.in @@ -0,0 +1,30 @@ +#!/bin/sh + +set -e + +CONF=/etc/gnocchi/gnocchi.conf + +#PKGOS-INCLUDE# + +if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then + . /usr/share/debconf/confmodule + . /usr/share/dbconfig-common/dpkg/postinst + + pkgos_var_user_group gnocchi + + pkgos_write_new_conf gnocchi gnocchi.conf + pkgos_write_new_conf gnocchi policy.json + pkgos_write_new_conf gnocchi api-paste.ini + + db_get gnocchi/configure_db + if [ "$RET" = "true" ] ; then + pkgos_dbc_postinst ${CONF} database connection gnocchi $@ + echo "Now calling gnocchi-dbsync: this may take a while..." + su -s /bin/sh -c 'gnocchi-upgrade' gnocchi + fi + pkgos_write_admin_creds ${CONF} keystone_authtoken gnocchi +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/gnocchi-common.postrm.in b/debian/gnocchi-common.postrm.in new file mode 100644 index 0000000000000000000000000000000000000000..b99233ea9776a1045f7b60a78fedcef011d006e4 --- /dev/null +++ b/debian/gnocchi-common.postrm.in @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +#PKGOS-INCLUDE# + +if [ "$1" = "purge" ] ; then + pkgos_dbc_postrm gnocchi gnocchi-common $@ + + rm -fr /etc/gnocchi + rm -rf /var/lib/gnocchi /var/log/gnocchi +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/gnocchi-common.prerm b/debian/gnocchi-common.prerm new file mode 100644 index 0000000000000000000000000000000000000000..8012850becb7058ae86de7f6517319670cb1071f --- /dev/null +++ b/debian/gnocchi-common.prerm @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + +if [ "${1}" = "remove" ] && [ -r /usr/share/debconf/confmodule ] && [ -r /usr/share/dbconfig-common/dpkg/prerm ] ; then + . /usr/share/debconf/confmodule + + db_get gnocchi/configure_db + if [ "$RET" = "true" ]; then + . /usr/share/dbconfig-common/dpkg/prerm + dbc_go ${DPKG_MAINTSCRIPT_PACKAGE} $@ + fi +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/gnocchi-doc.doc-base b/debian/gnocchi-doc.doc-base new file mode 100644 index 0000000000000000000000000000000000000000..67ee04ce31b5a42bf730a7d844128172715db85d --- /dev/null +++ b/debian/gnocchi-doc.doc-base @@ -0,0 +1,9 @@ +Document: python-gnocchi-doc +Title: gnocchi Documentation +Author: N/A +Abstract: Sphinx documentation for gnocchi +Section: Programming/Python + +Format: HTML +Index: /usr/share/doc/python-gnocchi-doc/html/index.html +Files: /usr/share/doc/python-gnocchi-doc/html/* diff --git a/debian/gnocchi-metricd.init.in b/debian/gnocchi-metricd.init.in new file mode 100644 index 0000000000000000000000000000000000000000..7e8a159d1beeacf9b9a35be3186bfafe606a5f25 --- /dev/null +++ b/debian/gnocchi-metricd.init.in @@ -0,0 +1,17 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: gnocchi-metricd +# Required-Start: $network $local_fs $remote_fs $syslog +# Required-Stop: $remote_fs +# Should-Start: postgresql mysql keystone rabbitmq-server ntp mongodb +# Should-Stop: postgresql mysql keystone rabbitmq-server ntp mongodb +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: gnocchi Api +# Description: gnocchi-api +### END INIT INFO + +# Author: Thomas Goirand +DESC="OpenStack Gnocchi Api" +PROJECT_NAME=gnocchi +NAME=${PROJECT_NAME}-metricd diff --git a/debian/gnocchi-statsd.init.in b/debian/gnocchi-statsd.init.in new file mode 100644 index 0000000000000000000000000000000000000000..29669355ffee8304f5a5c8824be90f365722343d --- /dev/null +++ b/debian/gnocchi-statsd.init.in @@ -0,0 +1,17 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: gnocchi-statsd +# Required-Start: $network $local_fs $remote_fs $syslog +# Required-Stop: $remote_fs +# Should-Start: postgresql mysql keystone rabbitmq-server ntp mongodb +# Should-Stop: postgresql mysql keystone rabbitmq-server ntp mongodb +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Gnocchi Statsd +# Description: Gnocchi Statsd +### END INIT INFO + +# Author: Thomas Goirand +DESC="OpenStack Gnocchi Statsd daemon" +PROJECT_NAME=gnocchi +NAME=${PROJECT_NAME}-statsd diff --git a/debian/patches/install-missing-files.patch b/debian/patches/install-missing-files.patch new file mode 100644 index 0000000000000000000000000000000000000000..48bf7aaf6dfb118a2dac649e8f37d325f3c0dc08 --- /dev/null +++ b/debian/patches/install-missing-files.patch @@ -0,0 +1,7 @@ +--- MANIFEST.in 2018-08-25 20:43:59.663146409 +0000 ++++ ../MANIFEST.in 2018-08-25 20:44:33.634292853 +0000 +@@ -2,3 +2,4 @@ + include AUTHORS + exclude .gitignore + exclude .github ++recursive-include gnocchi * diff --git a/debian/patches/no-distutils-usage.diff b/debian/patches/no-distutils-usage.diff new file mode 100644 index 0000000000000000000000000000000000000000..594439c91297aabd40d43faf591aed71370f1931 --- /dev/null +++ b/debian/patches/no-distutils-usage.diff @@ -0,0 +1,61 @@ +Description: Avoid using distutils at runtime +Author: Matthias Klose +Forwarded: https://github.com/gnocchixyz/gnocchi/pull/904 +Last-Update: 2018-06-04 + +Index: gnocchi/gnocchi/cli/api.py +=================================================================== +--- gnocchi.orig/gnocchi/cli/api.py ++++ gnocchi/gnocchi/cli/api.py +@@ -14,7 +14,7 @@ + # See the License for the specific language governing permissions and + # limitations under the License. + import copy +-from distutils import spawn ++import shutil + import math + import os + import sys +@@ -78,7 +78,7 @@ def api(): + "No need to pass `--' in gnocchi-api command line anymore, " + "please remove") + +- uwsgi = spawn.find_executable("uwsgi") ++ uwsgi = shutil.which("uwsgi") + if not uwsgi: + LOG.error("Unable to find `uwsgi'.\n" + "Be sure it is installed and in $PATH.") +Index: gnocchi/gnocchi/utils.py +=================================================================== +--- gnocchi.orig/gnocchi/utils.py ++++ gnocchi/gnocchi/utils.py +@@ -15,7 +15,6 @@ + # License for the specific language governing permissions and limitations + # under the License. + import datetime +-import distutils.util + import errno + import itertools + import multiprocessing +@@ -203,10 +202,17 @@ def ensure_paths(paths): + raise + + +-def strtobool(v): +- if isinstance(v, bool): +- return v +- return bool(distutils.util.strtobool(v)) ++def strtobool(val): ++ if isinstance(val, bool): ++ return val ++ # copied from distutils.util ... ++ val = val.lower() ++ if val in ('y', 'yes', 't', 'true', 'on', '1'): ++ return 1 ++ elif val in ('n', 'no', 'f', 'false', 'off', '0'): ++ return 0 ++ else: ++ raise ValueError("invalid truth value %r" % (val,)) + + + class StopWatch(object): diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000000000000000000000000000000000000..2288badfa3e244d7282b0f2ad1b1765f990aafe2 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,2 @@ +no-distutils-usage.diff +install-missing-files.patch diff --git a/debian/python3-gnocchi.install b/debian/python3-gnocchi.install new file mode 100644 index 0000000000000000000000000000000000000000..fb3e550752d07f0231e085eb6153fb53791582ef --- /dev/null +++ b/debian/python3-gnocchi.install @@ -0,0 +1,2 @@ +/usr/bin/* +/usr/lib/python3* diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000000000000000000000000000000000000..ab68be1036e40acfb67486c648b45a6ac786c9fa --- /dev/null +++ b/debian/rules @@ -0,0 +1,124 @@ +#!/usr/bin/make -f + +UPSTREAM_GIT:=https://github.com/gnocchixyz/gnocchi +include /usr/share/openstack-pkg-tools/pkgos.make + +export SETUPTOOLS_SCM_PRETEND_VERSION=$(shell dpkg-parsechangelog -SVersion | sed -e 's/^[[:digit:]]*://' -e 's/[-].*//' -e 's/~/.0/' -e 's/+dfsg1//' | head -n 1) + +UNIT_TEST_BLACKLIST = test_carbonara.CarbonaraCmd.*|.*test_bin\.BinTestCase\.test_gnocchi_config_generator_run.* + +%: + dh $@ --buildsystem=pybuild --with python3,sphinxdoc + +override_dh_clean: + dh_clean + rm -rf build debian/gnocchi-common.postinst debian/gnocchi-common.config debian/gnocchi-api.config debian/gnocchi-api.postinst + rm -rf debian/CHANGEME-common.postrm debian/*.templates debian/po + +override_dh_auto_clean: + echo "Do nothing ..." + +override_dh_auto_build: + /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func gnocchi-common.postinst + /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func gnocchi-common.config + /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func gnocchi-api.postinst + /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func gnocchi-api.config + /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_postrm gnocchi-common.postrm + pkgos-merge-templates gnocchi-api gnocchi endpoint + pkgos-merge-templates gnocchi-common gnocchi db ksat + +override_dh_auto_install: + echo "Do nothing..." + +override_dh_auto_test: + echo "Do nothing..." + +override_dh_install: + set -e ; for pyvers in $(PYTHON3S); do \ + python$$pyvers setup.py install --install-layout=deb --root $(CURDIR)/debian/tmp; \ + done + +ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS))) + echo "Not running unit tests until launching mysql or postgresql is fixed..." +# @echo "===> Running tests" +# set -e ; set -x ; for i in $(PYTHON3S) ; do \ +# PYMAJOR=`echo $$i | cut -d'.' -f1` ; \ +# BINDIR=`pg_config --bindir` ; \ +# PG_MYTMPDIR=`mktemp -d` ; \ +# export LC_ALL="C" ; \ +# export LANGUAGE=C ; \ +# PGSQL_PORT=9823 ; \ +# $$BINDIR/initdb -D $$PG_MYTMPDIR ; \ +# $$BINDIR/pg_ctl -w -D $$PG_MYTMPDIR -o "-k $$PG_MYTMPDIR -p $$PGSQL_PORT" start > /dev/null ; \ +# attempts=0 ; \ +# while ! [ -e $$PG_MYTMPDIR/postmaster.pid ] ; do \ +# if [ $$attempts -gt 10 ] ; then \ +# echo "Exiting test: postgres pid file was not created after 30 seconds" ; \ +# exit 1 ; \ +# fi ; \ +# attempts=$$((attempts+1)) ; \ +# sleep 3 ; \ +# done ; \ +# export GNOCCHI_INDEXER_URL="postgresql:///template1?host=$$PG_MYTMPDIR&port=9823" ; \ +# export GNOCCHI_TEST_STORAGE_DRIVER=file ; \ +# echo "===> Testing with python$$i (python$$PYMAJOR)" ; \ +# rm -rf .testrepository ; \ +# testr-python$$PYMAJOR init ; \ +# TEMP_REZ=`mktemp -t` ; \ +# export PATH=$(PATH):$(CURDIR)/debian/bin && PYTHONPATH=$(CURDIR):$(CURDIR)/debian/bin PYTHON=python$$i testr-python$$PYMAJOR run --subunit 'gnocchi\.tests\.(?!.*('"$(UNIT_TEST_BLACKLIST)"'))' | tee $$TEMP_REZ | subunit2pyunit ; \ +# cat $$TEMP_REZ | subunit-filter -s --no-passthrough | subunit-stats ; \ +# rm -f $$TEMP_REZ ; \ +# testr-python$$PYMAJOR slowest ; \ +# echo "===> Stopping PGSQL" ; \ +# $$BINDIR/pg_ctl stop -D $$PG_MYTMPDIR ; \ +# done +endif + + + mkdir -p $(CURDIR)/debian/tmp/usr/lib/python3/dist-packages/gnocchi/indexer + cp -auxf gnocchi/indexer/alembic $(CURDIR)/debian/tmp/usr/lib/python3/dist-packages/gnocchi/indexer + rm -rf $(CURDIR)/debian/python*-gnocchi/usr/lib/python*/dist-packages/*.pth + rm -rf $(CURDIR)/debian/python*-gnocchi/usr/etc + + mkdir -p $(CURDIR)/debian/gnocchi-common/usr/share/gnocchi-common + PYTHONPATH=$(CURDIR)/debian/tmp/usr/lib/python3/dist-packages oslo-config-generator \ + --output-file $(CURDIR)/debian/gnocchi-common/usr/share/gnocchi-common/gnocchi.conf \ + --wrap-width 140 \ + --namespace gnocchi \ + --namespace oslo.db \ + --namespace oslo.middleware.cors \ + --namespace oslo.middleware.healthcheck \ + --namespace oslo.middleware.http_proxy_to_wsgi \ + --namespace oslo.policy \ + --namespace cotyledon \ + --namespace keystonemiddleware.auth_token + sed -i 's|^[ \t#]*url[ \t#]*=.*|url = sqlite:////var/lib/gnocchi/gnocchidb|' $(CURDIR)/debian/gnocchi-common/usr/share/gnocchi-common/gnocchi.conf + + dh_install + dh_missing + + +override_dh_sphinxdoc: +# echo "===> Starting PGSQL" ; \ +# BINDIR=`pg_config --bindir` ; \ +# PG_MYTMPDIR=`mktemp -d` ; \ +# chown postgres:postgres $$PG_MYTMPDIR || true ; \ +# export PGHOST=$$PG_MYTMPDIR ; \ +# chmod +x debian/start_pg.sh ; \ +# debian/start_pg.sh $$PG_MYTMPDIR ; \ +# export GNOCCHI_TEST_INDEXER_URL="postgresql:///template1?host=$$PG_MYTMPDIR&port=9823" ; \ +# PYTHONPATH=. sphinx-build -b html doc/source debian/python3-gnocchi-doc/usr/share/doc/python3-gnocchi-doc/html ; \ +# dh_sphinxdoc -O--buildsystem=python_distutils ; \ +# $$BINDIR/pg_ctl stop -D $$PG_MYTMPDIR + echo "Do nothing..." + +override_dh_python3: + dh_python3 --shebang=/usr/bin/python3 + +# Commands not to run +override_dh_installcatalogs: +override_dh_installemacsen override_dh_installifupdown: +override_dh_installinfo override_dh_installmenu override_dh_installmime: +override_dh_installmodules override_dh_installpam override_dh_installppp override_dh_installudev override_dh_installwm: +override_dh_installxfonts override_dh_gconf override_dh_icons override_dh_perl override_dh_usrlocal: +override_dh_installgsettings: diff --git a/debian/salsa-ci.yml b/debian/salsa-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..0c22dc4373420a05999d6f9bc2235f73fc0ffa14 --- /dev/null +++ b/debian/salsa-ci.yml @@ -0,0 +1,3 @@ +include: + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000000000000000000000000000000000000..163aaf8d82b6c54f23c45f32895dbdfdcc27b047 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/source/options b/debian/source/options new file mode 100644 index 0000000000000000000000000000000000000000..912224515e06f63403e6e177a39145c46c89344b --- /dev/null +++ b/debian/source/options @@ -0,0 +1,2 @@ +extend-diff-ignore = "^[^/]*[.]egg-info/" +extend-diff-ignore = "^[.]gitreview$" diff --git a/debian/start_pg.sh b/debian/start_pg.sh new file mode 100755 index 0000000000000000000000000000000000000000..ef149f8a1e75d1ea54395c9279e2fccfc52b4e20 --- /dev/null +++ b/debian/start_pg.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# +# Copyright (C) 2014 Thomas Goirand +# +# Runs pgsql server, then use that to run tests. +# + +set -e +set -x + +PG_MYTMPDIR=${1} + +############################## +### RUN THE PGSQL INSTANCE ### +############################## +MYUSER=`whoami` +# initdb refuses to run as root +if [ "${MYUSER}" = "root" ] ; then + echo dropping root privs.. + exec /bin/su postgres -- "$0" "$@" +fi + +BINDIR=`pg_config --bindir` + +# depends on language-pack-en | language-pack-en +# because initdb acquires encoding from locale +export LC_ALL="C" +export LANGUAGE=C +PGSQL_PORT=9823 +${BINDIR}/initdb -D ${PG_MYTMPDIR} + +${BINDIR}/pg_ctl -w -D ${PG_MYTMPDIR} -o "-k ${PG_MYTMPDIR} -p ${PGSQL_PORT}" start > /dev/null +#${BINDIR}/postgres -D ${PG_MYTMPDIR} -h '' -k ${PG_MYTMPDIR} & +attempts=0 +while ! [ -e ${PG_MYTMPDIR}/postmaster.pid ] ; do + attempts=$((attempts+1)) + if [ "${attempts}" -gt 10 ] ; then + echo "Exiting test: postgres pid file was not created after 30 seconds" + exit 1 + fi + sleep 3 + echo `date`: retrying.. +done + +# Set the env. var so that pgsql client doesn't use networking +# libpq uses this for all host params if not explicitly passed +export PGHOST=${PG_MYTMPDIR} + +## Create a new test db +#createuser --superuser nailgun +#createdb -O nailgun nailgun +#export TEST_NAILGUN_DB=nailgun diff --git a/debian/upstream/metadata b/debian/upstream/metadata new file mode 100644 index 0000000000000000000000000000000000000000..05817f9babdc608cae60dfbadd50fd94f8af30de --- /dev/null +++ b/debian/upstream/metadata @@ -0,0 +1,5 @@ +--- +Bug-Database: https://github.com/gnocchixyz/gnocchi/issues +Bug-Submit: https://github.com/gnocchixyz/gnocchi/issues/new +Repository: https://github.com/gnocchixyz/gnocchi.git +Repository-Browse: https://github.com/gnocchixyz/gnocchi diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000000000000000000000000000000000000..360af16cee3787950966bf35ebce0ecfa5184886 --- /dev/null +++ b/debian/watch @@ -0,0 +1,3 @@ +version=3 +opts="uversionmangle=s/\.0rc/~rc/;s/\.0b1/~b1/;s/\.0b2/~b2/;s/\.0b3/~b3/" \ +https://github.com/gnocchixyz/gnocchi/tags .*/(\d[brc\d\.]+)\.tar\.gz diff --git a/devstack/README.rst b/devstack/README.rst deleted file mode 100644 index 1d6c9ed040f7d0f46b753a2f8712703afc0b2256..0000000000000000000000000000000000000000 --- a/devstack/README.rst +++ /dev/null @@ -1,15 +0,0 @@ -============================ -Enabling Gnocchi in DevStack -============================ - -1. Download DevStack:: - - git clone https://git.openstack.org/openstack-dev/devstack.git - cd devstack - -2. Add this repo as an external repository in ``local.conf`` file:: - - [[local|localrc]] - enable_plugin gnocchi https://git.openstack.org/openstack/gnocchi - -3. Run ``stack.sh``. diff --git a/devstack/apache-gnocchi.template b/devstack/apache-gnocchi.template deleted file mode 100644 index bc2887555ad9f60b1c929a0b9beec735242afb5a..0000000000000000000000000000000000000000 --- a/devstack/apache-gnocchi.template +++ /dev/null @@ -1,10 +0,0 @@ - -WSGIDaemonProcess gnocchi lang='en_US.UTF-8' locale='en_US.UTF-8' user=%USER% display-name=%{GROUP} processes=%APIWORKERS% threads=32 %VIRTUALENV% -WSGIProcessGroup gnocchi -WSGIScriptAlias %SCRIPT_NAME% %WSGI% - - WSGIProcessGroup gnocchi - WSGIApplicationGroup %{GLOBAL} - - -WSGISocketPrefix /var/run/%APACHE_NAME% diff --git a/devstack/apache-ported-gnocchi.template b/devstack/apache-ported-gnocchi.template deleted file mode 100644 index 2a56fa8d4a9d8c449265f12081261b29c1ff9c3e..0000000000000000000000000000000000000000 --- a/devstack/apache-ported-gnocchi.template +++ /dev/null @@ -1,15 +0,0 @@ -Listen %GNOCCHI_PORT% - - - WSGIDaemonProcess gnocchi lang='en_US.UTF-8' locale='en_US.UTF-8' user=%USER% display-name=%{GROUP} processes=%APIWORKERS% threads=32 %VIRTUALENV% - WSGIProcessGroup gnocchi - WSGIScriptAlias / %WSGI% - WSGIApplicationGroup %{GLOBAL} - = 2.4> - ErrorLogFormat "%{cu}t %M" - - ErrorLog /var/log/%APACHE_NAME%/gnocchi.log - CustomLog /var/log/%APACHE_NAME%/gnocchi-access.log combined - - -WSGISocketPrefix /var/run/%APACHE_NAME% diff --git a/devstack/gate/gate_hook.sh b/devstack/gate/gate_hook.sh deleted file mode 100755 index 905f8fa53bff1d9f0140da45a404cd1b386605e6..0000000000000000000000000000000000000000 --- a/devstack/gate/gate_hook.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -# This script is executed inside gate_hook function in devstack gate. - -STORAGE_DRIVER="$1" -SQL_DRIVER="$2" - -ENABLED_SERVICES="key,gnocchi-api,gnocchi-metricd," - -export DEVSTACK_GATE_INSTALL_TESTONLY=1 -export DEVSTACK_GATE_NO_SERVICES=1 -export DEVSTACK_GATE_TEMPEST=0 -export DEVSTACK_GATE_EXERCISES=0 -export KEEP_LOCALRC=1 - -case $STORAGE_DRIVER in - file) - DEVSTACK_LOCAL_CONFIG+=$'\nexport GNOCCHI_STORAGE_BACKEND=file' - ;; - swift) - ENABLED_SERVICES+="s-proxy,s-account,s-container,s-object," - DEVSTACK_LOCAL_CONFIG+=$'\nexport GNOCCHI_STORAGE_BACKEND=swift' - # FIXME(sileht): use mod_wsgi as workaround for LP#1508424 - DEVSTACK_GATE_TEMPEST+=$'\nexport SWIFT_USE_MOD_WSGI=True' - ;; - ceph) - ENABLED_SERVICES+="ceph" - DEVSTACK_LOCAL_CONFIG+=$'\nexport GNOCCHI_STORAGE_BACKEND=ceph' - ;; - influxdb) - DEVSTACK_LOCAL_CONFIG+=$'\nexport GNOCCHI_STORAGE_BACKEND=influxdb' - ;; -esac - - -# default to mysql -case $SQL_DRIVER in - postgresql) - export DEVSTACK_GATE_POSTGRES=1 - ;; -esac - -export ENABLED_SERVICES -export DEVSTACK_LOCAL_CONFIG - -$BASE/new/devstack-gate/devstack-vm-gate.sh diff --git a/devstack/gate/post_test_hook.sh b/devstack/gate/post_test_hook.sh deleted file mode 100755 index 1cb80da3cfb71e622ff303b5813e2b91af8d907e..0000000000000000000000000000000000000000 --- a/devstack/gate/post_test_hook.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -# This script is executed inside post_test_hook function in devstack gate. - -source $BASE/new/devstack/openrc admin admin - -set -e - -function generate_testr_results { - if [ -f .testrepository/0 ]; then - sudo /usr/os-testr-env/bin/testr last --subunit > $WORKSPACE/testrepository.subunit - sudo mv $WORKSPACE/testrepository.subunit $BASE/logs/testrepository.subunit - sudo /usr/os-testr-env/bin/subunit2html $BASE/logs/testrepository.subunit $BASE/logs/testr_results.html - sudo gzip -9 $BASE/logs/testrepository.subunit - sudo gzip -9 $BASE/logs/testr_results.html - sudo chown jenkins:jenkins $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz - sudo chmod a+r $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz - fi -} - -set -x - -export GNOCCHI_DIR="$BASE/new/gnocchi" -sudo chown -R stack:stack $GNOCCHI_DIR -cd $GNOCCHI_DIR - -openstack catalog list - -export GNOCCHI_SERVICE_TOKEN=$(openstack token issue -c id -f value) -export GNOCCHI_SERVICE_URL=$(openstack catalog show metric -c endpoints -f value | awk '/public/{print $2}') - -curl -X GET ${GNOCCHI_SERVICE_URL}/v1/archive_policy -H "Content-Type: application/json" - - -# Run tests -echo "Running gnocchi functional test suite" -set +e -sudo -E -H -u stack tox -epy27-gate -EXIT_CODE=$? -set -e - -# Collect and parse result -generate_testr_results -exit $EXIT_CODE diff --git a/devstack/plugin.sh b/devstack/plugin.sh deleted file mode 100644 index 4c91e7a10d8d321e57ad3ece5c85593ac2827406..0000000000000000000000000000000000000000 --- a/devstack/plugin.sh +++ /dev/null @@ -1,463 +0,0 @@ -# Gnocchi devstack plugin -# Install and start **Gnocchi** service - -# To enable Gnocchi service, add the following to localrc: -# -# enable_plugin gnocchi https://github.com/openstack/gnocchi master -# -# This will turn on both gnocchi-api and gnocchi-metricd services. -# If you don't want one of those (you do) you can use the -# disable_service command in local.conf. - -# Dependencies: -# -# - functions -# - ``functions`` -# - ``DEST``, ``STACK_USER`` must be defined -# - ``APACHE_NAME`` for wsgi -# - ``SERVICE_{TENANT_NAME|PASSWORD}`` must be defined -# - ``SERVICE_HOST`` -# - ``OS_AUTH_URL``, ``KEYSTONE_SERVICE_URI`` for auth in api - -# stack.sh -# --------- -# - install_gnocchi -# - configure_gnocchi -# - init_gnocchi -# - start_gnocchi -# - stop_gnocchi -# - cleanup_gnocchi - -# Save trace setting -XTRACE=$(set +o | grep xtrace) -set -o xtrace - - -# Defaults -# -------- -GITDIR["python-gnocchiclient"]=$DEST/python-gnocchiclient -GITREPO["python-gnocchiclient"]=${GNOCCHICLIENT_REPO:-${GIT_BASE}/openstack/python-gnocchiclient.git} - -# Functions -# --------- - -# Test if any Gnocchi services are enabled -# is_gnocchi_enabled -function is_gnocchi_enabled { - [[ ,${ENABLED_SERVICES} =~ ,"gnocchi-" ]] && return 0 - return 1 -} - -# create_gnocchi_accounts() - Set up common required gnocchi accounts - -# Project User Roles -# ------------------------------------------------------------------------- -# $SERVICE_TENANT_NAME gnocchi service -# gnocchi_swift gnocchi_swift ResellerAdmin (if Swift is enabled) -function create_gnocchi_accounts { - # Gnocchi - if is_service_enabled key && is_service_enabled gnocchi-api - then - create_service_user "gnocchi" - - local gnocchi_service=$(get_or_create_service "gnocchi" \ - "metric" "OpenStack Metric Service") - get_or_create_endpoint $gnocchi_service \ - "$REGION_NAME" \ - "$(gnocchi_service_url)" \ - "$(gnocchi_service_url)" \ - "$(gnocchi_service_url)" - - if is_service_enabled swift && [[ "$GNOCCHI_STORAGE_BACKEND" = 'swift' ]] ; then - get_or_create_project "gnocchi_swift" default - local gnocchi_swift_user=$(get_or_create_user "gnocchi_swift" \ - "$SERVICE_PASSWORD" default "gnocchi_swift@example.com") - get_or_add_user_project_role "ResellerAdmin" $gnocchi_swift_user "gnocchi_swift" - fi - fi -} - -# return the service url for gnocchi -function gnocchi_service_url { - if [[ -n $GNOCCHI_SERVICE_PORT ]]; then - echo "$GNOCCHI_SERVICE_PROTOCOL://$GNOCCHI_SERVICE_HOST:$GNOCCHI_SERVICE_PORT" - else - echo "$GNOCCHI_SERVICE_PROTOCOL://$GNOCCHI_SERVICE_HOST$GNOCCHI_SERVICE_PREFIX" - fi -} - -function install_gnocchiclient { - if use_library_from_git python-gnocchiclient; then - git_clone_by_name python-gnocchiclient - setup_dev_lib python-gnocchiclient - else - pip_install gnocchiclient - fi -} - -# install redis -# NOTE(chdent): We shouldn't rely on ceilometer being present so cannot -# use its install_redis. There are enough packages now using redis -# that there should probably be something devstack itself for -# installing it. -function _gnocchi_install_redis { - if is_ubuntu; then - install_package redis-server - restart_service redis-server - else - # This will fail (correctly) where a redis package is unavailable - install_package redis - restart_service redis - fi - - pip_install_gr redis -} - -# install influxdb -# NOTE(chdent): InfluxDB is not currently packaged by the distro at the -# version that gnocchi needs. Until that is true we're downloading -# the debs and rpms packaged by the InfluxDB company. When it is -# true this method can be changed to be similar to -# _gnocchi_install_redis above. -function _gnocchi_install_influxdb { - if is_package_installed influxdb; then - echo "influxdb already installed" - else - local file=$(mktemp /tmp/influxpkg-XXXXX) - - if is_ubuntu; then - wget -O $file $GNOCCHI_INFLUXDB_DEB_PKG - sudo dpkg -i $file - elif is_fedora; then - wget -O $file $GNOCCHI_INFLUXDB_RPM_PKG - sudo rpm -i $file - fi - rm $file - fi - - # restart influxdb via its initscript - sudo /opt/influxdb/init.sh restart -} - -function _gnocchi_install_grafana { - if is_ubuntu; then - local file=$(mktemp /tmp/grafanapkg-XXXXX) - wget -O "$file" "$GRAFANA_DEB_PKG" - sudo dpkg -i "$file" - rm $file - elif is_fedora; then - sudo yum install "$GRAFANA_RPM_PKG" - fi - - git_clone ${GRAFANA_PLUGINS_REPO} ${GRAFANA_PLUGINS_DIR} - # Grafana-server does not handle symlink :( - sudo mkdir -p /usr/share/grafana/public/app/plugins/datasource/gnocchi - sudo mount -o bind ${GRAFANA_PLUGINS_DIR}/datasources/gnocchi /usr/share/grafana/public/app/plugins/datasource/gnocchi - - sudo service grafana-server restart -} - -# remove the influxdb database -function _gnocchi_cleanup_influxdb { - curl -G 'http://localhost:8086/query' --data-urlencode "q=DROP DATABASE $GNOCCHI_INFLUXDB_DBNAME" -} - -function _cleanup_gnocchi_apache_wsgi { - sudo rm -f $GNOCCHI_WSGI_DIR/*.wsgi - sudo rm -f $(apache_site_config_for gnocchi) -} - -# _config_gnocchi_apache_wsgi() - Set WSGI config files of Gnocchi -function _config_gnocchi_apache_wsgi { - sudo mkdir -p $GNOCCHI_WSGI_DIR - - local gnocchi_apache_conf=$(apache_site_config_for gnocchi) - local venv_path="" - local script_name=$GNOCCHI_SERVICE_PREFIX - - if [[ ${USE_VENV} = True ]]; then - venv_path="python-path=${PROJECT_VENV["gnocchi"]}/lib/$(python_version)/site-packages" - fi - - # copy wsgi file - sudo cp $GNOCCHI_DIR/gnocchi/rest/app.wsgi $GNOCCHI_WSGI_DIR/ - - # Only run the API on a custom PORT if it has been specifically - # asked for. - if [[ -n $GNOCCHI_SERVICE_PORT ]]; then - sudo cp $GNOCCHI_DIR/devstack/apache-ported-gnocchi.template $gnocchi_apache_conf - sudo sed -e " - s|%GNOCCHI_PORT%|$GNOCCHI_SERVICE_PORT|g; - " -i $gnocchi_apache_conf - else - sudo cp $GNOCCHI_DIR/devstack/apache-gnocchi.template $gnocchi_apache_conf - sudo sed -e " - s|%SCRIPT_NAME%|$script_name|g; - " -i $gnocchi_apache_conf - fi - sudo sed -e " - s|%APACHE_NAME%|$APACHE_NAME|g; - s|%WSGI%|$GNOCCHI_WSGI_DIR/app.wsgi|g; - s|%USER%|$STACK_USER|g - s|%APIWORKERS%|$API_WORKERS|g - s|%VIRTUALENV%|$venv_path|g - " -i $gnocchi_apache_conf -} - - - -# cleanup_gnocchi() - Remove residual data files, anything left over from previous -# runs that a clean run would need to clean up -function cleanup_gnocchi { - if [ "$GNOCCHI_USE_MOD_WSGI" == "True" ]; then - _cleanup_gnocchi_apache_wsgi - fi -} - -# configure_gnocchi() - Set config files, create data dirs, etc -function configure_gnocchi { - [ ! -d $GNOCCHI_DATA_DIR ] && sudo mkdir -m 755 -p $GNOCCHI_DATA_DIR - sudo chown $STACK_USER $GNOCCHI_DATA_DIR - - # Configure logging - iniset $GNOCCHI_CONF DEFAULT verbose True - iniset $GNOCCHI_CONF DEFAULT debug "$ENABLE_DEBUG_LOG_LEVEL" - - # Install the configuration files - cp $GNOCCHI_DIR/etc/gnocchi/* $GNOCCHI_CONF_DIR - - - if [ -n "$GNOCCHI_COORDINATOR_URL" ]; then - iniset $GNOCCHI_CONF storage coordination_url "$GNOCCHI_COORDINATOR_URL" - fi - - # Configure auth token middleware - configure_auth_token_middleware $GNOCCHI_CONF gnocchi $GNOCCHI_AUTH_CACHE_DIR - - if is_service_enabled gnocchi-statsd ; then - iniset $GNOCCHI_CONF statsd resource_id $GNOCCHI_STATSD_RESOURCE_ID - iniset $GNOCCHI_CONF statsd project_id $GNOCCHI_STATSD_PROJECT_ID - iniset $GNOCCHI_CONF statsd user_id $GNOCCHI_STATSD_USER_ID - fi - - # Configure the storage driver - if is_service_enabled ceph && [[ "$GNOCCHI_STORAGE_BACKEND" = 'ceph' ]] ; then - iniset $GNOCCHI_CONF storage driver ceph - iniset $GNOCCHI_CONF storage ceph_username ${GNOCCHI_CEPH_USER} - iniset $GNOCCHI_CONF storage ceph_secret $(awk '/key/{print $3}' ${CEPH_CONF_DIR}/ceph.client.${GNOCCHI_CEPH_USER}.keyring) - elif is_service_enabled swift && [[ "$GNOCCHI_STORAGE_BACKEND" = 'swift' ]] ; then - iniset $GNOCCHI_CONF storage driver swift - iniset $GNOCCHI_CONF storage swift_user gnocchi_swift - iniset $GNOCCHI_CONF storage swift_key $SERVICE_PASSWORD - iniset $GNOCCHI_CONF storage swift_tenant_name "gnocchi_swift" - iniset $GNOCCHI_CONF storage swift_auth_version 2 - iniset $GNOCCHI_CONF storage swift_authurl $KEYSTONE_SERVICE_URI/v2.0/ - elif [[ "$GNOCCHI_STORAGE_BACKEND" = 'file' ]] ; then - iniset $GNOCCHI_CONF storage driver file - iniset $GNOCCHI_CONF storage file_basepath $GNOCCHI_DATA_DIR/ - elif [[ "$GNOCCHI_STORAGE_BACKEND" == 'influxdb' ]] ; then - iniset $GNOCCHI_CONF storage driver influxdb - iniset $GNOCCHI_CONF storage influxdb_database $GNOCCHI_INFLUXDB_DBNAME - else - echo "ERROR: could not configure storage driver" - exit 1 - fi - - if is_service_enabled key; then - if is_service_enabled gnocchi-grafana; then - iniset $GNOCCHI_PASTE_CONF pipeline:main pipeline "cors gnocchi+auth" - iniset $KEYSTONE_CONF cors allowed_origin ${GRAFANA_URL} - iniset $GNOCCHI_CONF cors allowed_origin ${GRAFANA_URL} - iniset $GNOCCHI_CONF cors allow_methods GET,POST,PUT,DELETE,OPTIONS,HEAD,PATCH - iniset $GNOCCHI_CONF cors allow_headers Content-Type,Cache-Control,Content-Language,Expires,Last-Modified,Pragma,X-Auth-Token,X-Subject-Token - else - iniset $GNOCCHI_PASTE_CONF pipeline:main pipeline gnocchi+auth - fi - else - iniset $GNOCCHI_PASTE_CONF pipeline:main pipeline gnocchi+noauth - fi - - # Configure the indexer database - iniset $GNOCCHI_CONF indexer url `database_connection_url gnocchi` - - if [ "$GNOCCHI_USE_MOD_WSGI" == "True" ]; then - _config_gnocchi_apache_wsgi - fi -} - -# configure_ceph_gnocchi() - gnocchi config needs to come after gnocchi is set up -function configure_ceph_gnocchi { - # Configure gnocchi service options, ceph pool, ceph user and ceph key - sudo ceph -c ${CEPH_CONF_FILE} osd pool create ${GNOCCHI_CEPH_POOL} ${GNOCCHI_CEPH_POOL_PG} ${GNOCCHI_CEPH_POOL_PGP} - sudo ceph -c ${CEPH_CONF_FILE} osd pool set ${GNOCCHI_CEPH_POOL} size ${CEPH_REPLICAS} - if [[ $CEPH_REPLICAS -ne 1 ]]; then - sudo ceph -c ${CEPH_CONF_FILE} osd pool set ${GNOCCHI_CEPH_POOL} crush_ruleset ${RULE_ID} - - fi - sudo ceph -c ${CEPH_CONF_FILE} auth get-or-create client.${GNOCCHI_CEPH_USER} mon "allow r" osd "allow class-read object_prefix rbd_children, allow rwx pool=${GNOCCHI_CEPH_POOL}" | sudo tee ${CEPH_CONF_DIR}/ceph.client.${GNOCCHI_CEPH_USER}.keyring - sudo chown ${STACK_USER}:$(id -g -n $whoami) ${CEPH_CONF_DIR}/ceph.client.${GNOCCHI_CEPH_USER}.keyring -} - - -# init_gnocchi() - Initialize etc. -function init_gnocchi { - # Create cache dir - sudo mkdir -p $GNOCCHI_AUTH_CACHE_DIR - sudo chown $STACK_USER $GNOCCHI_AUTH_CACHE_DIR - rm -f $GNOCCHI_AUTH_CACHE_DIR/* - - if is_service_enabled mysql postgresql; then - recreate_database gnocchi - fi - $GNOCCHI_BIN_DIR/gnocchi-upgrade -} - -function preinstall_gnocchi { - # Needed to build psycopg2 - if is_ubuntu; then - install_package libpq-dev - else - install_package postgresql-devel - fi - if [[ "$GNOCCHI_STORAGE_BACKEND" = 'ceph' ]] ; then - install_package cython - install_package librados-dev - fi -} - -# install_gnocchi() - Collect source and prepare -function install_gnocchi { - if [ "${GNOCCHI_COORDINATOR_URL%%:*}" == "redis" ]; then - _gnocchi_install_redis - fi - - if [[ "${GNOCCHI_STORAGE_BACKEND}" == 'influxdb' ]] ; then - _gnocchi_install_influxdb - pip_install influxdb - fi - - if [[ "$GNOCCHI_STORAGE_BACKEND" = 'ceph' ]] ; then - pip_install cradox - fi - - if is_service_enabled gnocchi-grafana - then - _gnocchi_install_grafana - fi - - install_gnocchiclient - - is_service_enabled key && EXTRA_FLAVOR=,keystonmiddleware - - # We don't use setup_package because we don't follow openstack/requirements - sudo -H pip install -e "$GNOCCHI_DIR"[test,$GNOCCHI_STORAGE_BACKEND,${DATABASE_TYPE}${EXTRA_FLAVOR}] - - if [ "$GNOCCHI_USE_MOD_WSGI" == "True" ]; then - install_apache_wsgi - fi - - # Create configuration directory - [ ! -d $GNOCCHI_CONF_DIR ] && sudo mkdir -m 755 -p $GNOCCHI_CONF_DIR - sudo chown $STACK_USER $GNOCCHI_CONF_DIR -} - -# start_gnocchi() - Start running processes, including screen -function start_gnocchi { - - if [ "$GNOCCHI_USE_MOD_WSGI" == "True" ]; then - enable_apache_site gnocchi - restart_apache_server - if [[ -n $GNOCCHI_SERVICE_PORT ]]; then - tail_log gnocchi /var/log/$APACHE_NAME/gnocchi.log - tail_log gnocchi-api /var/log/$APACHE_NAME/gnocchi-access.log - else - # NOTE(chdent): At the moment this is very noisy as it - # will tail the entire apache logs, not just the gnocchi - # parts. If you don't like this either USE_SCREEN=False - # or set GNOCCHI_SERVICE_PORT. - tail_log gnocchi /var/log/$APACHE_NAME/error[_\.]log - tail_log gnocchi-api /var/log/$APACHE_NAME/access[_\.]log - fi - else - run_process gnocchi-api "$GNOCCHI_BIN_DIR/gnocchi-api -d -v --config-file $GNOCCHI_CONF" - fi - # only die on API if it was actually intended to be turned on - if is_service_enabled gnocchi-api; then - - echo "Waiting for gnocchi-api to start..." - if ! timeout $SERVICE_TIMEOUT sh -c "while ! curl -v --max-time 5 --noproxy '*' -s $(gnocchi_service_url)/v1/resource/generic ; do sleep 1; done"; then - die $LINENO "gnocchi-api did not start" - fi - fi - - # Create a default policy - if ! is_service_enabled key; then - export OS_AUTH_TYPE=gnocchi-noauth - export GNOCCHI_USER_ID=`uuidgen` - export GNOCCHI_PROJECT_ID=`uuidgen` - export GNOCCHI_ENDPOINT="$(gnocchi_service_url)" - fi - - # run metricd last so we are properly waiting for swift and friends - run_process gnocchi-metricd "$GNOCCHI_BIN_DIR/gnocchi-metricd -d -v --config-file $GNOCCHI_CONF" - run_process gnocchi-statsd "$GNOCCHI_BIN_DIR/gnocchi-statsd -d -v --config-file $GNOCCHI_CONF" -} - -# stop_gnocchi() - Stop running processes -function stop_gnocchi { - if [ "$GNOCCHI_USE_MOD_WSGI" == "True" ]; then - disable_apache_site gnocchi - restart_apache_server - fi - # Kill the gnocchi screen windows - for serv in gnocchi-api; do - stop_process $serv - done - - if [[ "${GNOCCHI_STORAGE_BACKEND}" == 'influxdb' ]] ; then - _gnocchi_cleanup_influxdb - fi - - if is_service_enabled gnocchi-grafana; then - sudo umount /usr/share/grafana/public/app/plugins/datasource/gnocchi - fi -} - -if is_service_enabled gnocchi-api; then - if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then - echo_summary "Configuring system services for Gnocchi" - preinstall_gnocchi - elif [[ "$1" == "stack" && "$2" == "install" ]]; then - echo_summary "Installing Gnocchi" - stack_install_service gnocchi - elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then - echo_summary "Configuring Gnocchi" - configure_gnocchi - create_gnocchi_accounts - if is_service_enabled ceph && [[ "$GNOCCHI_STORAGE_BACKEND" = 'ceph' ]] ; then - echo_summary "Configuring Gnocchi for Ceph" - configure_ceph_gnocchi - fi - elif [[ "$1" == "stack" && "$2" == "extra" ]]; then - echo_summary "Initializing Gnocchi" - init_gnocchi - start_gnocchi - fi - - if [[ "$1" == "unstack" ]]; then - echo_summary "Stopping Gnocchi" - stop_gnocchi - fi - - if [[ "$1" == "clean" ]]; then - cleanup_gnocchi - fi -fi - -# Restore xtrace -$XTRACE - -# Tell emacs to use shell-script-mode -## Local variables: -## mode: shell-script -## End: diff --git a/devstack/settings b/devstack/settings deleted file mode 100644 index 2a74165e0eef953079e886f4960108352cf2dd2f..0000000000000000000000000000000000000000 --- a/devstack/settings +++ /dev/null @@ -1,58 +0,0 @@ -enable_service gnocchi-api -enable_service gnocchi-metricd -enable_service gnocchi-statsd - -# Set up default directories -GNOCCHI_DIR=$DEST/gnocchi -GNOCCHI_CONF_DIR=/etc/gnocchi -GNOCCHI_CONF=$GNOCCHI_CONF_DIR/gnocchi.conf -GNOCCHI_PASTE_CONF=$GNOCCHI_CONF_DIR/api-paste.ini -GNOCCHI_LOG_DIR=/var/log/gnocchi -GNOCCHI_AUTH_CACHE_DIR=${GNOCCHI_AUTH_CACHE_DIR:-/var/cache/gnocchi} -GNOCCHI_WSGI_DIR=${GNOCCHI_WSGI_DIR:-/var/www/gnocchi} -GNOCCHI_DATA_DIR=${GNOCCHI_DATA_DIR:-${DATA_DIR}/gnocchi} - -# Toggle for deploying Gnocchi under HTTPD + mod_wsgi -GNOCCHI_USE_MOD_WSGI=${GNOCCHI_USE_MOD_WSGI:-${ENABLE_HTTPD_MOD_WSGI_SERVICES}} - -# Support potential entry-points console scripts and venvs -if [[ ${USE_VENV} = True ]]; then - PROJECT_VENV["gnocchi"]=${GNOCCHI_DIR}.venv - GNOCCHI_BIN_DIR=${PROJECT_VENV["gnocchi"]}/bin -else - GNOCCHI_BIN_DIR=$(get_python_exec_prefix) -fi - - -# Gnocchi connection info. -GNOCCHI_SERVICE_PROTOCOL=http -# NOTE(chdent): If you are not using mod wsgi you need to set port! -GNOCCHI_SERVICE_PORT=${GNOCCHI_SERVICE_PORT:-8041} -GNOCCHI_SERVICE_PREFIX=${GNOCCHI_SERVICE_PREFIX:-'/metric'} -GNOCCHI_SERVICE_HOST=$SERVICE_HOST - -# Gnocchi statsd info -GNOCCHI_STATSD_RESOURCE_ID=${GNOCCHI_STATSD_RESOURCE_ID:-$(uuidgen)} -GNOCCHI_STATSD_USER_ID=${GNOCCHI_STATSD_USER_ID:-$(uuidgen)} -GNOCCHI_STATSD_PROJECT_ID=${GNOCCHI_STATSD_PROJECT_ID:-$(uuidgen)} - -# ceph gnocchi info -GNOCCHI_CEPH_USER=${GNOCCHI_CEPH_USER:-gnocchi} -GNOCCHI_CEPH_POOL=${GNOCCHI_CEPH_POOL:-gnocchi} -GNOCCHI_CEPH_POOL_PG=${GNOCCHI_CEPH_POOL_PG:-8} -GNOCCHI_CEPH_POOL_PGP=${GNOCCHI_CEPH_POOL_PGP:-8} - -# Gnocchi backend -GNOCCHI_STORAGE_BACKEND=${GNOCCHI_STORAGE_BACKEND:-file} - -# InfluxDB Settings -GNOCCHI_INFLUXDB_DBNAME=${GNOCCHI_INFLUXDB_DBNAME:-gnocchidevstack} -GNOCCHI_INFLUXDB_RPM_PKG=${GNOCCHI_INFLUXDB_RPM_PKG:-https://s3.amazonaws.com/influxdb/influxdb-0.9.4.2-1.x86_64.rpm} -GNOCCHI_INFLUXDB_DEB_PKG=${GNOCCHI_INFLUXDB_DEB_PKG:-https://s3.amazonaws.com/influxdb/influxdb_0.9.4.2_amd64.deb} - -# Grafana settings -GRAFANA_RPM_PKG=${GRAFANA_RPM_PKG:-https://grafanarel.s3.amazonaws.com/builds/grafana-2.6.0-1.x86_64.rpm} -GRAFANA_DEB_PKG=${GRAFANA_DEB_PKG:-https://grafanarel.s3.amazonaws.com/builds/grafana_2.6.0_amd64.deb} -GRAFANA_PLUGINS_DIR=${GRAFANA_PLUGINS_DIR:-$DEST/grafana-plugins} -GRAFANA_PLUGINS_REPO=${GRAFANA_PLUGINS_REPO:-http://github.com/sileht/grafana-plugins-gnocchi.git} -GRAFANA_URL=${GRAFANA_URL:-http://$HOST_IP:3000} diff --git a/doc/source/_static/architecture.svg b/doc/source/_static/architecture.svg new file mode 100644 index 0000000000000000000000000000000000000000..c883481efd1c6a0c279997892f775730e3fab798 --- /dev/null +++ b/doc/source/_static/architecture.svg @@ -0,0 +1,4 @@ + + + + diff --git a/doc/source/_static/gnocchi-icon-source.png b/doc/source/_static/gnocchi-icon-source.png new file mode 100644 index 0000000000000000000000000000000000000000..d6108c4182d54422ec09aa935f2fd0594aa2d68f Binary files /dev/null and b/doc/source/_static/gnocchi-icon-source.png differ diff --git a/doc/source/_static/gnocchi-icon.ico b/doc/source/_static/gnocchi-icon.ico new file mode 100644 index 0000000000000000000000000000000000000000..783bde939396df274f409f34cfbae74b43b0aa68 Binary files /dev/null and b/doc/source/_static/gnocchi-icon.ico differ diff --git a/doc/source/_static/gnocchi-logo.png b/doc/source/_static/gnocchi-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..e3fc8903851d419a6f0d64c8d79f7d9d6c2042f6 Binary files /dev/null and b/doc/source/_static/gnocchi-logo.png differ diff --git a/doc/source/_static/grafana-screenshot.png b/doc/source/_static/grafana-screenshot.png new file mode 100644 index 0000000000000000000000000000000000000000..c2c07af9c62cc558489a6939fc2903c132a47ca2 Binary files /dev/null and b/doc/source/_static/grafana-screenshot.png differ diff --git a/doc/source/alternatives.rst b/doc/source/alternatives.rst new file mode 100644 index 0000000000000000000000000000000000000000..9fe9cad4fa1449833f8d77e70f46ce79fa022b46 --- /dev/null +++ b/doc/source/alternatives.rst @@ -0,0 +1,56 @@ +Comparisons To Alternatives +--------------------------- + +The following table summarises feature comparison between different existing +open source time series database. More details are written below, if needed. + +.. include:: comparison-table.rst + +Gnocchi vs Prometheus +~~~~~~~~~~~~~~~~~~~~~ +`Prometheus `_ is a full-featured solution that +includes everything from polling the metrics to storing and archiving them. It +offers advanced features such as alerting. + +In comparison, Gnocchi does not offer polling as it prefers to leverage +existing solutions (e.g. `collectd `_). However, it +provides high-availability and horizontal scalablity as well as multi-tenancy. + + +Gnocchi vs InfluxDB +~~~~~~~~~~~~~~~~~~~ + +`InfluxDB `_ is a time series database storing metrics +into local files. It offers a variety of input protocol support and created its +own query language, InfluxQL, inspired from SQL. The HTTP API it offers is just +a way to pass InfluxQL over the wire. Horizontal scalability is only provided +in the commercial version. The data model is based on time series with labels +associated to it. + +In comparison, Gnocchi offers scalability and multi-tenancy. Its data model +differs as it does not provide labels, but |resources| to attach to |metrics|. + +Gnocchi vs OpenTSDB +~~~~~~~~~~~~~~~~~~~ + +`OpenTSDB `_ is a distributed time series database that +uses `Hadoop `_ and `HBase +`_ to store its data. That makes it easy to scale +horizontally. However, its querying feature are rather simple. + +In comparison, Gnocchi offers a proper query language with more features. The +usage of Hadoop might be a show-stopper for many as it's quite heavy to deploy +and operate. + +Gnocchi vs Graphite +~~~~~~~~~~~~~~~~~~~ + +`Graphite `_ is essentially a data +metric storage composed of flat files (Whisper), and focuses on rendering those +time series. Each time series stored is composed of points that are stored +regularly and are related to the current date and time. + +In comparison, Gnocchi offers much more scalability, a better file format and +no relativity to the current time and date. + +.. include:: include/term-substitution.rst diff --git a/doc/source/amqp1d.rst b/doc/source/amqp1d.rst new file mode 100644 index 0000000000000000000000000000000000000000..200cbf748bfd728c9c607361e1778857a1dd5bb4 --- /dev/null +++ b/doc/source/amqp1d.rst @@ -0,0 +1,37 @@ +===================== +AMQP 1.0 Daemon Usage +===================== + +Gnocchi provides a daemon `gnocchi-amqp1d` that is compatible with the `AMQP +1.0`_ (Advanced Messaging Queuing Protocol 1.0 (ISO/IEC 19464)) protocol and +can listen to |metrics| sent over the network via the amqp1 `collectd`_ plugin +named `amqp1`_. + +.. _`amqp1`: https://github.com/collectd/collectd/blob/master/src/amqp1.c +.. _`collectd`: https://github.com/collectd/collectd +.. _`AMQP 1.0`: https://www.amqp.org/resources/specifications + +`amqp1` collectd write plugin enables collectd output to be sent to an Advanced +Messaging Queuing Protocol 1.0 intermediary such as the Apache Qpid Dispatch +Router or Apache Artemis Broker. + +How It Works? +============= +In order to enable amqp1d support in Gnocchi, you need to configure the +`[amqp1d]` option group in the configuration file. You need to provide a +host with port and topic name that amqp1 collectd plugin is publishing metric +to and a |resource| name that will be used as the main |resource| where all +the |metrics| will be attached with host name as an attribute, a user and +project id that will be associated with the |resource| and |metrics|, +and an |archive policy| name that will be used to create the |metrics|. + +All the |metrics| will be created dynamically as the |metrics| are sent to +`gnocchi-amqp1d`, and attached with the source host name to the |resource| +name you configured. + +To use it, Gnocchi must be installed with the `amqp1` flavor:: + + pip install -e .[postgresql,file,amqp1] + + +.. include:: include/term-substitution.rst diff --git a/doc/source/architecture.rst b/doc/source/architecture.rst deleted file mode 100644 index 22f7e0b2a8368ea8f90d0d1a528ff9b0e7efe4d3..0000000000000000000000000000000000000000 --- a/doc/source/architecture.rst +++ /dev/null @@ -1,117 +0,0 @@ -====================== - Project Architecture -====================== - -Gnocchi consists of several services: a HTTP REST API (see :doc:`rest`), an -optional statsd-compatible daemon (see :doc:`statsd`), and an asynchronous -processing daemon. Data is received via the HTTP REST API and statsd daemon. -The asynchronous processing daemon, called `gnocchi-metricd`, performs -operations (statistics computing, metric cleanup, etc...) on the received data -in the background. - -Both the HTTP REST API and the asynchronous processing daemon are stateless and -are scalable. Additional workers can be added depending on load. - - -Back-ends ---------- - -Gnocchi uses two different back-end for storing data: one for storing the time -series (the storage driver) and one for indexing the data (the index driver). - -The *storage* is responsible for storing measures of created metrics. It -receives timestamps and values, and pre-computes aggregations according to -the defined archive policies. - -The *indexer* is responsible for storing the index of all resources, along with -their types and properties. Gnocchi only knows about resource types from the -OpenStack project, but also provides a *generic* type so you can create basic -resources and handle the resource properties yourself. The indexer is also -responsible for linking resources with metrics. - -How to choose back-ends -~~~~~~~~~~~~~~~~~~~~~~~ - -Gnocchi currently offers 4 storage drivers: - -* File -* Swift -* Ceph (preferred) -* InfluxDB (experimental) - -The first three drivers are based on an intermediate library, named -*Carbonara*, which handles the time series manipulation, since none of these -storage technologies handle time series natively. `InfluxDB`_ does not need -this layer since it is itself a time series database. However, The InfluxDB -driver is still experimental and suffers from bugs in InfluxDB itself that are -yet to be fixed as of this writing. - -The three *Carbonara* based drivers are working well and are as scalable as -their back-end technology permits. Ceph and Swift are inherently more scalable -than the file driver. - -Depending on the size of your architecture, using the file driver and storing -your data on a disk might be enough. If you need to scale the number of server -with the file driver, you can export and share the data via NFS among all -Gnocchi processes. In any case, it is obvious that Ceph and Swift drivers are -largely more scalable. Ceph also offers better consistency, and hence is the -recommended driver. - -.. _InfluxDB: http://influxdb.com - -How to plan for Gnocchi’s storage -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Gnocchi uses a custom file format based on its library *Carbonara*. In Gnocchi, -a time series is a collection of points, where a point is a given measure, or -sample, in the lifespan of a time series. The storage format is compressed -using various techniques, therefore the computing of a time series' size can -be estimated based on its worst case scenario with the following formula:: - - number of points × 9 bytes = size in bytes - -The number of points you want to keep is usually determined by the following -formula:: - - number of points = timespan ÷ granularity - -For example, if you want to keep a year of data with a one minute resolution:: - - number of points = (365 days × 24 hours × 60 minutes) ÷ 1 minute - number of points = 525 600 - -Then:: - - size in bytes = 525 600 × 9 = 4 730 400 bytes = 4 620 KiB - -This is just for a single aggregated time series. If your archive policy uses -the 8 default aggregation methods (mean, min, max, sum, std, median, count, -95pct) with the same "one year, one minute aggregations" resolution, the space -used will go up to a maximum of 8 × 4.5 MiB = 36 MiB. - -How to set the archive policy and granularity -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -In Gnocchi, the archive policy is expressed in number of points. If your -archive policy defines a policy of 10 points with a granularity of 1 second, -the time series archive will keep up to 10 seconds, each representing an -aggregation over 1 second. This means the time series will at maximum retain 10 -seconds of data (sometimes a bit more) between the more recent point and the -oldest point. That does not mean it will be 10 consecutive seconds: there might -be a gap if data is fed irregularly. - -There is no expiry of data relative to the current timestamp. Also, you cannot -delete old data points (at least for now). - -Therefore, both the archive policy and the granularity entirely depends on your -use case. Depending on the usage of your data, you can define several archiving -policies. A typical low grained use case could be:: - - 3600 points with a granularity of 1 second = 1 hour - 1440 points with a granularity of 1 minute = 24 hours - 1800 points with a granularity of 1 hour = 30 days - 365 points with a granularity of 1 day = 1 year - -This would represent 7205 points × 17.92 = 126 KiB per aggregation method. If -you use the 8 standard aggregation method, your metric will take up to 8 × 126 -KiB = 0.98 MiB of disk space. diff --git a/doc/source/client.rst b/doc/source/client.rst index 6aa428a1e68e0b50b3b5519cee908eb85665825f..a53be2453f3997dadd870a40814f25cd7612792d 100644 --- a/doc/source/client.rst +++ b/doc/source/client.rst @@ -2,7 +2,10 @@ Client ======== -Gnocchi currently only provides a Python client and SDK which can be installed +Python +------ + +Gnocchi officially provides a Python client and SDK which can be installed using *pip*:: pip install gnocchiclient @@ -10,4 +13,17 @@ using *pip*:: This package provides the `gnocchi` command line tool that can be used to send requests to Gnocchi. You can read the `full documentation online`_. -.. _full documentation online: http://gnocchi.xyz/gnocchiclient +Go +-- + +There is an open source Go implementation for the SDK, provided by the +`Gophercloud` project. +It can be installed using *go get*:: + + go get github.com/gophercloud/utils/gnocchi + +This package provides the Go SDK only. You can read the `godoc reference`_. + +.. _full documentation online: http://gnocchi.osci.io/gnocchiclient +.. _Gophercloud: https://github.com/gophercloud +.. _godoc reference: https://godoc.org/github.com/gophercloud/utils diff --git a/doc/source/collectd.rst b/doc/source/collectd.rst new file mode 100644 index 0000000000000000000000000000000000000000..6c80bd805db458732b3fe96718f4c5d9d2814594 --- /dev/null +++ b/doc/source/collectd.rst @@ -0,0 +1,47 @@ +================== + Collectd support +================== + +`Collectd`_ can use Gnocchi to store its data through a plugin called +`collectd-gnocchi` or via the `gnocchi-amqp1d` daemon. + + +collectd-gnocchi +================ + +It can be installed with *pip*:: + + pip install collectd-gnocchi + +`Sources and documentation`_ are also available. + + +gnocchi-amqp1d +============== + +You need first to setup the Collectd `amqp1 write plugin`:: + + + + Host "localhost" + Port "5672" + Address "collectd" + + Format JSON + + + + + +Then configure the AMQP 1.0 url in gnocchi.conf:: + + [amqp1d] + url = localhost:5672/u/collectd/telemetry + + +.. _`Collectd`: https://www.collectd.org/ +.. _`Sources and documentation`: https://github.com/gnocchixyz/collectd-gnocchi +.. _`amqp1 write plugin`: https://github.com/ajssmith/collectd/blob/d4cc32c4dddb01081c49a67d13ab4a737cda0ed0/src/collectd.conf.pod#plugin-amqp1 +.. TODO(sileht): Change the link when + https://collectd.org/documentation/manpages/collectd.conf.5.shtml will be + up2date diff --git a/doc/source/comparison-table.rst b/doc/source/comparison-table.rst new file mode 100644 index 0000000000000000000000000000000000000000..82d3f1e80c7e22c56bc26d9030f33494d560a595 --- /dev/null +++ b/doc/source/comparison-table.rst @@ -0,0 +1,21 @@ ++------------------+-------------------------------------------------------------------+------------+------------------+----------+-----------+ +| Features | Gnocchi | Prometheus | InfluxDB | OpenTSDB | Graphite | ++==================+===================================================================+============+==================+==========+===========+ +| Metric polling | No | Yes | No | No | No | ++------------------+-------------------------------------------------------------------+------------+------------------+----------+-----------+ +| Resource history | Yes | No | No | No | No | ++------------------+-------------------------------------------------------------------+------------+------------------+----------+-----------+ +| Multi-tenant | Yes | No | No | No | No | ++------------------+-------------------------------------------------------------------+------------+------------------+----------+-----------+ +| Query interface | REST API | REST API | HTTP | TCP | None | ++------------------+-------------------------------------------------------------------+------------+------------------+----------+-----------+ +| High-available | Yes | No | With *Relay* | Yes | No | ++------------------+-------------------------------------------------------------------+------------+------------------+----------+-----------+ +| Scalable | Yes | No | Commercial only | Yes | No | ++------------------+-------------------------------------------------------------------+------------+------------------+----------+-----------+ +| Alerting | No (`roadmap `_) | Yes | With *Kapacitor* | No | No | ++------------------+-------------------------------------------------------------------+------------+------------------+----------+-----------+ +| Grafana support | Yes | Yes | Yes | Yes | Yes | ++------------------+-------------------------------------------------------------------+------------+------------------+----------+-----------+ +| collectd support | Yes | Yes | Yes | Yes | Yes | ++------------------+-------------------------------------------------------------------+------------+------------------+----------+-----------+ diff --git a/doc/source/conf.py b/doc/source/conf.py index ea782e691abbd68bb086d39247588f56155322a1..3da13ee299115893b6bc2b81981606232183a3e7 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -12,9 +12,7 @@ import datetime import os -import subprocess - -import oslosphinx +import pkg_resources # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -32,6 +30,7 @@ extensions = [ 'gnocchi.gendoc', 'sphinxcontrib.httpdomain', 'sphinx.ext.autodoc', + 'reno.sphinxext', ] # Add any paths that contain templates here, relative to this directory. @@ -48,18 +47,14 @@ master_doc = 'index' # General information about the project. project = u'Gnocchi' -copyright = u'%s, OpenStack Foundation' % datetime.date.today().year +copyright = u'%s, The Gnocchi Developers' % datetime.date.today().year # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = subprocess.Popen(['sh', '-c', 'cd ../..; python setup.py --version'], - stdout=subprocess.PIPE).stdout.read() -version = version.strip() -# The full version, including alpha/beta/rc tags. -release = version +release = pkg_resources.get_distribution('gnocchi').version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -78,6 +73,9 @@ exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None +# A list of warning types to suppress arbitrary warning messages. +suppress_warnings = ['ref.term'] + # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True @@ -100,17 +98,13 @@ pygments_style = 'sphinx' # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'openstack' +html_theme = 'sphinx_rtd_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -if html_theme == "sphinx_rtd_theme": - import sphinx_rtd_theme - html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] -else: - html_theme_path = [os.path.join(os.path.dirname(oslosphinx.__file__), - 'theme')] +import sphinx_rtd_theme +html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] # The name for this set of Sphinx documents. If None, it defaults to @@ -122,12 +116,12 @@ else: # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +html_logo = '_static/gnocchi-logo.png' # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -html_favicon = 'gnocchi-logo.jpg' +html_favicon = '_static/gnocchi-icon.ico' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, @@ -177,3 +171,25 @@ html_static_path = ['_static'] # Output file base name for HTML help builder. htmlhelp_basename = 'gnocchidoc' + +html_theme_options = { + 'logo_only': True, +} + +# Multiversion docs +scv_sort = ('semver',) +scv_show_banner = True +scv_banner_main_ref = 'stable/4.3' +scv_priority = 'branches' +scv_whitelist_branches = ('master', '^stable/([3-9]\.)') +scv_whitelist_tags = ("^$",) + +here = os.path.dirname(os.path.realpath(__file__)) +html_static_path_abs = ",".join([os.path.join(here, p) for p in html_static_path]) +# NOTE(sileht): Override some conf for old version. +scv_overflow = ("-D", "html_theme=sphinx_rtd_theme", + "-D", "html_theme_options.logo_only=True", + "-D", "html_logo=_static/gnocchi-logo.png", + "-D", "html_favicon=_static/gnocchi-icon.ico", + "-D", "html_static_path=%s" % html_static_path_abs, + "-W") diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst deleted file mode 100644 index f09d2595d1fcc24c895bf0e84c935ed4c6c8a0b7..0000000000000000000000000000000000000000 --- a/doc/source/configuration.rst +++ /dev/null @@ -1,198 +0,0 @@ -=============== - Configuration -=============== - -Configure Gnocchi by editing `/etc/gnocchi/gnocchi.conf`. - -No config file is provided with the source code; it will be created during the -installation. In case where no configuration file was installed, one can be -easily created by running: - -:: - - tox -e genconfig - -This command will create an `etc/gnocchi/gnocchi.conf` file which can be used -as a base for the default configuration file at `/etc/gnocchi/gnocchi.conf`. If -you're using _devstack_, this file is already generated and put in place. - -If you installed Gnocchi using pip, you can create a sample `gnocchi.conf` file -using the following commands: - -:: - - curl -O "https://raw.githubusercontent.com/openstack/gnocchi/master/gnocchi-config-generator.conf" - oslo-config-generator --config-file=gnocchi-config-generator.conf --output-file=gnocchi.conf - -The configuration file should be pretty explicit, but here are some of the base -options you want to change and configure: - - -+---------------------+---------------------------------------------------+ -| Option name | Help | -+=====================+===================================================+ -| storage.driver | The storage driver for metrics. | -+---------------------+---------------------------------------------------+ -| indexer.url | URL to your indexer. | -+---------------------+---------------------------------------------------+ -| storage.file_* | Configuration options to store files | -| | if you use the file storage driver. | -+---------------------+---------------------------------------------------+ -| storage.swift_* | Configuration options to access Swift | -| | if you use the Swift storage driver. | -+---------------------+---------------------------------------------------+ -| storage.ceph_* | Configuration options to access Ceph | -| | if you use the Ceph storage driver. | -+---------------------+---------------------------------------------------+ - - -Gnocchi provides these storage drivers: - -- File (default) -- `Swift`_ -- `Ceph`_ -- `InfluxDB`_ (experimental) - -Gnocchi provides these indexer drivers: - -- `PostgreSQL`_ (recommended) -- `MySQL`_ - -.. _`Swift`: https://launchpad.net/swift -.. _`Ceph`: http://ceph.com/ -.. _`PostgreSQL`: http://postgresql.org -.. _`MySQL`: http://mysql.com -.. _`InfluxDB`: http://influxdb.com - -Configuring the WSGI pipeline ------------------------------ - -The API server leverages `Paste Deployment`_ to manage its configuration. You -can edit the `/etc/gnocchi/api-paste.ini` to tweak the WSGI pipeline of the -Gnocchi REST HTTP server. By default, no authentication middleware is enabled, -meaning your request will have to provides the authentication headers. - -Gnocchi is easily connectable with `OpenStack Keystone`_. If you successfully -installed the `keystone` flavor using `pip` (see :ref:`installation`), you can -edit the `api-paste.ini` file to add the Keystone authentication middleware:: - - [pipeline:main] - pipeline = gnocchi+auth - -Also, if you're planning on using `CORS`_ (e.g. to use `Grafana`_), you an also -add the CORS middleware in the server pipeline:: - - [pipeline:gnocchiv1+auth] - pipeline = keystone_authtoken cors gnocchiv1 - -With or without Keystone support. - -.. _`Paste Deployment`: http://pythonpaste.org/deploy/ -.. _`OpenStack Keystone`: http://launchpad.net/keystone -.. _`CORS`: https://en.wikipedia.org/wiki/Cross-origin_resource_sharing -.. _`Grafana`: http://grafana.org/ - - -Driver notes -============ - -Carbonara based drivers (file, swift, ceph) -------------------------------------------- - -To ensure consistency across all *gnocchi-api* and *gnocchi-metricd* workers, -these drivers need a distributed locking mechanism. This is provided by the -'coordinator' of the `tooz`_ library. - -By default, the configured backend for `tooz`_ is the same as the indexer -(*PostgreSQL* or *MySQL*). This allows locking across workers from different -nodes. - -For a more robust multi-nodes deployment, the coordinator may be changed via -the `storage.coordination_url` configuration option to one of the other `tooz -backends`_. - -For example to use Redis backend:: - - coordination_url = redis://?sentinel= - -or alternatively, to use the Zookeeper backend:: - - coordination_url = zookeeper:///hosts=&hosts= - -.. _`tooz`: http://docs.openstack.org/developer/tooz/ -.. _`tooz backends`: http://docs.openstack.org/developer/tooz/drivers.html - - -Ceph driver implementation details ----------------------------------- - -Each batch of measurements to process is stored into one rados object. -These objects are named `measures___` - -Also a special empty object called `measures` has the list of measures to -process stored in its xattr attributes. - -Because of the asynchronous nature of how we store measurements in Gnocchi, -`gnocchi-metricd` needs to know the list of objects that are waiting to be -processed: - -- Listing rados objects for this is not a solution since it takes too much - time. -- Using a custom format into a rados object, would force us to use a lock - each time we would change it. - -Instead, the xattrs of one empty rados object are used. No lock is needed to -add/remove a xattr. - -But depending on the filesystem used by ceph OSDs, this xattrs can have a -limitation in terms of numbers and size if Ceph is not correctly configured. -See `Ceph extended attributes documentation`_ for more details. - -Then, each Carbonara generated file is stored in *one* rados object. -So each metric has one rados object per aggregation in the archive policy. - -Because of this, the filling of OSDs can look less balanced compared to RBD. -Some objects will be big and others small, depending on how archive policies -are set up. - -We can imagine an unrealistic case such as retaining 1 point per second over -a year, in which case the rados object size will be ~384MB. - -Whereas in a more realistic scenario, a 4MB rados object (like RBD uses) could -result from: - -- 20 days with 1 point every second -- 100 days with 1 point every 5 seconds - -So, in realistic scenarios, the direct relation between the archive policy and -the size of the rados objects created by Gnocchi is not a problem. - - -Also Gnocchi can use `cradox`_ Python libary if installed. This library is a -Python binding to librados written with `Cython`_, aiming to replace the one -written with `ctypes`_ provided by Ceph. -This new library will be part of next Ceph release (10.0.4). - -The new Cython binding divides the gnocchi-metricd times to process measures -by a large factor. - -So, if the Ceph installation doesn't use latest Ceph version, `cradox`_ can be -installed to improve the Ceph backend performance. - - -.. _`Ceph extended attributes documentation`: http://docs.ceph.com/docs/master/rados/configuration/filestore-config-ref/#extended-attributes -.. _`cradox`: https://pypi.python.org/pypi/cradox -.. _`Cython`: http://cython.org/ -.. _`ctypes`: https://docs.python.org/2/library/ctypes.html -.. _`rados.py`: https://docs.python.org/2/library/ctypes.htm://github.com/ceph/ceph/blob/hammer/src/pybind/rados.py - - -Swift driver implementation details ------------------------------------ - -The Swift driver leverages the bulk delete functionality provided by the bulk_ -middleware to minimise the amount of requests made to clean storage data. This -middleware must be enabled to ensure Gnocchi functions correctly. By default, -Swift has this middleware enabled in its pipeline. - -.. _bulk: http://docs.openstack.org/liberty/config-reference/content/object-storage-bulk-delete.html diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst new file mode 100644 index 0000000000000000000000000000000000000000..12f56e2222d7d23a736975c6c15b06a442e6cbc6 --- /dev/null +++ b/doc/source/contributing.rst @@ -0,0 +1,81 @@ +============== + Contributing +============== + +Issues +------ + +We use the `GitHub issue tracker`_ for reporting issues. Before opening a new +issue, ensure the bug was not already reported by searching on Issue tracker +first. + +If you're unable to find an open issue addressing the problem, open a new one. +Be sure to include a title and clear description, as much relevant information +as possible, and a code sample or an executable test case demonstrating the +expected behavior that is not occurring. + +If you are looking to contribute for the first time, some issues are tagged +with the "`good first issue`_" label and are easy targets for newcomers. + +.. _`GitHub issue tracker`: https://github.com/gnocchixyz/gnocchi/issues +.. _`good first issue`: https://github.com/gnocchixyz/gnocchi/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22 + + +Pull-requests +------------- + +When opening a pull-request, make sure that: + +* You write a comprehensive summary of your problem and the solution you + implemented. +* If you update or fix your pull-request, make sure the commits are atomic. Do + not include fix-up commits in your history, rewrite it properly using e.g. + `git rebase --interactive` and/or `git commit --amend`. +* We recommend using `git pull-request`_ to send your pull-requests. + +All sent pull-requests are checked using `Travis-CI`_, which is in charge of +running the tests suites. There are different scenarios being run: `PEP 8`_ +compliance tests, upgrade tests, unit and functional tests. + +All pull-requests must be reviewed by `members of the Gnocchi project`_. + +When a pull-request is approved by at least two of the members and when +Travis-CI confirms that all the tests run fine, the patch will be merged. + +The Gnocchi project leverages `Mergify`_ in order to schedule the merge of the +different pull-requests. Mergify is in charge of making sure that the +pull-request is up-to-date with respect to the `master` branch and that the +tests pass. Pull-requests are always merged in a serialized manner in order to +make sure that no pull-request can break another one. + +`Gnocchi's Mergify dashboard`_ shows the current status of the merge queue. + +.. _`git pull-request`: https://github.com/jd/git-pull-request +.. _`PEP 8`: https://www.python.org/dev/peps/pep-0008/ +.. _`Travis-CI`: http://travis-ci.org +.. _`members of the Gnocchi project`: https://github.com/orgs/gnocchixyz/people +.. _`Mergify`: https://mergify.io +.. _`Gnocchi's Mergify dashboard`: https://gh.mergify.io/gnocchixyz + + +Running the Tests +----------------- + +Tests are run using `tox `_. Tox creates +a virtual environment for each test environment, so make sure you are using an +up to date version of `virtualenv `_. + +Different test environments and configurations can be found by running the +``tox -l`` command. For example, to run tests with Python 3.7, PostgreSQL as +indexer, and file as storage backend: + +:: + + tox -e py37-postgresql-file + + +To run tests with MySQL as indexer, and Ceph as storage backend: + +:: + + tox -e py37-mysql-ceph diff --git a/doc/source/devstack.rst b/doc/source/devstack.rst deleted file mode 100644 index b116c1638295d544a3e8154c64126f7515649f4d..0000000000000000000000000000000000000000 --- a/doc/source/devstack.rst +++ /dev/null @@ -1,21 +0,0 @@ -========== - Devstack -========== - -To enable Gnocchi in devstack, add the following to local.conf: - -:: - - enable_plugin gnocchi https://github.com/openstack/gnocchi master - enable_service gnocchi-api,gnocchi-metricd - -To enable Grafana support in devstack, you can also enable `gnocchi-grafana`:: - - enable_service gnocchi-grafana - -Then, you can start devstack: - -:: - - ./stack.sh - diff --git a/doc/source/glossary.rst b/doc/source/glossary.rst new file mode 100644 index 0000000000000000000000000000000000000000..7f26d2fc04f8dab634b0f12a22a5e7723c3fb534 --- /dev/null +++ b/doc/source/glossary.rst @@ -0,0 +1,48 @@ +======== +Glossary +======== + +.. glossary:: + :sorted: + + Resource + An entity representing anything in your infrastructure that you will + associate |metric|\ (s) with. It is identified by a unique ID and can + contain attributes. + + Metric + An entity storing |aggregates| identified by an UUID. It can be attached + to a |resource| using a name. How a metric stores its |aggregates| is + defined by the |archive policy| it is associated to. + + Measure + An incoming datapoint tuple sent to Gnocchi by the api. It is composed + of a timestamp and a value. + + Archive policy + An |aggregate| storage policy attached to a |metric|. It determines how + long |aggregates| will be kept in a |metric| and + :term:`how they will be aggregated`\ . + + Granularity + The time between two |aggregates| in an aggregated |time series| of a + |metric|. + + Time series + A list of |aggregates| ordered by time. + + Aggregation method + Function used to aggregate multiple |measures| into an |aggregate|. For + example, the `min` aggregation method will aggregate the values of + different |measures| to the minimum value of all the |measures| in the + time range. + + Aggregate + A datapoint tuple generated from several |measures| according to the + |archive policy| definition. It is composed of a timestamp and a value. + + Timespan + The time period for which a |metric| keeps its |aggregates|. It is used in + the context of |archive policy|. + +.. include:: include/term-substitution.rst diff --git a/doc/source/gnocchi-logo.jpg b/doc/source/gnocchi-logo.jpg deleted file mode 100644 index a9eaca753678529cbbc0781ec24a6f3e2a06f517..0000000000000000000000000000000000000000 Binary files a/doc/source/gnocchi-logo.jpg and /dev/null differ diff --git a/doc/source/grafana-screenshot.png b/doc/source/grafana-screenshot.png deleted file mode 100644 index eff160321972884e6811d4dfa7fe7dd26fac2912..0000000000000000000000000000000000000000 Binary files a/doc/source/grafana-screenshot.png and /dev/null differ diff --git a/doc/source/grafana.rst b/doc/source/grafana.rst index dee0a71c3e0ad3f1fc983de370b5bcbbaf1d9d75..93b1178cd67e7d88fa8e2646f746fbe9f1f4473a 100644 --- a/doc/source/grafana.rst +++ b/doc/source/grafana.rst @@ -2,14 +2,12 @@ Grafana support ================= -`Grafana`_ has support for Gnocchi through a plugin. The repository named -`grafana-plugins`_ contains this plugin. You can enable the plugin by following -the instructions in the `Grafana documentation`_. +`Grafana`_ has support for Gnocchi through a plugin. It can be installed with +grafana-cli:: -.. note:: - A `pull request`_ has been made to merge this plugin directly into Grafana - main tree, but it has unfortunately being denied for the time being. Feel - free to post a comment there requesting its reopening. + sudo grafana-cli plugins install gnocchixyz-gnocchi-datasource + +`Source`_ and `Documentation`_ are also available. Grafana has 2 modes of operation: proxy or direct mode. In proxy mode, your browser only communicates with Grafana, and Grafana communicates with Gnocchi. @@ -29,35 +27,31 @@ In order to use Gnocchi with Grafana in proxy mode, you just need to: In order to use Gnocchi with Grafana in direct mode, you need to do a few more steps: -1. Enable the `CORS`_ middleware. This can be done easily by modifying the - Gnocchi `api-paste.ini` configuration file and adding `cors` into the main - pipeline:: - - [pieline:main] - pipeline = cors keystone_authtoken gnocchi - - This will authorize your browser to make requests to Gnocchi on behalf of - Grafana. - -2. Configure the CORS middleware in `gnocchi.conf` to allow request from +1. Configure the CORS middleware in `gnocchi.conf` to allow request from Grafana:: [cors] - allowed_origin = http://example.com/grafana - allow_headers = Content-Type,Cache-Control,Content-Language,Expires,Last-Modified,Pragma,X-Auth-Token + allowed_origin = http://grafana.fqdn -3. Configure the CORS middleware in Keystone in the same fashion. +2. Configure the CORS middleware in Keystone to allow request from Grafana too:: -4. Configure a new datasource in Grafana with the Keystone URL, a user, a + [cors] + allowed_origin = http://grafana.fqdn + +3. Configure a new datasource in Grafana with the Keystone URL, a user, a project and a password. Your browser will query Keystone for a token, and then query Gnocchi based on what Grafana needs. -.. image:: grafana-screenshot.png +.. note:: + + `allowed_origin` format is format: `://[:]`. No path, + no query string and no trailing `/`. + +.. image:: _static/grafana-screenshot.png :align: center :alt: Grafana screenshot .. _`Grafana`: http://grafana.org -.. _`grafana-plugins`: https://github.com/grafana/grafana-plugins -.. _`pull request`: https://github.com/grafana/grafana/pull/2716 -.. _`Grafana documentation`: http://docs.grafana.org/ +.. _`Documentation`: https://grafana.net/plugins/gnocchixyz-gnocchi-datasource +.. _`Source`: https://github.com/gnocchixyz/grafana-gnocchi-datasource .. _`CORS`: https://en.wikipedia.org/wiki/Cross-origin_resource_sharing diff --git a/doc/source/include/term-substitution.rst b/doc/source/include/term-substitution.rst new file mode 100644 index 0000000000000000000000000000000000000000..37b8020bf2da11bdbf99520d0cda15facc0f6aab --- /dev/null +++ b/doc/source/include/term-substitution.rst @@ -0,0 +1,24 @@ +.. |resource| replace:: :term:`resource` +.. |resources| replace:: :term:`resources` + +.. |metric| replace:: :term:`metric` +.. |metrics| replace:: :term:`metrics` + +.. |measure| replace:: :term:`measure` +.. |measures| replace:: :term:`measures` + +.. |archive policy| replace:: :term:`archive policy` +.. |archive policies| replace:: :term:`archive policies` + +.. |granularity| replace:: :term:`granularity` +.. |granularities| replace:: :term:`granularities` + +.. |time series| replace:: :term:`time series