Fix: alarms stuck in "insufficient state" and update usage guide

Change-Id: Iab355bc233194106f1dcbbdf218983588de09eb7
Closes-bug: #1627151
This commit is contained in:
doantungbk 2016-09-23 12:24:05 -07:00
parent 35a87d1ce8
commit dd3bede30f
2 changed files with 57 additions and 58 deletions

View File

@ -96,12 +96,9 @@ and Aodh plugins will need to be enabled in local.conf:
.. code-block::ini
**enable_plugin ceilometer https://git.openstack.org/openstack/ceilometer**
**enable_plugin ceilometer https://git.openstack.org/openstack/ceilometer master**
**enable_plugin aodh https://git.openstack.org/openstack/aodh**
Further, once OpenStack Monasca is leveraged in Tacker, it will need to be enabled
plugin in local.conf as well.
**enable_plugin aodh https://git.openstack.org/openstack/aodh master**
How to monitor VNFs via alarm triggers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -113,46 +110,47 @@ Firstly, vnfd and vnf need to be created successfully using pre-defined TOSCA te
for alarm monitoring. Then, in order to know whether alarm configuration defined in Tacker
is successfully passed to Ceilometer, Tacker users could use CLI:
.. code-block::ini
.. code-block:: console
$ ceilometer alarm-list
$ceilometer alarm-list
+--------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+-------------------+----------+---------+------------+------------------------------------+------------------+
| Alarm ID | Name | State | Severity | Enabled | Continuous | Alarm condition | Time constraints |
+--------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+-------------------+----------+---------+------------+------------------------------------+------------------+
| 35a80852-e24f-46ed-bd34-e2f831d00172 | tacker.vnfm.infra_drivers.heat.heat_DeviceHeat-6f3e523d-9e12-4973-a2e8-ea04b9601253-vdu1_cpu_usage_monitoring_policy-qer2ipsi2mk4 | insufficient data | low | True | True | avg(cpu_util) > 50 during 1 x 65s | None |
+--------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+-------------------+----------+---------+------------+------------------------------------+------------------+
+--------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+-------------------+----------+---------+------------+-------------------------------------+------------------+
| Alarm ID | Name | State | Severity | Enabled | Continuous | Alarm condition | Time constraints |
+--------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+-------------------+----------+---------+------------+-------------------------------------+------------------+
| f6a89242-d849-4a1a-9eb5-de4c0730252f | tacker.vnfm.infra_drivers.openstack.openstack_OpenStack-d4900104-6257-4084-8506-9fa6895d1294-vdu1_cpu_usage_monitoring_policy-7rt36gqbmuqo | insufficient data | low | True | True | avg(cpu_util) > 15.0 during 1 x 65s | None |
+--------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+-------------------+----------+---------+------------+-------------------------------------+------------------
$ ceilometer alarm-show 35a80852-e24f-46ed-bd34-e2f831d00172
.. code-block:: console
+---------------------------+--------------------------------------------------------------------------+
| Property | Value |
+---------------------------+--------------------------------------------------------------------------+
| alarm_actions | ["http://ubuntu:9890/v1.0/vnfs/6f3e523d-9e12-4973-a2e8-ea04b9601253/vdu1 |
| | _cpu_usage_monitoring_policy/respawn/g0jtsxu9"] |
| alarm_id | 35a80852-e24f-46ed-bd34-e2f831d00172 |
| comparison_operator | gt |
| description | utilization greater_than 50% |
| enabled | True |
| evaluation_periods | 1 |
| exclude_outliers | False |
| insufficient_data_actions | None |
| meter_name | cpu_util |
| name | tacker.vnfm.infra_drivers.heat.heat_DeviceHeat-6f3e523d- |
| | 9e12-4973-a2e8-ea04b9601253-vdu1_cpu_usage_monitoring_policy- |
| | qer2ipsi2mk4 |
| ok_actions | None |
| period | 65 |
| project_id | 8361286345c4482cb777da6657c38238 |
| query | |
| repeat_actions | True |
| severity | low |
| state | insufficient data |
| statistic | avg |
| threshold | 50 |
| type | threshold |
| user_id | b5f7fefac7874e45ae93443e95447fb9 |
+---------------------------+--------------------------------------------------------------------------+
$ ceilometer alarm-show 35a80852-e24f-46ed-bd34-e2f831d00172
+---------------------------+--------------------------------------------------------------------------+
| Property | Value |
+---------------------------+--------------------------------------------------------------------------+
| alarm_actions | ["http://pinedcn:9890/v1.0/vnfs/d4900104-6257-4084-8506-9fa6895d1294/vdu |
| | 1_cpu_usage_monitoring_policy/SP1/i42kd018"] |
| alarm_id | f6a89242-d849-4a1a-9eb5-de4c0730252f |
| comparison_operator | gt |
| description | utilization greater_than 50% |
| enabled | True |
| evaluation_periods | 1 |
| exclude_outliers | False |
| insufficient_data_actions | None |
| meter_name | cpu_util |
| name | tacker.vnfm.infra_drivers.openstack.openstack_OpenStack-d4900104-6257-40 |
| | 84-8506-9fa6895d1294-vdu1_cpu_usage_monitoring_policy-7rt36gqbmuqo |
| ok_actions | None |
| period | 65 |
| project_id | abdc74442be44b9486ca5e32a980bca1 |
| query | metadata.user_metadata.vnf_id == d4900104-6257-4084-8506-9fa6895d1294 |
| repeat_actions | True |
| severity | low |
| state | insufficient data |
| statistic | avg |
| threshold | 15.0 |
| type | threshold |
| user_id | 25a691398e534893b8627f3762712515 |
+---------------------------+--------------------------------------------------------------------------+
How to trigger alarms:

View File

@ -323,16 +323,6 @@ class OpenStack(abstract_driver.DeviceAbstractDriver,
# scale_resource_type is custome type mapped the HOT template
# generated for all VDUs in the tosca template
properties['resource']['type'] = scale_resource_type
# support monitoring
if 'policies' in vnfd_dict:
for policies in vnfd_dict['policies']:
policy_name, policy_dt = list(policies.items())[0]
if policy_dt['type'] ==\
'tosca.polices.tacker.Alarming':
metadata_dict = dict()
metadata_dict['metering.vnf_id'] = vnf['id']
properties['resource']['metadata'] = metadata_dict
break
# TODO(kanagraj-manickam) add custom type params here, to
# support parameterized template
group_hot['properties'] = properties
@ -406,6 +396,7 @@ class OpenStack(abstract_driver.DeviceAbstractDriver,
def generate_hot_alarm_resource(topology_tpl_dict, heat_tpl):
alarm_resource = dict()
heat_dict = yamlparser.simple_ordered_parse(heat_tpl)
sub_heat_dict = copy.deepcopy(heat_dict)
is_enabled_alarm = False
def _convert_to_heat_monitoring_prop(mon_policy):
@ -439,11 +430,17 @@ class OpenStack(abstract_driver.DeviceAbstractDriver,
policy_name, policy_dt = list(policies.items())[0]
if policy_dt['type'] == \
'tosca.policy.tacker.Scaling':
# Fixed metadata. it will be fixed
# once targets are supported
metadata_dict = dict()
metadata_dict['metadata.user_metadata.vnf_id'] =\
metadata_dict['metering.vnf_id'] = vnf['id']
sub_heat_dict['resources']['VDU1']['properties']['metadata'] =\
metadata_dict
matching_metadata_dict = dict()
matching_metadata_dict['metadata.user_metadata.vnf_id'] =\
vnf['id']
mon_policy_hot['properties']['matching_metadata'] =\
metadata_dict
matching_metadata_dict
break
return mon_policy_hot
@ -459,9 +456,11 @@ class OpenStack(abstract_driver.DeviceAbstractDriver,
break
heat_tpl_yaml = yaml.dump(heat_dict)
sub_heat_tpl_yaml = yaml.dump(sub_heat_dict)
return (is_enabled_alarm,
alarm_resource,
heat_tpl_yaml)
heat_tpl_yaml,
sub_heat_tpl_yaml)
def generate_hot_from_legacy(vnfd_dict):
assert 'template' not in fields
@ -565,9 +564,9 @@ class OpenStack(abstract_driver.DeviceAbstractDriver,
vnfd_dict['topology_template'],
'scaling.yaml')
(is_enabled_alarm, alarm_resource,
heat_tpl_yaml) = generate_hot_alarm_resource(
vnfd_dict['topology_template'],
heat_template_yaml)
heat_tpl_yaml, sub_heat_tpl_yaml) =\
generate_hot_alarm_resource(vnfd_dict['topology_template'],
heat_template_yaml)
if is_enabled_alarm and not is_scaling_needed:
heat_template_yaml = heat_tpl_yaml
fields['template'] = heat_template_yaml
@ -577,7 +576,9 @@ class OpenStack(abstract_driver.DeviceAbstractDriver,
main_dict['resources'].update(alarm_resource)
main_yaml = yaml.dump(main_dict)
fields['template'] = main_yaml
fields['files'] = {'scaling.yaml': heat_template_yaml}
fields['files'] = {'scaling.yaml': sub_heat_tpl_yaml}\
if is_enabled_alarm else {
'scaling.yaml': heat_template_yaml}
vnf['attributes']['heat_template'] = main_yaml
# TODO(kanagaraj-manickam) when multiple groups are
# supported, make this scaling atribute as