Migrate to opendev infra

- Adds `.gitreview` to allow `git review` usage
- Adds `.zuul.yaml` for initial jobs to run on CI
- Changes `setup.py` to follow the OpenStack format
- Adds `setup.cfg` with the information that was
in the old `setup.py`
- Removes `verify_installation.py`
- Updates `README` with newer information
- Removes uWSGI from requirements.txt

Change-Id: Id247c4eebf9dec94556b500866a360d6c24b9a92
This commit is contained in:
Iury Gregory Melo Ferreira 2019-07-09 16:50:45 +02:00
parent 47fe64fb7d
commit 41ee7fd6da
8 changed files with 161 additions and 133 deletions

4
.gitreview Normal file
View File

@ -0,0 +1,4 @@
[gerrit]
host=review.opendev.org
port=29418
project=openstack/ironic-prometheus-exporter.git

5
.zuul.yaml Normal file
View File

@ -0,0 +1,5 @@
- project:
templates:
- check-requirements
- openstack-python-jobs
- openstack-python3-train-jobs

View File

@ -1,71 +0,0 @@
# Ironic Prometheus Exporter #
### Installation ###
1 - Clone the repository in the machine where ironic is installed.
```
$ git clone https://github.com/metal3-io/ironic-prometheus-exporter
```
2 - Install the driver (may require sudo permisions)
```
$ cd ironic-prometheus-exporter
$ python setup.py install
```
3- Verify if the driver is installed
```
$ pip install entry_point_inspector --user <user>
$ epi group show oslo.messaging.notify.drivers
```
Output in case of a successful instalation:
`prometheus_exporter` is listed in the `Name` column and the `Error` column should be empty.
Output in case of an unsuccessful instalation:
`prometheus_exporter` is listed in the `Name` column and the `Error` column will have more information.
### Configuration ###
After install the driver you will need to update the `ironic.conf` and add the below information.
```
[conductor]
send_sensor_data=true
[oslo_messaging_notifications]
driver = prometheus_exporter
transport_url = fake://
location=/tmp/ironic_prometheus_exporter
```
### Running exporter application ###
The Flask Application is responsible to merge all the metrics files present in the directory
set in `[oslo_messaging_notifications]/location`.
**NOTE:** if you want to deploy in production please check the Flask [documentation](http://flask.pocoo.org/docs/dev/deploying/)
To run the Flask Application follow the steps listed below:
1 - open the repository directory
```
$ cd ironic-prometheus-exporter/
```
2- set the `FLASK_*` environment variables and the location of the `ironic.conf` file.
```
$ export IRONIC_CONFIG=/etc/ironic/ironic.conf
$ export FLASK_APP=ironic_prometheus_exporter/app/exporter.py
$ export FLASK_RUN_HOST=$HOST_IP
$ export FLASK_RUN_PORT=5000
```
3- run the Flask Application
```
$ python -m flask run &
```
**Running under uWSGI**
Reproduce the Steps 1 and 2 (You don't need to set `FLASK_APP` variable) and run the command below:
```
$ uwsgi --socket $FLASK_RUN_HOST:$FLASK_RUN_PORT --protocol=http -w ironic_prometheus_exporter.app.wsgi
```

98
README.rst Normal file
View File

@ -0,0 +1,98 @@
Ironic Prometheus Exporter
==========================
Overview
--------
Tool to expose hardware sensor data in the `Prometheus <https://prometheus.io/>`_ format through an HTTP endpoint.
The hardware sensor data come from bare metal machines deployed
using `OpenStack Bare Metal Service (ironic) <https://docs.openstack.org/ironic/latest/>`_.
* License: Apache License, Version 2.0
* Documentation: https://docs.openstack.org/ironic-prometheus-exporter/
* Source: https://opendev.org/openstack/ironic-prometheus-exporter
* Bugs: https://storyboard.openstack.org/#!/project/openstack/ironic-prometheus-exporter
Installation
------------
1 - Install ironic-prometheus-exporter
::
$ pip install --user ironic-prometheus-exporter
2- Verify if the driver is installed
::
$ pip install entry_point_inspector --user <user>
$ epi group show oslo.messaging.notify.drivers
- Output in case of a successful instalation: `prometheus_exporter` is listed in the `Name` column and the `Error` column should be empty.
- Output in case of an unsuccessful instalation: `prometheus_exporter` is listed in the `Name` column and the `Error` column will have more information.
Configuration
-------------
After install the driver you will need to update the `ironic.conf` and add the following information:
::
[conductor]
send_sensor_data=true
[oslo_messaging_notifications]
driver = prometheus_exporter
transport_url = fake://
location=/tmp/ironic_prometheus_exporter
Running exporter application
----------------------------
The Flask Application is responsible to merge all the metrics files present in the directory
set in `[oslo_messaging_notifications]/location`.
.. note:: If you want to deploy in production please check the Flask `documentation <http://flask.pocoo.org/docs/dev/deploying/>`_
To run the Flask Application follow the steps listed below:
1 - open the repository directory
::
$ cd ironic-prometheus-exporter/
2- set the `FLASK_*` environment variables and the location of the `ironic.conf` file.
::
$ export IRONIC_CONFIG=/etc/ironic/ironic.conf
$ export FLASK_APP=ironic_prometheus_exporter/app/exporter.py
$ export FLASK_RUN_HOST=$HOST_IP
$ export FLASK_RUN_PORT=5000
3- run the Flask Application
::
$ python -m flask run &
**Running under uWSGI**
Reproduce the Steps 1 and 2 (You don't need to set `FLASK_APP` variable) and run the command below:
::
$ uwsgi --plugin python --http-socket ${FLASK_RUN_HOST}:${FLASK_RUN_PORT} --module ironic_prometheus_exporter.app.wsgi:application
Contributing
------------
* Pull requests: `Gerrit
<https://review.opendev.org/#/q/project:openstack/ironic-prometheus-exporter>`_
(see `developer's guide
<https://docs.openstack.org/infra/manual/developers.html>`_)
* Bugs and RFEs: `StoryBoard
<https://storyboard.openstack.org/#!/project/openstack/ironic-prometheus-exporter>`_
(please do NOT report bugs to Github)

View File

@ -1,6 +1,5 @@
pbr!=2.1.0,>=2.0.0 # Apache-2.0
stevedore>=1.20.0 # Apache-2.0
oslo.messaging>=9.4.0 # Apache-2.0
uWSGI # Apache-2.0
Flask>=0.12.3
prometheus_client # Apache-2.0
Flask>=1.0.0 # BSD
prometheus_client>=0.6.0 # Apache-2.0

26
setup.cfg Normal file
View File

@ -0,0 +1,26 @@
[metadata]
name = ironic-prometheus-exporter
summary = Prometheus Exporter for Ironic Hardware Sensor data
description-file = README.rst
author = OpenStack
author-email = openstack-discuss@lists.openstack.org
home-page = https://opendev.org/openstack/ironic-prometheus-exporter
license = Apache-2
classifier =
Environment :: Console
Environment :: OpenStack
Intended Audience :: System Administrators
Intended Audience :: Information Technology
License :: OSI Approved :: Apache Software License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
[entry_points]
oslo.messaging.notify.drivers =
prometheus_exporter = ironic_prometheus_exporter.messaging:PrometheusFileDriver
file_exporter = ironic_prometheus_exporter.messaging:SimpleFileDriver

View File

@ -1,49 +1,29 @@
import re
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# 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.
from setuptools import setup, find_packages
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
import setuptools
# In python < 2.7.4, a lazy loading of package `pbr` will break
# setuptools if some other modules registered functions in `atexit`.
# solution from: http://bugs.python.org/issue15881#msg170215
try:
import multiprocessing # noqa
except ImportError:
pass
def parse_requirements(file_name):
requirements = []
for line in open(file_name, 'r').read().split('\n'):
if re.match(r'(\s*#)|(\s*$)', line):
continue
if re.match(r'\s*-e\s+', line):
requirements.append(re.sub(r'\s*-e\s+.*#egg=(.*)$', r'\1', line))
elif re.match(r'\s*-f\s+', line):
pass
else:
requirements.append(line)
return requirements
setup(
name='ironic_prometheus_exporter',
version='1.0.0',
description='Prometheus Exporter for Ironic Hardware Sensor data',
url='',
author='Iury Gregory Melo Ferreira',
author_email='imelofer@redhat.com',
license='Apache 2.0',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Intended Audience :: Information Technology',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
],
packages=find_packages(),
install_requires=parse_requirements('requirements.txt'),
entry_points={
'oslo.messaging.notify.drivers': [
'prometheus_exporter=\
ironic_prometheus_exporter.messaging:PrometheusFileDriver',
'file_exporter=\
ironic_prometheus_exporter.messaging:SimpleFileDriver',
],
},
)
setuptools.setup(
setup_requires=['pbr>=2.0.0'],
pbr=True)

View File

@ -1,13 +0,0 @@
import stevedore
driver_list = stevedore.ExtensionManager(
'oslo.messaging.notify.drivers',
invoke_on_load=False,
propagate_map_exceptions=True
)
if 'prometheus_exporter' in driver_list.names():
print('prometheus_exporter driver found.')
else:
print('prometheus_exporter driver not found.')
print('Available drivers: %s' % driver_list.names())