Skip to main content

A Prometheus exporter for the Azure billing API

Project description

[![Build Status](https://travis-ci.org/blue-yonder/azure-cost-mon.svg?branch=master)](https://travis-ci.org/blue-yonder/azure-cost-mon)
[![Coverage Status](https://coveralls.io/repos/github/blue-yonder/azure-cost-mon/badge.svg?branch=master)](https://coveralls.io/github/blue-yonder/azure-cost-mon?branch=master)

azure-billing
=============

Prometheus scraper for the Microsoft Azure billing API.

Description
-----------

**azure-billing** is a web app, that is intended to be called by [Prometheus](https://prometheus.io) to export billing information from Azure.
It will then return the available metrics in Prometheus compatible format.

The billing API in use is part of the "Enterprise Agreement (EA)" Portal. Hence it has not been tested for pay-as-you-go
subscriptions. The configuration requires an active EA with Microsoft.

Configuration
-------------

You need to create an application.cfg file with the following content:

ENROLLMENT_NUMBER="123456"
BILLING_API_ACCESS_KEY="XXX"
PROMETHEUS_METRIC_NAME="my_metric_name"

- `ENROLLMENT_NUMBER` is the unique ID that identifies a particular EA.
- The `BILLING_API_ACCESS_KEY` can be created in the [EA portal](https://ea.azure.com/) to gain
access to the billing API. Navigate to "Reports > Download Usage" and generate an API Access Key.
- `PROMETHEUS_METRIC_NAME` is the name of the time series that will be generated in
Prometheus. This configuration is optional and defaults to `azure_costs`

Deployment
----------

E.g. via `gunicorn` in a `virtualenv` that contains this package as well as `gunicorn`:

gunicorn azure-billing:app



Tests
-----

The used python testing tool is [pytest](https://docs.pytest.org/en/latest/).
To run the tests:

```bash
mkvirtualenv billing
pip install -r requirements_dev.txt
pip install -e .
py.test
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

azure_costs_exporter-0.2.tar.gz (8.7 kB view details)

Uploaded Source

Built Distributions

azure_costs_exporter-0.2-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

azure_costs_exporter-0.2-py2-none-any.whl (5.3 kB view details)

Uploaded Python 2

File details

Details for the file azure_costs_exporter-0.2.tar.gz.

File metadata

File hashes

Hashes for azure_costs_exporter-0.2.tar.gz
Algorithm Hash digest
SHA256 a4aa1638cd59cb1be575ffd30cf6806454a61d3da326516b0b28e8e5ddc429c5
MD5 f6ab4d43585108ac56a6324af4dd7ee3
BLAKE2b-256 15d700a1fc56bd084eb024478f3fc8644515a65622fae20610600af7cead0845

See more details on using hashes here.

File details

Details for the file azure_costs_exporter-0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for azure_costs_exporter-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 39f057bb03fcf4bf1ba442ab470bb18e8a5d98b943d828f719bbfed097b0b1a7
MD5 b7072f2c1649402b2ee19804c73c6780
BLAKE2b-256 1f1855a1938753815ad312d53448b75d2e80cd926fc7f423bf3a7ccfdd1c9de8

See more details on using hashes here.

File details

Details for the file azure_costs_exporter-0.2-py2-none-any.whl.

File metadata

File hashes

Hashes for azure_costs_exporter-0.2-py2-none-any.whl
Algorithm Hash digest
SHA256 5ad476c217dfd4732cb8f73a0396c9d0552e308b5b7ba1a9c576e72524862c94
MD5 e52c9875166aeaeafd07591fc76a80e7
BLAKE2b-256 813f04c85d610be9d5c76619f517304deea6cb79105f3de5d4c1e966abcc5326

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page