Record the utilization of OpenStack resources for each tenant
Go to file
Paul Millette 00f5d6994b Handle API response errors (#14)
Assert that exception message is not empty
Added voluptuous
2016-05-03 15:15:49 -04:00
almanach Handle API response errors (#14) 2016-05-03 15:15:49 -04:00
tests Handle API response errors (#14) 2016-05-03 15:15:49 -04:00
.gitignore Fixes some PEP8 and minor stuff 2016-03-25 11:52:20 -04:00
.travis.yml Update Travis token 2016-04-05 09:57:08 -04:00
LICENSE First opensource commit 2016-03-25 11:30:58 -04:00
README.md Added environment variable overrides 2016-04-21 16:35:47 -04:00
requirements.txt Handle API response errors (#14) 2016-05-03 15:15:49 -04:00
setup.cfg Use standard Python command line parser (#6) 2016-04-21 14:20:34 -04:00
setup.py flake8 now automated (#5) 2016-04-15 07:49:15 -04:00
test-requirements.txt Handle API response errors (#14) 2016-05-03 15:15:49 -04:00
tox.ini flake8 now automated (#5) 2016-04-15 07:49:15 -04:00

README.md

Almanach

Build Status PyPI version

Almanach stores the utilization of OpenStack resources (instances and volumes) for each tenant.

What is Almanach?

The main purpose of this software is to bill customers based on their usage of the cloud infrastructure.

Almanach is composed of two parts:

  • Collector: Listen for OpenStack events and store the relevant information in the database.
  • REST API: Expose the information collected to external systems.

Requirements

  • OpenStack infrastructure installed (Nova, Cinder...)
  • MongoDB
  • Python 2.7

Command line usage

Usage:

usage: almanach [-h] [--logging LOGGING] {api,collector} config_file

Start the API daemon:

almanach api /path/to/almanach.cfg

Start the collector:

almanach collector /path/to/almanach.cfg

Custom logging configuration:

almanach collector /path/to/almanach.cfg --logging /path/to/logging.cfg

The syntax of the logging configuration file is available in the official Python documentation.

Environment variables

You can override the configuration parameters by using environment variables:

export RABBITMQ_URL="amqp://openstack:openstack@hostname:5672"
almanach collector /path/to/almanach.cfg

Database entities

Each entity have at least these properties:

  • entity_id: Unique id for the entity (UUID)
  • entity_type: "instance" or "volume"
  • project_id: Tenant unique ID (UUID)
  • start: Start date of the resource usage
  • end: End date of the resource usage or null if the resource still in use by the tenant
  • name: Resource name

Compute Object

{
    "entity_id": "UUID",
    "entity_type": "instance",
    "project_id": "UUID",
    "start": "2014-01-01T06:00:00.000Z",
    "end": null,
    "last_event": "2014-01-01T06:00:00.000Z",
    "flavor": "MyFlavor1",
    "os": {
        "distro": "ubuntu",
        "version": "14.04"
    },
    "name": "my-virtual-machine.domain.tld"
}

Block Storage Object

{
    "entity_id": "UUID",
    "entity_type": "volume",
    "project_id": "UUID",
    "start": "2014-01-01T06:00:00.000Z",
    "end": null,
    "last_event": "2014-01-01T06:00:00.000Z",
    "volume_type": "MyVolumeType",
    "size": 50,
    "name": "my-virtual-machine.domain.tld-volume",
    "attached_to": "UUID"
}

List of events handled

Almanach will process those events:

  • compute.instance.create.end
  • compute.instance.delete.end
  • compute.instance.resize.confirm.end
  • compute.instance.rebuild.end
  • volume.create.end
  • volume.delete.end
  • volume.resize.end
  • volume.attach.end
  • volume.detach.end
  • volume.update.end
  • volume.exists
  • volume_type.create

License

Almanach is distributed under Apache 2.0 LICENSE.