Cloud VM Automation Guide
1. VM configuration for automation
1.1. VM monitoring and metrics
To display metrics of a deployed VM with metrics enabled, click the Metrics symbol on the VM icon.
To refresh metrics data, click the circular arrows refresh button on the right.
To toggle the display of metrics, click Available metrics on the right, and select the desired metrics.
To filter metrics, click the funnel symbol. Enter the Granularity, Statistics, Period, and/or Dimensions.
Privilege: Access virtual machine metrics
To configure the display of metrics at the virtual appliance level, do these steps.
- Select a Virtual appliance and go to Monitoring
- Optionally configure the refresh interval. To do this, select the Refresh data every checkbox and enter a number of minutes
- Choose the metrics you wish to display and filter by metric statistics.
To refresh the display with the latest data from the API, click the round arrow refresh button.
1.2. Automate VM first boot with a configuration or script
Before you begin:
- Create your VM with a template that is compatible with cloud-init version 0.7.9 or above, or cloudbase-init, or a similar system
- In private cloud, the platform will create an ISO disk for Configuration drive
To add a VM bootstrap configuration or script in private or public cloud:
- Go to create or edit VM → Bootstrap script
- Paste your configuration or script in the Bootstrap script text box
- Continue to configure the VM or click Save to finish
Notes about bootstrap in private cloud
- If the user does not enter the FQDN on the General tab when editing the VM, the platform will try to set the FQDN using the name or ID attribute of the VM, and the domain of the VM's networks, or the localhost domain
If DHCP is not used in your datacenter, the network configuration of the VM can be read from cloud-init, so you do not need to configure the network or allow access to the VM
- Abiquo uses the ConfigDrive DataSource for cloud-init. Reference: http://cloudinit.readthedocs.io/en/latest/topics/datasources/configdrive.html
Notes about startup scripts in AWS
In AWS you must always select a guest setup option
In AWS, for Windows, depending on the template and its guest setup option, the script format is:
cloudbase_init: cloud-init or shellscript
ec2launch and ec2config: you must have the following tags at the start and end of your script
batch script, use <script></script>
powershell script, use <powershell></powershell>
ec2launch v2: yaml format. See https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-windows-user-data.html#user-data-yaml-scripts.
If your script format is invalid, AWS will try ec2launch and ec2config format. See: https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-windows-user-data.html
1.3. Add variables for the configuration of your VM
Before you deploy a VM, you can set guest variables to pass user data to your VM. This functionality uses cloud-init and requires appropriate templates. In private cloud, the templates must have the guest setup flag set to cloud init. The administrator can add default variables for the VM template.
This functionality is available through the API. The platform stores variables in the VirtualMachine "variables" attribute, which is a dictionary of keys and values. See Update a virtual machine in VirtualMachinesResource
You can modify VM variables before you deploy the VM
To add VM variables:
Go to Virtual datacenters → edit a VM that is not deployed → Variables
Enter each Key and Value
The length of these can be up to 255 characters each
Click Add
To delete a variable click the trash can symbol beside the Key. To edit the Value of a variable, click the pencil edit button beside the Value
To apply changes to variables, and other changes to the VM, click Save
1.4. Use collectd plugin for custom metrics
Introduction
Abiquo supports collectd with an integration in the multi-cloud platform.
This enables you to easily work with custom VM monitoring and metrics in public cloud providers, including Amazon, Azure, and Google Cloud, as well as VMware vCenter.
In the Abiquo multi-cloud platform you can create alerts and automation based on your custom metrics. For example, you can automatically scale out your VMs based on your application metrics.
After you configure collectd and the Abiquo collectd plugin, the plugin will automatically push the values from collectd to the Abiquo API using the Abiquo API endpoints for collectd.
The endpoints may be for a VM, or a group of VMs in a VApp, or for a scaling group.
The Abiquo API then pushes the collectd metrics to the Abiquo Monitoring Server. Users can then display metrics through the UI or use them for automation.
How to install and configure collected for VMs in Abiquo
The following steps are a general guide:
- In Abiquo, create an OAuth application in Abiquo for collectd. See Add an application for OAuth
- Assign the privilege to “Allow user to push own metrics”
- Install collectd on your VM
- Install the Abiquo collectd plugin (from source or using the Abiquo Chef cookbook).
- Configure the Abiquo API path to push the metrics to the VM in Abiquo. Check the correct format of the API path in the API documentation
- Configure your metrics in collectd
The Abiquo collectd plugin will automatically push all collectd metrics to the Abiquo API in PUTVAL JSON format.
To display the VM metrics in Abiquo:
- Edit your VM and go to Monitoring
- Select Fetch metrics data.
- Optionally select the monitoring level on providers that support it, e.g. AWS
- Select the metrics to display from the custom metrics and the built-in metrics of the cloud provider or hypervisor
- Save your changes to the VM. Optionally define a scaling group to increase the number of VMs running your application automatic scaling actions. See Define a scaling group
- If your VM is not running, deploy to launch the VM. Wait several minutes for the server to return metrics
- On the VM icon near the top right corner, click the metrics symbol. Or in the Virtual appliance, go to Monitoring → Virtual machines
- Configure the metrics to display the required statistic, frequency, dimensions, and so on.
- Create alarms to set metric thresholds and alerts on groups of alarms, to notify or respond to changing application conditions with automation using action plans. See Cloud VM Automation Guide
Automate the install of collectd using Chef
This is an example use case with Chef using the Abiquo Chef cookbook.
- In Abiquo, the administrator creates an OAuth application in Abiquo for collectd. See Add an application for OAuth
- Assign the privilege to “Allow user to push own metrics”
- On the Chef server, the administrator creates a role with the following:
- The monitoring recipes to install the Abiquo collectd plugin
- The OAuth tokens for the application configured
- In Abiquo, users edit the VM and go to Chef, then select the appropriate collectd role.
Abiquo recommends this kind of automation because the OAuth application belongs to the tenant administrator. This means that the administrator prepares the configuration for users, it is easy to apply it automatically on a large scale, and the administrator can protect the configuration from accidental changes when users load their own Chef recipes, etc.
Related links
- Collectd website: http://collectd.org/
- Abiquo-collectd plugin: https://github.com/abiquo/collectd-abiquo
- Abiquo Chef cookbook for the collectd plugin: https://github.com/abiquo/collectd-abiquo-cookbook
- Abiquo API documentation of VM resource: VirtualMachinesResource
- Push collected data to a VM: https://wiki.abiquo.com/api/latest/VirtualMachinesResource.html#push-collectd-values-on-a-virtual-machine
- Example collectd metrics push: POST_cld_vdcs_X_vapps_X_vms_X_collectd_CT_app_j
Example collectd data object
Here is an example of a data entity to update a virtual machine with the collectd metrics specification.
Custom metrics entities
Abiquo enables you to use the API or collectd to push custom metrics for many cloud and infrastructure entities including:
Public cloud region (cloud and infrastructure)
Datacenter (cloud and infrastructure)
Machine
Rack
Virtual appliance
Scaling group
Virtual machines
Virtual machine
The Abiquo UI enables users to display custom metrics for the following entities:
- Virtual appliance
- Scaling group
- Virtual machine
2. Scaling groups
Introduction to autoscaling
To configure an automatic response to changing demands for resources, you can scale out VMs or scale them in, which is also called horizontal autoscaling. To scale out, the platform clones the base VM and deploys the clones. To scale in, the platform will delete clone VMs and undeploy the base VM. Scaling operations are subject to all standard platform constraints, such as privileges and allocation limits.
Screenshot: A scaling group with VMs deployed automatically.
- Limitations:
- Autoscaling does not clone captured VMs, so to use scaling groups with a captured VM, create an instance and recreate the VM. Create instances to save VM disks to templates
- VApp specs do not support scaling groups. See What do specs save and create
Scaling groups have aggregate alarms that are associated with the base VM. This means that you can push custom metrics for clone VMs but you cannot create alarms for cloned VMs that are part of a scaling group.
- State of base VM: A scaling group with a deployed base VM would be destroyed if the base VM were deleted directly on the hypervisor. In contrast, a scaling group with an undeployed base VM is not vulnerable to interference at the hypervisor level
Automatically scale VMs
The platform enables you to automatically scale out (add more VMs) or scale up (add more resources to existing VMs).
Privilege: Manage scaling groups, Manage workflow for scaling groups
To use autoscaling do these steps:
- Create a base VM, which can be deployed or undeployed
- Configure the VM and enable metrics
- Define a scaling group with rules for scaling the VM.
The checkbox to automatically create a scaling action, will create the following automatically:- Standard alarms and alerts for the selected metrics
- Action plans with scaling actions for the VM and triggers for the action plans, which are monitoring alerts
Related pages:
Define a scaling group
Before you begin:
- Configure the base VM that will be scaled
- Ensure that you have enough resources in your virtual datacenter to deploy up to the maximum number of cloned VMs, especially IP addresses
To create a scaling group:
- Go to Virtual datacenters → Virtual appliances
- On the VM icon, from the options menu, select Define scaling group
- Enter the scaling parameters and rules
- Click Save
For more details see GUI Define scaling group
When you save the scaling group, Abiquo will mark the VM icon with the scaling group symbol and display the scaling group name.
- When the scaling group leaves maintenance mode, Abiquo will create clones of the base VM and deploy them to reach the minimum size.
- The number in the bottom right-hand corner of the icon is the number of running VMs in the scaling group, including the base VM.
To open the scaling group and check its parameters, click the scaling group symbol at the top of the VM icon.
Configure automatic scaling actions
To configure automatic scaling actions:
- When you define a scaling group, select Create autoscaling action and Save the scaling group
- In the dialog, select a Metric to control an autoscaling action
- To configure more options, including the thresholds for scaling in and scaling out, click Show more
- To add this action, click Add
- Add more actions as required
The platform will automatically create the alarms, alerts, and action plan to automatically scale in or out according to your thresholds.
Trigger autoscaling
Before you begin:
- Create a VM and a scaling group for the VM. See Define a scaling group
- If you create an automatic scaling action, then the VM metrics will trigger autoscaling when they cross the thresholds set for the actions
To enable autoscaling operations to run:
- Create an action plan with a scaling action for the VM with the scaling group. See Create an action plan to automate VM actions
- Create triggers to run the action plan. See Create a trigger for an action plan
When scaling, the platform will search for a scaling rule that is valid for the specific time range, or for a default rule. It will create or delete/undeploy the number of VMs in the rule, then wait for the cooldown period before accepting another scaling request.
How the platform scales VMs
To scale out, the platform does not deploy VMs that are undeployed in the scaling group. To clone the base VM, the platform will do the following:
- Create disks using the following:
- Copies of content of disks from the VM template
- Empty disks or volumes for each additional disk used in the VM
- Disk controllers used in the VM
- Apply ALL configuration used in the VM, for example:
- CPU and RAM
- Network connections of the same type (e.g. private network)
- Assignment of firewall policies and attachment to load balancers
- Chef recipes, backups, cloud-init, variables, and so on
- Metrics. The group of metrics from clone VMs and the base VM (if it is deployed) can activate alarms in the base VM, even if it is not deployed
- Exception – Alarms: the scaling group has only one set of alarms in the base VM
To scale in, Abiquo currently selects the VMs to delete or undeploy using first in, first out (FIFO). The platform deletes and undeploys VMs without requesting user confirmation when there are disks that are not stored in the Apps library (ISO configuration drive or additional hard disk).
Perform maintenance on a scaling group
To make changes to your VMs in a scaling group (manually deploy, undeploy, delete, etc.) and edit the scaling group, put it into maintenance mode, which will disable autoscaling.
When you leave maintenance mode, the platform will apply your modifications to the scaling group, e.g. adding new rules. Then the platform will adjust the number of VMs in the group to within the minimum and maximum size range.
To put the scaling group in maintenance mode:
- Go to Virtual datacenters → Virtual appliances → select VM
- At the bottom of the VM icon, click the cog maintenance symbol at the bottom of the VM icon
OR if the scaling group is open, click the spanner maintenance symbol in the top right corner
To leave maintenance mode
- Click a maintenance button
To automatically manage maintenance mode
- Trigger action plans with the action "Scaling group: start maintenance mode" or "Scaling group: end maintenance mode".
To delete the base VM, you must delete the scaling group first.
Display scaling actions for a scaling group
To display scaling actions of a scaling group:
- Go to Virtual datacenters → Virtual appliances → open virtual appliance
- If the scaling group is not in maintenance mode, click the cog maintenance symbol
- Edit the scaling group and go to Autoscaling actions
- To show or hide more details of a scaling action, click Show more or Show less
You can also display all the elements created for the automatic scaling action in the relevant sections of the UI, such as the Alarms tab, and the Control view.
Display metrics for a scaling group
Abiquo can display custom metrics for your scaling groups and built-in metrics for the VMs in the scaling group.
Scaling groups also have built-in metrics that are a composite of the VM metrics, and which have the same names as the VM metrics. The Abiquo UI does not display the built-in scaling group metrics but you can access them through the Abiquo API.
To display metrics for a scaling group:
- On the Scaling group icon, click the Monitoring symbol in the top right-hand corner
OR Open a Scaling group and click the Monitoring symbol - Select the Scaling group or Virtual machines page
You can configure the display of metrics at this level.
- To filter metric statistics, click on the Filter button and select the granularity, statistic, time frame, and dimension, as required.
Add tags to a scaling group
To manage tags for a scaling group:
- Go to Virtual appliances → Virtual machines
- Select a scaling group and put it into maintenance mode
- Open and edit the scaling group → Tags
- Add tags
For more details see GUI Edit template Tags
Move a scaling group to another virtual appliance in the same virtual datacenter
To move a scaling group to another virtual appliance in the same virtual datacenter:
- Put the scaling group in maintenance mode
- Click the Move button
- Select the new virtual appliance
Restrict a scaling group
To move a scaling group to a restricted virtual appliance, do these steps:
- Click the cog or wrench maintenance symbol to put the scaling group into maintenance mode
- Click the cross arrows move button
- Select the checkbox to Move to a restricted virtual appliance, or
Select a restricted virtual appliance, or
Create a new VApp and select the Restrict virtual appliance checkbox
Delete a scaling group
When you delete a scaling group, the platform will place all the VMs in the virtual appliance as regular VMs and the scaling group constraints will no longer exist.
To delete a scaling group:
- Go to Virtual datacenters → Virtual appliances
- Open the scaling group
- Click the wrench maintenance button to put the scaling group into maintenance mode
- Click the trash can delete button
Manage scaling groups with the API
API Documentation
For the Abiquo API documentation of this feature, see Abiquo API Resources and the page for this resource ScalingGroupsResource.
3. Alarms
Introduction to alarms
An alarm activates when a metric passes a certain threshold. If you imagine a dashboard for your metrics, alarms are like red lights that light up when conditions change, for example, when there is a problem.
If you would like the platform to notify you when an alarm activates, create an Alert for it in Control view.
- Alerts are a group of one or more alarms. They are like a worker monitoring a group of alarms; when all the lights for the group are lit up, then the worker takes action and activates the alert. Alerts can also trigger action plans to perform automated actions when their alarms activate. After you create an alert, create an action plan in Control view with the alert as a trigger.
You can create alarms for built-in VM metrics or scaling group metrics, as well as custom metrics created using the API for VMs, scaling groups, virtual appliances, and virtual datacenters.
- You cannot create alarms for cloned VMs that are part of a scaling group. This is because scaling groups have aggregate alarms that are associated with the base VM.
Display alarms in virtual datacenters
To display alarms in virtual datacenters:
- Go to Virtual datacenters
- Select a virtual datacenter or All virtual datacenters
- Go to Alarms
Create an alarm
Before you begin:
- Configure the metrics you will use in the alarm. See VM monitoring and metrics and Custom Metrics Resources.
To create an alarm:
Privilege: Access alarms section, Manage alarms
- Go to Virtual datacenter → Alarms
- Select virtual datacenter, virtual appliance, scaling group, or VM
- Click the + add button
- Enter the alarm details
For more details see GUI Create alarm - Click Save
The platform will create the alarm for the metric. If you would like the platform to notify you when an alarm is triggered, create an Alert.
Troubleshooting alarms that do not trigger
- Although the minimum value of the time period for alarm evaluation is 1 minute, the platform collects metrics data every 2 minutes by default but it can also be configured for each hypervisor or provider.
- For the default configuration, to ensure that an alarm will activate, it should be evaluated at intervals of greater than 2 minutes.
- In addition, each provider transmits metrics at different intervals, for example, with Amazon Basic monitoring, data is sent every 5 minutes, and with Advanced monitoring, every minute, whereas for vCloud, data is available on consultation.
For a scaling group, an alarm on a metric of the VM in the base workload will receive input from the metrics of all VMs in the scaling group. This means the base workload and/or the clone VMs. So an alarm for a scaling group can activate, even if the base workload is not deployed.
For API documentation about alarms on an entity, see the API documentation for the entity's resource. For example, for VMs, see VirtualMachinesResource.
Edit an alarm
When you edit an alarm, you cannot modify the metric or the entity.
When you edit an alarm, there is an extra field, "Active", that shows if the alarm is activated or not.
After you save the alarm, the platform will start to evaluate it again with new data when it receives the next set of metrics datapoints.
Delete an alarm
You can delete any alarm at any time, even if it is part of one or more alerts. The platform will not warn you that the alarm is used in an alert. However, you can check this in Control view. After you delete an alarm, you cannot recover it.
You can also remove an alarm from an alert.
Privilege: Access alarms section, Manage alarms, Manage alerts
To delete an alarm:
- Go to Virtual datacenters or Infrastructure → Alarms
- Select the alarm and delete it by clicking on the trash bin delete button
To remove an alarm from an alert:
Go to Control → Alerts → edit alert
Select the alarm, click the trash bin delete button, and confirm
The platform will remove it from this alert, but it will remain in all other alerts that it is associated with
If you delete a VM, the platform will delete any alarms associated with its metrics.
4. Alerts
Introduction to Alerts
Alerts are a group of one or more alarms. An alert can notify the user when it activates and it can also trigger action plans. An alert activates when all its alarms are activated. An alarm activates when a metric passes a certain threshold.
If you imagine a dashboard for your metrics, alarms are like red lights that light up when conditions change, for example, when there is a problem. Alerts are like a worker monitoring a group of alarms; when all the lights for the group are lit up, then the worker takes action and activates the alert.
Display Alerts
To display and manage alerts:
- Go to Control → Alerts
Create Alerts and Alarms
An alert will trigger when all its alarms are activated. You can use the alert to trigger actions. See Manage Action Plans.
Privilege: Access alerts section, Manage alerts
Before you begin:
- Retrieve VM built-in metrics, by editing VMs and enabling monitoring (see VM monitoring and metrics) or create custom metrics
- Create one or more metric alarms (see Manage cloud alarms and Infrastructure Alarms). You cannot save an alert without an alarm
To create an alert:
- Go to Control → Alerts
- Click the + add button
Enter the alert details and assign alarms as described below
Click Save
For more details see GUI Create alert General information
Click the + add button to assign alarms to the alert.
You must assign at least one alarm to be able to save the alert. Select an existing alarm, or create a new alarm, and assign it to the alert. Repeat for the required alarms
You can filter the Alarms list by Metric and also if the alarm is Active or not.
Remove alarms from alerts
You can delete any alarm at any time, even if it is part of one or more alerts. The platform will not warn you that the alarm is used in an alert. However, you can check this in Control view. After you delete an alarm, you cannot recover it.
You can also remove an alarm from an alert.
Privilege: Access alarms section, Manage alarms, Manage alerts
To delete an alarm:
- Go to Virtual datacenters or Infrastructure → Alarms
- Select the alarm and delete it by clicking on the trash bin delete button
To remove an alarm from an alert:
Go to Control → Alerts → edit alert
Select the alarm, click the trash bin delete button, and confirm
The platform will remove it from this alert, but it will remain in all other alerts that it is associated with
If you delete a VM, the platform will delete any alarms associated with its metrics.
5. Action plans
Introduction to Action plans
To enable more control over cloud operations, users can create action plans that will automatically run tasks on VMs and scaling groups, and to run general tasks.
Action plans are an important automation functionality of the platform. They can combine general tasks with tasks that run on VMs and scaling groups in different providers and have multiple triggers including alerts from custom metrics or built-in metrics and schedules. Each VM or scaling group can have multiple action plans.
Display action plans
To display action plans:
- Go to Control → Action plans
Create an action plan
Before you create an action plan, consider the elements that you wish to automate with the action plan. Create VMs or scaling groups, fetch metrics, and create alarms and alerts.
To create an action plan:
- Go to Control → Action plans, and click the + add button
- Enter the action plan details
- Go to Actions to add actions:
- Click the + add button
- Enter action details
- Type: Select a general action or select a VM or scaling group
- Decrease CPU/RAM: you cannot use this with hot-reconfigure and you must check that the OS is compatible
Instance: Name for Instance (clone) template. The platform will append the date to the name supplied
- Webhook action - Expected HTTP status code: If this status code is returned, continue running the action plan. Default: 204 No Content
Email action - To, CC: Enter email addresses as a comma separated list
- Put the actions in run order using the arrow buttons
To run the action plan automatically, go to the Triggers tab and create an alert or schedule trigger.
When you create actions on VMs also consider the following constraints.
- User constraints: e.g. allocation limits
- Platform constraints: e.g. to create an instance, the VM must be deployed and powered off
- Hypervisor constraints: e.g. when using hot reconfigure on ESXi, you cannot decrement CPU or RAM
For the API, note that you can request the JSON schema for each action plan entry type from the API.
See: https://wiki.abiquo.com/api/latest/ActionPlansResource.html#list-action-plan-entry-templates
Run an action plan now
To run an action plan immediately to test it, do these steps:
- Go to Control → Action plans
- Select the action plan
- On the Actions panel, click the Run action plan button
Abiquo recommends that you run an action plan manually to test it before you create a trigger to run it automatically
Create a trigger for an action plan
The platform supports two types of triggers to run action plans: Alerts and Schedules.
To run your action plan based on metrics, select an existing alert with these steps:
- Go to Control → Action plans
- Select an action plan
- Below the Alerts panel, click the + add button
- Select an alert. For details about creating an alert, see Manage Alerts
To run your action plan automatically at selected dates and times, create a schedule trigger with these steps:
- Go to Control → Action plans
- Select an action plan
- Below the Schedules panel, click the + add button
- Enter the details of the schedule using the calendar or time and repeat interval.
For more details see GUI Edit action plan Schedules
Delete an action plan
If you delete an action plan, Abiquo will also delete the schedule associated with that action plan.
Copyright © 2006-2022, Abiquo Holdings SL. All rights reserved