Add scale_group dimension to libvirt plug-in
Adds additional dimension scale_group to the metrics reported by libvirt monasca agent plugin, to help heat auto-scaling. Change-Id: I280438c6f9e4ea297c268e83f535d422d0370a53 Closes-Bug: #1504042 Co-Authored-By: Kanagaraj Manickam <kanagaraj.manickam@hp.com>
This commit is contained in:
parent
4daacbe4bc
commit
231f89f7cc
|
@ -13,6 +13,10 @@ init_config:
|
|||
vm_probation: 300
|
||||
# Command line to ping VMs, set to False (or simply remove) to disable
|
||||
ping_check: /bin/ping -n -c1 -w1 -q
|
||||
# List of instance metadata keys to be sent as dimensions
|
||||
# By default 'scale_group' metadata is used here for supporting auto
|
||||
# scaling in Heat.
|
||||
metadata: ['scale_group']
|
||||
instances:
|
||||
# Instances are automatically detected through queries to the Nova API,
|
||||
# and therefore do not need to be listed here, so this remains empty.
|
||||
|
|
|
@ -85,6 +85,13 @@ class LibvirtCheck(AgentCheck):
|
|||
'vcpus': inst_flavor.vcpus,
|
||||
'ram': inst_flavor.ram,
|
||||
'disk': inst_flavor.disk}
|
||||
|
||||
if self.init_config.get('metadata'):
|
||||
for metadata in self.init_config.get('metadata'):
|
||||
if instance.metadata.get(metadata):
|
||||
id_cache[inst_name][metadata] = (instance.metadata.
|
||||
get(metadata))
|
||||
|
||||
# Try to add private_ip to id_cache[inst_name]. This may fail on ERROR'ed VMs.
|
||||
try:
|
||||
id_cache[inst_name]['private_ip'] = instance.addresses['private'][0]['addr']
|
||||
|
@ -318,6 +325,12 @@ class LibvirtCheck(AgentCheck):
|
|||
# Add dimensions that would be helpful for operations
|
||||
dims_operations = dims_customer.copy()
|
||||
dims_operations['tenant_id'] = instance_cache.get(inst_name)['tenant_id']
|
||||
if self.init_config.get('metadata'):
|
||||
for metadata in self.init_config.get('metadata'):
|
||||
metadata_value = (instance_cache.get(inst_name).
|
||||
get(metadata))
|
||||
if metadata_value:
|
||||
dims_operations[metadata] = metadata_value
|
||||
# Remove customer 'hostname' dimension, this will be replaced by the VM name
|
||||
del(dims_customer['hostname'])
|
||||
except TypeError:
|
||||
|
|
Loading…
Reference in New Issue