meter aodh

Bug #1746086 reported by gordon chung
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ceilometer
Triaged
Wishlist
Unassigned

Bug Description

taken from https://review.openstack.org/309861
===========================
Support Alarm Metering Data
===========================

https://blueprints.launchpad.net/ceilometer/+spec/telemetry-alarm-resource
https://blueprints.launchpad.net/aodh/+spec/telemetry-alarm-resource

Problem description
===================

As a cloud vendor, I want to telemeter alarm resources, so I can bill
for such resources, but now, Ceilometer doesn't collect such metering data,
the only way we have is providing a very limited quota to every project.

This situation needs to be improved.

Proposed change
===============

For each polling cycle, ceilometer polling agent will call Aodh API to get
alarms usage for each project, then record as samples to back end, so billing
service can retrieve that data and charge on it.

Aodh will provide an API:

    /v2/usage/alarms?project_id=<PROJECT_ID>

If caller is non admin, then it will only return its own usage data.
If caller is admin and no project_id is specified, then will return a list of
all projects, each element is an usage data for a project.
If caller is admin and project_id is specified, only that project's usage data
will be returned.

the response is like this:

.. code-block:: json

    [
        {
            'total': 999,
            'alarm': 1,
            'ok': 998,
            'insufficient_data': 0,
            'project_id': '113670876ce64d69bc9b8288ffc7d7f5'
        }
    ]

Group by user_id will not be supported, we charge on project, not on individual
user.

When user creates an alarm, updates it or deletes it, aodh-api will send a
notification to AMQP, to notify Ceilometer that there is an event occurs.

The notification event_type will be:

* alarm.create.end (no start because we only write database)
* alarm.update.end (ditto)
* alarm.delete.end (ditto)

the payload will be consistent to the alarm API model, such as:

.. code-block:: json

    {
        "alarm_actions": [],
        "alarm_id": "aa0541eb-6384-4579-b128-6e598533913b",
        "description": "Alarm when * event occurred.", # not usefull
        "enabled": true,
        "rule": {
            "event_type": "*",
            "query": []
        },
        "insufficient_data_actions": [],
        "name": "I wish you have a happy life",
        "ok_actions": [],
        "project_id": "74a0f0d8734d46a18773139c0c331e5e",
        "repeat_actions": False,
        "severity": "low",
        "state": "insufficient data",
        "state_timestamp": "2016-04-23T05:45:45.724697",
        "time_constraints": [],
        "timestamp": "2016-04-25T12:26:50.391207",
        "type": "event",
        "user_id": "c417eb1ad2534df483e9065c03ab8da8"
    }

Ceilometer can decide what to do for such notification, store it to event
backend and allow elasticsearch do something usefull, or drop it, whatever.

And notifications sent by aodh-evaluator and aodh-listener will be ignored
because we only want to audit user's operations.

The notification can be shutdown by configuration, just like other services
do.

Alternatives
------------

Lie down there and wait for complaint.

Data model impact
-----------------

None

REST API impact
---------------

Aodh will have a new API /v2/usage/alarms?project_id=<ID>

Security impact
---------------

None

Pipeline impact
---------------

None

Other end user impact
---------------------

None

Performance/Scalability Impacts
-------------------------------

None

Other deployer impact
---------------------

None

Developer impact
----------------

None

Implementation
==============

Assignee(s)
-----------

Primary assignee:
  <zqfan>

Other contributors:
  <None>

Ongoing maintainer:
  <zqfan>

Work Items
----------

* Aodh provide the usage API
* Aodh send notification when API does CUD on alarm
* Ceilometer pollster for alarm count
* Ceilometer event for alarm notification

Future lifecycle
================

None

Dependencies
============

None

Testing
=======

* unit test for source code
* gabbi test for Aodh new API

Documentation Impact
====================

Will along with the code.

References
==========

None

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.