Ask Your Question
0

How to create Aodh alarm based on network.incoming.bytes meter?

asked 2020-03-03 02:06:14 -0500

Alexey.Smovzh gravatar image

updated 2020-03-14 10:07:56 -0500

UPD: I'm give up. With this lack of documentation for ceilometer, aodh, gnocchi this is no reason to suffer trying to make it work. Decide to use Prometheus instead. Here is a good and most important working examples: https://medium.com/@pasquier.simon/monitoring-your-openstack-instances-with-prometheus-a7ff4324db6c (https://medium.com/@pasquier.simon/mo...) https://github.com/syseleven/heat-examples/tree/master/autoscaling (https://github.com/syseleven/heat-exa...)

I'm using Openstack Train. Trying to create Aodh alarm based on instance network interface utilization (network.incoming.bytes meter). Ceilometer and Gnocchi looks like collecting measured data right, but Aodh alarm always stay in 'insufficient data' state, does not matter how long to wait. I think i provide wrong options in 'alarm create' command and can't find what correct one. Will be grateful for advise.

Steps to reproduce:

Create simple instance based on Cirros image

$ openstack server list
+--------------------------------------+------+--------+-----------------------------+-------+--------+
| ID                                   | Name | Status | Networks                    | Image | Flavor |
+--------------------------------------+------+--------+-----------------------------+-------+--------+
| 3156a79f-5241-425f-812a-d24686be4ef8 | df01 | ACTIVE | infrastructure=10.64.40.161 |       | tiny   |
+--------------------------------------+------+--------+-----------------------------+-------+--------+

Get instance_network_interface resource ID

$ openstack metric resource list | grep 3156a79f-5241-425f-812a-d24686be4ef8
...
| 2e8d4d42-1503-5ac4-8712-3a1862e8c7d3 | instance_network_interface | ffefdbe38c074626a0dda8f9ce66d2bf | 2144e3aed1554bd394d671f2ae19c693 | instance-00000053-3156a79f-5241-425f-812a-d24686be4ef8-tapb4f1890a-20 | 2020-03-02T17:36:45.791038+00:00 | None                             | 2020-03-02T17:36:45.791061+00:00 | None         | 3fcd1e054b004a49b4f37cebb1c8518a:ec72b8a302504a2eaa0f3e10e33bd427 |
...

List resource collected metrics

$ openstack metric resource show 2e8d4d42-1503-5ac4-8712-3a1862e8c7d3
+-----------------------+-----------------------------------------------------------------------+
| Field                 | Value                                                                 |
+-----------------------+-----------------------------------------------------------------------+
| created_by_project_id | ec72b8a302504a2eaa0f3e10e33bd427                                      |
| created_by_user_id    | 3fcd1e054b004a49b4f37cebb1c8518a                                      |
| creator               | 3fcd1e054b004a49b4f37cebb1c8518a:ec72b8a302504a2eaa0f3e10e33bd427     |
| ended_at              | None                                                                  |
| id                    | 2e8d4d42-1503-5ac4-8712-3a1862e8c7d3                                  |
| metrics               | network.incoming.bytes: 5035ef97-338c-474d-99f4-a6e110907410          |
|                       | network.incoming.packets: d302dfe1-bd00-45a1-8303-b16c0064f467        |
|                       | network.outgoing.bytes: c7602e11-bf2a-49de-817f-101c6457f23a          |
|                       | network.outgoing.packets: 59bfe5fd-4004-4d70-b5d0-1663b4c03417        |
| original_resource_id  | instance-00000053-3156a79f-5241-425f-812a-d24686be4ef8-tapb4f1890a-20 |
| project_id            | ffefdbe38c074626a0dda8f9ce66d2bf                                      |
| revision_end          | None                                                                  |
| revision_start        | 2020-03-02T17:36:45.791061+00:00                                      |
| started_at            | 2020-03-02T17:36:45.791038+00:00                                      |
| type                  | instance_network_interface                                            |
| user_id               | 2144e3aed1554bd394d671f2ae19c693                                      |
+-----------------------+-----------------------------------------------------------------------+

Check measured data

$ openstack metric measures show 5035ef97-338c-474d-99f4-a6e110907410
+---------------------------+-------------+--------+
| timestamp                 | granularity |  value |
+---------------------------+-------------+--------+
| 2020-03-02T19:36:00+02:00 |        60.0 |    0.0 |
| 2020-03-02T19:37:00+02:00 |        60.0 | 1616.0 |
| 2020-03-02T19:38:00+02:00 |        60.0 | 1714.0 |
| 2020-03-02T19:39:00+02:00 |        60.0 | 1714.0 |
| 2020-03-02T19:40:00+02:00 |        60.0 | 1714.0 |
| 2020-03-02T19:41:00+02:00 |        60.0 | 1714.0 |
| 2020-03-02T19:42:00+02:00 |        60.0 | 1714.0 |
| 2020-03-02T19:43:00+02:00 |        60.0 | 1714.0 |
| 2020-03-02T19:44:00+02:00 |        60.0 | 1714.0 |
| 2020-03-02T19:45:00+02:00 |        60.0 | 1714.0 |
| 2020-03-02T19:46:00+02:00 |        60.0 | 1714.0 |
| 2020-03-02T19:47:00+02:00 |        60.0 | 1714.0 |
+---------------------------+-------------+--------+

Create alarm

$ aodh alarm create --name net_high \
                    --type gnocchi_aggregation_by_metrics_threshold \
                    --description 'high network bandwidth utilization' \
                    --metric network.incoming.bytes \
                    --threshold 10000 \
                    --comparison-operator gt \
                    --granularity 60 \
                    --evaluation-period 3 \
                    --alarm-action='log://' \
                    --aggregation-method rate:mean \
                    --resource-type instance_network_interface \
                    --resource-id 3156a79f-5241-425f-812a-d24686be4ef8

Check alarm. Does not matter how long to wait: 1, 10, 30 minutes, it still in 'insufficient data' state

$ aodh alarm list
+--------------------------------------+------------------------------------------+----------+-------------------+----------+---------+
| alarm_id                             | type                                     | name     | state             | severity | enabled |
+--------------------------------------+------------------------------------------+----------+-------------------+----------+---------+
| f2ec4e1d-ec6f-431d-aa47-32597808adc9 | gnocchi_aggregation_by_metrics_threshold | net_high | insufficient data | low      | True    |
+--------------------------------------+------------------------------------------+----------+-------------------+----------+---------+
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-03-12 13:44:41 -0500

Alexey.Smovzh gravatar image

The following command creates proper alarm.

'--resource-id' refers to 'id' of instance interface metric, which can be found with command:

openstack metric resource list | grep instance_network_interface.*<instance-id>
aodh alarm create --name net_hi 
                  --type gnocchi_resources_threshold 
                  --description 'high network bandwidth utilization' 
                  --metric network.incoming.bytes 
                  --threshold 10000 
                  --comparison-operator gt 
                  --granularity 60 
                  --evaluation-period 1 
                  --alarm-action='log://' 
                  --aggregation-method rate:mean 
                  --resource-id 54659253-92a3-5a2f-ac43-3dc745f115be 
                  --resource-type instance_network_interface

Now the question: how to use this alarm with Heat for autoscaling purpose? How to refer to metric ID (54659253-92a3-5a2f-ac43-3dc745f115be) from Heat alarm since this resource type does not have any meta attributes unlike 'instance' resource type have 'server_group' meta attribute? Any suggestions?

  net_alarm_high: 
    type: OS::Aodh::GnocchiAggregationByResourcesAlarm
    properties:
      description: Scale up if Network bandwidth > 1Mbit
      metric: network.incoming.bytes
      aggregation_method: rate:mean
      granularity: 60
      evaluation_periods: 1
      threshold: 10000
      resource_type: instance_network_interface
      comparison_operator: gt
      alarm_actions:
        - str_replace:
            template: trust+url
            params:
              url: {get_attr: [cirros_scaleup_policy, signal_url]}
      query:
        list_join:
          - ''
          - - {'=': {server_group: {get_param: "OS::stack_id"}}}
edit flag offensive delete link more

Comments

I'm give up. With this lack of documentation for ceilometer, aodh, gnocchi this is no reason to suffer trying to make it work.

Alexey.Smovzh gravatar imageAlexey.Smovzh ( 2020-03-14 08:35:58 -0500 )edit

Decide to use Prometheus instead. Here is a good and most important working examples: https://medium.com/@pasquier.simon/monitoring-your-openstack-instances-with-prometheus-a7ff4324db6c (https://medium.com/@pasquier.simon/mo...) https://github.com/syseleven/heat-examples/tree/master/autoscaling (https://github.com/syseleven/heat-exa...)

Alexey.Smovzh gravatar imageAlexey.Smovzh ( 2020-03-14 08:37:09 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2020-03-03 02:04:59 -0500

Seen: 78 times

Last updated: Mar 14