Monasca-setup to configure for instance scale_group metadata

Fix to enable instance scale_group metadata dimension in libvirt
plugin to support monasca based autoscaling.

Change-Id: Ia7c51091c6a07105f6d9e295957ad7bf724e004e
This commit is contained in:
Rakesh H S 2016-03-01 22:38:40 +05:30
parent 98ba74cbd8
commit 2ec8f70579
3 changed files with 13 additions and 2 deletions

View File

@ -23,7 +23,8 @@ init_config:
# 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']
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.

View File

@ -1236,6 +1236,8 @@ If the owner of the VM is in a different tenant the Agent Cross-Tenant Metric Su
`nova_refresh` specifies the number of seconds between calls to the Nova API to refresh the instance cache. This is helpful for updating VM hostname and pruning deleted instances from the cache. By default, it is set to 14,400 seconds (four hours). Set to 0 to refresh every time the Collector runs, or to None to disable regular refreshes entirely (though the instance cache will still be refreshed if a new instance is detected).
'metadata' specifies the list of instance metadata keys to be sent as dimensions. This is helpful to give more information about an instance. By default 'scale_group' metadata is used for supporting auto scaling in Heat.
`vm_probation` specifies a period of time (in seconds) in which to suspend metrics from a newly-created VM. This is to prevent quickly-obsolete metrics in an environment with a high amount of instance churn (VMs created and destroyed in rapid succession). The default probation length is 300 seconds (five minutes). Setting to 0 disables VM probation, and metrics will be recorded as soon as possible after a VM is created.
`ping_check` includes the entire command line (sans the IP address, which is automatically appended) used to perform a ping check against instances, with a keyword `NAMESPACE` automatically replaced with the appropriate network namespace for the VM being monitored. Set to False (or omit altogether) to disable ping checks. This is automatically populated during `monasca-setup` from a list of possible `ping` command lines. Generally, `fping` is preferred over `ping` because it can return a failure with sub-second resolution, but if `fping` does not exist on the system, `ping` will be used instead.
@ -1261,6 +1263,8 @@ init_config:
region_name: 'region1'
cache_dir: /dev/shm
nova_refresh: 14400
metadata:
- scale_group
vm_probation: 300
ping_check: /opt/stack/venv/monasca_agent-20160224T213950Z/bin/ip netns exec NAMESPACE
/bin/ping -n -c1 -w1 -q
@ -1296,6 +1300,7 @@ Example cache:
"disk" : 1,
"tenant_id" : "7d8e24a1e0cb4f8c8dedfb2010992b62",
"zone" : "nova",
"scale_group": "a1207522-c5fb-4621-a839-c00b638cfb47",
"vcpus" : 1,
"hostname" : "vm01",
"ram" : 512

View File

@ -24,6 +24,10 @@ cache_dir = "/dev/shm"
nova_refresh = 60 * 60 * 4 # Four hours
# Probation period before metrics are gathered for a VM (in seconds)
vm_probation = 60 * 5 # Five minutes
# 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']
# List 'ping' commands (paths and parameters) in order of preference.
# The plugin will use the first fuctional command. 127.0.0.1 will be appended.
ping_options = [["/usr/bin/fping", "-n", "-c1", "-t250", "-q"],
@ -95,7 +99,8 @@ class Libvirt(Plugin):
# Start with plugin-specific configuration parameters
init_config = {'cache_dir': cache_dir,
'nova_refresh': nova_refresh,
'vm_probation': vm_probation}
'vm_probation': vm_probation,
'metadata': metadata}
for option in cfg_needed:
init_config[option] = nova_cfg.get(cfg_section, cfg_needed[option])