Commit 5abba121 authored by Arturo Borrero Gonzalez's avatar Arturo Borrero Gonzalez 🏕
Browse files

New upstream version 0.0.8

parent 0a3b32c8
parts
prime
*.snap
snap
stage
This diff is collapsed.
# Prometheus OpenStack exporter
Exposes high level [OpenStack](http://www.openstack.org/) metrics to [Prometheus](https://prometheus.io/).
# Deployment
## Requirements
```
sudo apt-get install python-neutronclient python-novaclient python-keystoneclient python-netaddr python-cinderclient
```
Install prometheus_client. On Ubuntu 16.04:
```
apt-get install python-prometheus-client
```
On Ubuntu 14.04:
```
pip install prometheus_client
```
## Installation
```
# Copy example config in place, edit to your needs
sudo cp prometheus-openstack-exporter.yaml /etc/prometheus/
## Upstart
# Install job
sudo cp prometheus-openstack-exporter.conf /etc/init
# Configure novarc location:
sudo sh -c 'echo "NOVARC=/path/to/admin-novarc">/etc/default/prometheus-openstack-exporter'
## Systemd
# Install job
sudo cp prometheus-openstack-exporter.service /etc/systemd/system/
# create novarc
sudo cat <<EOF > /etc/prometheus-openstack-exporter/admin.novarc
export OS_USERNAME=Admin
export OS_TENANT_NAME=admin
export OS_PASSWORD=XXXX
export OS_REGION_NAME=cloudname
export OS_AUTH_URL=http://XX.XX.XX.XX:35357/v2.0
EOF
# create default config location
sudo sh -c 'echo "CONFIG_FILE=/etc/prometheus-openstack-exporter/prometheus-openstack-exporter.yaml">/etc/default/prometheus-openstack-exporter'
# Start
sudo start prometheus-openstack-exporter
```
Or to run interactively:
```
. /path/to/admin-novarc
./prometheus-openstack-exporter prometheus-openstack-exporter.yaml
```
# Configuration
Configuration options are documented in prometheus-openstack-exporter.yaml shipped with this project
# FAQ
## Why are openstack_allocation_ratio values hardcoded?
There is no way to retrieve them using OpenStack API.
Alternative approach could be to hardcode those values in queries but this approach breaks when allocation ratios change.
## Why hardcode swift host list?
Same as above, there is no way to retrieve swift hosts using API.
## Why not write dedicated swift exporter?
Swift stats are included mainly because they are trivial to retrieve. If and when standalone swift exporter appears we can revisit this approach
## Why cache data?
We are aware that Prometheus best practise is to avoid caching. Unfortunately queries we need to run are very heavy and in bigger clouds can take minutes to execute. This is problematic not only because of delays but also because multiple servers scraping the exporter could have negative impact on the cloud performance
This diff is collapsed.
# Configuration is read from /etc/default/prometheus-openstack-exporter
# Copyright (C) 2016 Canonical, Ltd.
description "Prometheus Openstack Exporter"
author "Jacek Nykis <jacek.nykis@canonical.com>"
# The following variable must be set:
# NOVARC - full path to the novarc file
#
# Optionall variables:
# CONFIG_FILE - path to configuration file
start on runlevel [2345]
stop on runlevel [!2345]
respawn
script
. /etc/default/prometheus-openstack-exporter
. $NOVARC
exec /usr/local/bin/prometheus-openstack-exporter $CONFIG_FILE
end script
[Unit]
Description=prometheus-openstack-exporter
After=network.target
[Service]
EnvironmentFile=/etc/default/prometheus-openstack-exporter
#EnvironmentFile=/etc/prometheus-openstack-exporter/admin.novarc
ExecStart=/bin/sh -c '. /etc/prometheus-openstack-exporter/admin.novarc; exec /opt/prometheus-openstack-exporter/prometheus-openstack-exporter $CONFIG_FILE'
KillMode=process
[Install]
WantedBy=multi-user.target
# Example configuration file for prometheus-openstack-exporter
# Copyright (C) 2016 Canonical, Ltd.
#
listen_port: 9183
cache_refresh_interval: 300 # In seconds
cache_file: /var/cache/prometheus-openstack-exporter/mycloud
cloud: mycloud
openstack_allocation_ratio_vcpu: 2.5
openstack_allocation_ratio_ram: 1.1
openstack_allocation_ratio_disk: 1.0
# To export hypervisor_schedulable_instances metric set desired instance size
schedulable_instance_size:
ram_mbs: 4096
vcpu: 2
disk_gbs: 20
# There is no way to retrieve them using OpenStack APIs
# For clouds deployed without swift, remove this part
swift_hosts:
- host1.example.com
- host2.example.com
# Uncomment if the cloud doesn't provide cinder / nova volumes:
#use_nova_volumes: False
import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name="prometheus_openstack_exporter",
version="0.0.4",
author="Jacek Nykis",
description="Exposes high level OpenStack metrics to Prometheus.",
license="GPLv3",
keywords=["prometheus", "openstack", "exporter"],
url="https://github.com/CanonicalLtd/prometheus-openstack-exporter",
scripts=["prometheus-openstack-exporter"],
install_requires=["prometheus_client",
"python-keystoneclient<=3.10.0",
"python-novaclient==6.0.0",
"python-neutronclient<=6.1.0",
"python-cinderclient",
"netaddr"],
long_description=read('README.md'),
classifiers=[
"Development Status :: 4 - Beta",
"Topic :: System :: Networking :: Monitoring",
"License :: OSI Approved :: "
"GNU General Public License v3 or later (GPLv3+)",
],
)
#!/bin/sh
# Fail if these vars are not present (e.g. from direct wrapper runs)
: ${SNAP?} ${SNAP_DATA?}
# Copy only if not existing
cp -pn $SNAP/etc/prometheus/prometheus-openstack-exporter.yaml.example $SNAP_DATA/prometheus-openstack-exporter.yaml
test -r $SNAP_DATA/admin.novarc && . $SNAP_DATA/admin.novarc
exec $SNAP/bin/prometheus-openstack-exporter $SNAP_DATA/prometheus-openstack-exporter.yaml
name: prometheus-openstack-exporter
version: 0.0.8
summary: Exposes high level OpenStack metrics to Prometheus.
description: |
Exposes high level OpenStack metrics to Prometheus
confinement: strict
grade: stable
apps:
prometheus-openstack-exporter:
command: 'bin/prometheus-openstack-exporter.wrapper'
plugs: [network-bind, network]
daemon: simple
parts:
prometheus-openstack-exporter:
plugin: python
python-version: python2
source: .
stage-packages:
- libdb5.3
example-config:
plugin: dump
source: .
organize:
prometheus-openstack-exporter.yaml: etc/prometheus/prometheus-openstack-exporter.yaml.example
prime:
- etc/prometheus/prometheus-openstack-exporter.yaml.example
snap-wrappers:
plugin: dump
source: .
organize:
snap_cmd_wrapper: bin/prometheus-openstack-exporter.wrapper
prime:
- bin/prometheus-openstack-exporter.wrapper
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment