Introduction
This page describes how to enable VM monitoring and metrics via API and select a set of metrics to fetch.
You will need the following resources.
A VM that is not deployed (or powered off)
This how-to uses an example VM that is not deployed
A monitoring server
Your user role must include the following privileges.
Manage virtual machine metrics → ROLE_USERS_ENABLE_DISABLE_VM_METRICS
Edit virtual appliance details → ROLE_VAPP_CUSTOMISE_SETTINGS
Manage virtual machine backup configuration (VAPP_MANAGE_BACKUP). This is because backups previously used metadata
Your user must be in the enterprise that owns the virtual datacenter and virtual resources.
The following pages describe Metrics configuration and UI functionality.
For administrators: Configure VM monitoring and metrics
For users:
Summary diagram
The steps in this diagram link to the API reference guide resources and data entities sections.
Detailed steps
Get VMs from the cloud
Filter the VMs using the vmlabel query parameter, for example, to get a VM with a label value of "yVM1"
Reference: https://wiki.abiquo.com/api/latest/AllVirtualMachinesResource.html#list-virtual-machines-of-the-user
cURL
GET all virtual machines in the cloud, filtering by label
curl -X GET https://abiquo.example.com:443/api/cloud/virtualmachines?vmlabel=yVM1 \ -H "Accept: application/vnd.abiquo.virtualmachines+json; version=5.1" \ -u user:password --verbose | pjson
Sample response. Success status code: 200
Note: This request returns a collection of VMs{ "totalSize": 1, "links": [ { "rel": "first", "href": "https://abiquo.example.com:443/api/cloud/virtualmachines?vmlabel=yVM1&limit=25&by=name&asc=true" }, { "rel": "last", "href": "https://abiquo.example.com:443/api/cloud/virtualmachines?vmlabel=yVM1&startwith=0&limit=25&by=name&asc=true" } ], "collection": [ { "id": 634, "uuid": "cc3f0803-1f42-4baa-9e66-d6a3af406d48", "description": "A virtual machine", "coresPerSocket": 1, "idState": 1, "idType": 0, "type": "MANAGED", "highDisponibility": 0, "monitored": false, "protected": false, "variables": {}, "backuppolicies": [], "generateGuestInitialPassword": false, "natrules": [], "vdrpEnabled": true, "vdrpPort": 0, "password": "ZtnIXKdA", "deallocated": false, "name": "ABQ_cc3f0803-1f42-4baa-9e66-d6a3af406d48", "label": "yVM1", "ram": 48, "cpu": 1, "state": "NOT_ALLOCATED", "creationTimestamp": 1608740019000, "links": [ { "title": "Abiquo", "rel": "enterprise", "type": "application/vnd.abiquo.enterprise+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/1" }, { "title": "ABQ_cc3f0803-1f42-4baa-9e66-d6a3af406d48", "rel": "edit", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634" }, { "rel": "asynctasks", "type": "application/vnd.abiquo.asynctasks+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/asynctasks" }, { "title": "send mail", "rel": "sendmail", "type": "application/vnd.abiquo.mail+json", "href": "https://abiquo.example.com:443/api/admin/publiccloudregions/4/enterprises/1/virtualmachines/634/action/sendmail" }, { "title": "cloudadmin cloudadmin", "rel": "user", "type": "application/vnd.abiquo.user+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/1/users/7" }, { "title": "vdc_vcenter", "rel": "virtualdatacenter", "type": "application/vnd.abiquo.virtualdatacenter+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35" }, { "title": "vpp_vcenter", "rel": "virtualappliance", "type": "application/vnd.abiquo.virtualappliance+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29" }, { "title": "metadata", "rel": "metadata", "type": "application/vnd.abiquo.metadata+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metadata" }, { "title": "vlan network configurations", "rel": "configurations", "type": "application/vnd.abiquo.virtualmachinenetworkconfigurations+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/network/configurations" }, { "title": "nics", "rel": "nics", "type": "application/vnd.abiquo.nics+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/network/nics" }, { "title": "disks", "rel": "harddisks", "type": "application/vnd.abiquo.harddisks+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/storage/disks" }, { "title": "NOT_ALLOCATED", "rel": "state", "type": "application/vnd.abiquo.virtualmachinestate+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/state" }, { "title": "virtual machine undeploy", "rel": "undeploy", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/action/undeploy" }, { "title": "virtual machine deploy", "rel": "deploy", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/action/deploy" }, { "title": "virtual machine reset", "rel": "reset", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/action/reset" }, { "title": "virtual machine snapshot", "rel": "instance", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/action/instance" }, { "title": "remote access", "rel": "rdpaccess", "type": "application/vnd.abiquo.virtualmachineconsole+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/config/rdpaccess" }, { "title": "tasks", "rel": "tasks", "type": "application/vnd.abiquo.tasks+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/tasks" }, { "title": "firewalls", "rel": "firewalls", "type": "application/vnd.abiquo.links+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/firewalls" }, { "title": "load balancers", "rel": "loadbalancers", "type": "application/vnd.abiquo.loadbalancers+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/loadbalancers" }, { "title": "request on demand backup", "rel": "requestbackup", "type": "application/vnd.abiquo.ondemandbackup+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/backup/action/request" }, { "title": "request a restore of a backup", "rel": "requestrestore", "type": "application/vnd.abiquo.restore+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/backup/action/restore" }, { "title": "move VM to a virtual appliance", "rel": "vappmove", "type": "application/vnd.abiquo.links+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/action/vappmove" }, { "title": "move VM to another virtual datacenter", "rel": "move", "type": "application/vnd.abiquo.movevm+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/action/move" }, { "title": "volumes", "rel": "volumes", "type": "application/vnd.abiquo.volumes+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/storage/volumes" }, { "diskControllerType": "IDE", "diskLabel": "Hard disk 1", "length": "64", "title": "e706ed17-b6e9-4c71-8291-1e9527c44a49", "rel": "disk0", "type": "application/vnd.abiquo.harddisk+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/disks/148" }, { "title": "dstiersharedds2", "rel": "datastoretier0", "type": "application/vnd.abiquo.datastoretier+json", "href": "https://abiquo.example.com:443/api/cloud/locations/4/datastoretiers/4" }, { "title": "protect", "rel": "protect", "type": "text/plain", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/action/protect" }, { "title": "unprotect", "rel": "unprotect", "type": "text/plain", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/action/unprotect" }, { "title": "metricsmetadata", "rel": "metricsmetadata", "type": "application/vnd.abiquo.metricsmetadata+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics" }, { "title": "enablemonitoring", "rel": "enablemonitoring", "type": "", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/enablemonitoring" }, { "title": "collectd", "rel": "collectd", "type": "application/json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/collectd" }, { "title": "alarmssearch", "rel": "alarmssearch", "type": "application/vnd.abiquo.alarms+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/alarms" }, { "title": "clone", "rel": "clone", "type": "application/vnd.abiquo.virtualmachinecloneoptions+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/action/clone" }, { "rel": "tags", "type": "application/vnd.abiquo.resourcetags+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/tags" }, { "rel": "tags-update", "type": "application/vnd.abiquo.tags+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/tags" }, { "rel": "tags-format", "type": "application/vnd.abiquo.tagformatrestrictions+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/tags" }, { "rel": "tags-create", "type": "application/vnd.abiquo.tags+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/tags/action/create" }, { "rel": "tags-delete", "type": "application/vnd.abiquo.tagkeys+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/tags/action/delete" }, { "rel": "tags-edit", "type": "application/vnd.abiquo.tags+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/tags/action/edit" }, { "rel": "tags-sync", "type": "", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/tags/action/sync" }, { "title": "VMware vCenter", "rel": "hypervisortype", "type": "application/vnd.abiquo.hypervisortype+json", "href": "https://abiquo.example.com:443/api/config/hypervisortypes/VMX_04" }, { "title": "yVM", "rel": "virtualmachinetemplate", "type": "application/vnd.abiquo.virtualmachinetemplate+json", "href": "https://abiquo.example.com:443/api/admin/enterprises/1/datacenterrepositories/4/virtualmachinetemplates/151" }, { "title": "Others", "rel": "category", "type": "application/vnd.abiquo.category+json", "href": "https://abiquo.example.com:443/api/config/categories/1" } ], "usageStatistics": [] } ], "duplicatedvms": [] }
Note that the "monitored" attribute has a value of false, which means do not fetch VM metrics
Keep the VM entity to update it. You will also need the metricsmetadata, metadata, and enablemonitoring links
Metricsmetadata link. From here you can obtain the metrics that are available for the VM
{ "title": "metricsmetadata", "rel": "metricsmetadata", "type": "application/vnd.abiquo.metricsmetadata+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics" },
Metadata link. You can use this link to define the metrics to retrieve
{ "title": "metadata", "rel": "metadata", "type": "application/vnd.abiquo.metadata+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metadata" },
Enable monitoring link
{ "title": "enablemonitoring", "rel": "enablemonitoring", "type": "", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/enablemonitoring" },
Obtain the metrics available for the VM
cURL
curl -X GET "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics" \ -H "Accept: application/vnd.abiquo.metricsmetadata+json;version=5.1"\ -u user:password --verbose
Sample response. Success status code: 200
{ "links": [ { "title": "ABQ_cc3f0803-1f42-4baa-9e66-d6a3af406d48", "rel": "virtualmachine", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634" }, { "title": "metricsmetadata", "rel": "self", "type": "application/vnd.abiquo.metricsmetadata+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics" } ], "collection": [ { "name": "Uptime", "description": "Total time elapsed, in seconds, since last system startup", "unit": "Second absolute", "namespace": "virtualmachine", "dimensions": {}, "links": [ { "title": "Uptime", "rel": "self", "type": "application/vnd.abiquo.metricmetadata+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Uptime" }, { "title": "ABQ_cc3f0803-1f42-4baa-9e66-d6a3af406d48", "rel": "virtualmachine", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634" }, { "title": "Uptime", "rel": "metric", "type": "application/vnd.abiquo.metric+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Uptime" }, { "title": "alarms", "rel": "alarms", "type": "application/vnd.abiquo.alarms+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Uptime/alarms" } ] }, { "name": "Memory-physical", "description": "Amount of host physical memory consumed by a virtual machine, host, or cluster", "unit": "Kilobytes absolute", "namespace": "virtualmachine", "dimensions": {}, "links": [ { "title": "ABQ_cc3f0803-1f42-4baa-9e66-d6a3af406d48", "rel": "virtualmachine", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634" }, { "title": "Memory-physical", "rel": "self", "type": "application/vnd.abiquo.metricmetadata+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Memory-physical" }, { "title": "Memory-physical", "rel": "metric", "type": "application/vnd.abiquo.metric+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Memory-physical" }, { "title": "alarms", "rel": "alarms", "type": "application/vnd.abiquo.alarms+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Memory-physical/alarms" } ] }, { "name": "Memory", "description": "Memory usage as percentage (Hundredth of a percent (1 = 0.01%). A value between 0 and 10000) of total configured or available memory", "unit": "Hundredth of a percent", "namespace": "virtualmachine", "dimensions": {}, "links": [ { "title": "Memory", "rel": "self", "type": "application/vnd.abiquo.metricmetadata+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Memory" }, { "title": "ABQ_cc3f0803-1f42-4baa-9e66-d6a3af406d48", "rel": "virtualmachine", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634" }, { "title": "Memory", "rel": "metric", "type": "application/vnd.abiquo.metric+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Memory" }, { "title": "alarms", "rel": "alarms", "type": "application/vnd.abiquo.alarms+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Memory/alarms" } ] }, { "name": "CPU", "description": "CPU usage as a percentage (Hundredth of a percent (1 = 0.01%). A value between 0 and 10000) during the interval", "unit": "Hundredth of a percent", "namespace": "virtualmachine", "dimensions": {}, "links": [ { "title": "CPU", "rel": "self", "type": "application/vnd.abiquo.metricmetadata+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/CPU" }, { "title": "alarms", "rel": "alarms", "type": "application/vnd.abiquo.alarms+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/CPU/alarms" }, { "title": "CPU", "rel": "metric", "type": "application/vnd.abiquo.metric+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/CPU" }, { "title": "ABQ_cc3f0803-1f42-4baa-9e66-d6a3af406d48", "rel": "virtualmachine", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634" } ] }, { "name": "CPU-Mz", "description": "CPU usage during the interval", "unit": "Megahertz rate", "namespace": "virtualmachine", "dimensions": {}, "links": [ { "title": "ABQ_cc3f0803-1f42-4baa-9e66-d6a3af406d48", "rel": "virtualmachine", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634" }, { "title": "alarms", "rel": "alarms", "type": "application/vnd.abiquo.alarms+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/CPU-Mz/alarms" }, { "title": "CPU-Mz", "rel": "self", "type": "application/vnd.abiquo.metricmetadata+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/CPU-Mz" }, { "title": "CPU-Mz", "rel": "metric", "type": "application/vnd.abiquo.metric+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/CPU-Mz" } ] }, { "name": "abq-cpu_usage", "description": "CPU usage as a percentage", "unit": "PERCENT", "namespace": "virtualmachine", "dimensions": {}, "links": [ { "title": "abq-cpu_usage", "rel": "metric", "type": "application/vnd.abiquo.metric+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/abq-cpu_usage" }, { "title": "alarms", "rel": "alarms", "type": "application/vnd.abiquo.alarms+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/abq-cpu_usage/alarms" }, { "title": "abq-cpu_usage", "rel": "self", "type": "application/vnd.abiquo.metricmetadata+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/abq-cpu_usage" }, { "title": "ABQ_cc3f0803-1f42-4baa-9e66-d6a3af406d48", "rel": "virtualmachine", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634" } ] }, { "name": "Memory-swap2", "description": "Rate at which memory is being swapped from active memory to disk during the current interval", "unit": "Kilobytes per second rate", "namespace": "virtualmachine", "dimensions": {}, "links": [ { "title": "Memory-swap2", "rel": "metric", "type": "application/vnd.abiquo.metric+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Memory-swap2" }, { "title": "Memory-swap2", "rel": "self", "type": "application/vnd.abiquo.metricmetadata+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Memory-swap2" }, { "title": "ABQ_cc3f0803-1f42-4baa-9e66-d6a3af406d48", "rel": "virtualmachine", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634" }, { "title": "alarms", "rel": "alarms", "type": "application/vnd.abiquo.alarms+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Memory-swap2/alarms" } ] }, { "name": "Memory-swap", "description": "Rate at which memory is swapped from disk into active memory during the interval", "unit": "Kilobytes per second rate", "namespace": "virtualmachine", "dimensions": {}, "links": [ { "title": "ABQ_cc3f0803-1f42-4baa-9e66-d6a3af406d48", "rel": "virtualmachine", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634" }, { "title": "Memory-swap", "rel": "metric", "type": "application/vnd.abiquo.metric+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Memory-swap" }, { "title": "alarms", "rel": "alarms", "type": "application/vnd.abiquo.alarms+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Memory-swap/alarms" }, { "title": "Memory-swap", "rel": "self", "type": "application/vnd.abiquo.metricmetadata+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Memory-swap" } ] }, { "name": "Disk-latency", "description": "Highest latency value across all disks used by the host", "unit": "Millisecond absolute", "namespace": "virtualmachine", "dimensions": {}, "links": [ { "title": "ABQ_cc3f0803-1f42-4baa-9e66-d6a3af406d48", "rel": "virtualmachine", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634" }, { "title": "alarms", "rel": "alarms", "type": "application/vnd.abiquo.alarms+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Disk-latency/alarms" }, { "title": "Disk-latency", "rel": "self", "type": "application/vnd.abiquo.metricmetadata+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Disk-latency" }, { "title": "Disk-latency", "rel": "metric", "type": "application/vnd.abiquo.metric+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Disk-latency" } ] }, { "name": "Memory-vmmemctl", "description": "Amount of memory allocated by the virtual machine memory control driver (vmmemctl), which is installed with VMware Tools", "unit": "Kilobytes absolute", "namespace": "virtualmachine", "dimensions": {}, "links": [ { "title": "Memory-vmmemctl", "rel": "metric", "type": "application/vnd.abiquo.metric+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Memory-vmmemctl" }, { "title": "ABQ_cc3f0803-1f42-4baa-9e66-d6a3af406d48", "rel": "virtualmachine", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634" }, { "title": "alarms", "rel": "alarms", "type": "application/vnd.abiquo.alarms+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Memory-vmmemctl/alarms" }, { "title": "Memory-vmmemctl", "rel": "self", "type": "application/vnd.abiquo.metricmetadata+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Memory-vmmemctl" } ] }, { "name": "abq-ram_usage", "description": "RAM usage as a percentage", "unit": "PERCENT", "namespace": "virtualmachine", "dimensions": {}, "links": [ { "title": "alarms", "rel": "alarms", "type": "application/vnd.abiquo.alarms+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/abq-ram_usage/alarms" }, { "title": "abq-ram_usage", "rel": "metric", "type": "application/vnd.abiquo.metric+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/abq-ram_usage" }, { "title": "ABQ_cc3f0803-1f42-4baa-9e66-d6a3af406d48", "rel": "virtualmachine", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634" }, { "title": "abq-ram_usage", "rel": "self", "type": "application/vnd.abiquo.metricmetadata+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/abq-ram_usage" } ] }, { "name": "CPU-time", "description": "Percentage of time that the virtual machine was ready, but could not get scheduled to run on the physical CPU", "unit": "Millisecond delta", "namespace": "virtualmachine", "dimensions": {}, "links": [ { "title": "CPU-time", "rel": "metric", "type": "application/vnd.abiquo.metric+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/CPU-time" }, { "title": "CPU-time", "rel": "self", "type": "application/vnd.abiquo.metricmetadata+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/CPU-time" }, { "title": "ABQ_cc3f0803-1f42-4baa-9e66-d6a3af406d48", "rel": "virtualmachine", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634" }, { "title": "alarms", "rel": "alarms", "type": "application/vnd.abiquo.alarms+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/CPU-time/alarms" } ] }, { "name": "Memory-host", "description": "Host physical memory (KB) consumed by the virtualization infrastructure for running the virtual machine", "unit": "Kilobytes absolute", "namespace": "virtualmachine", "dimensions": {}, "links": [ { "title": "alarms", "rel": "alarms", "type": "application/vnd.abiquo.alarms+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Memory-host/alarms" }, { "title": "Memory-host", "rel": "self", "type": "application/vnd.abiquo.metricmetadata+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Memory-host" }, { "title": "ABQ_cc3f0803-1f42-4baa-9e66-d6a3af406d48", "rel": "virtualmachine", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634" }, { "title": "Memory-host", "rel": "metric", "type": "application/vnd.abiquo.metric+json", "href": "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metrics/Memory-host" } ] } ] }
To define the metrics to enable, keep the metric names.
{ "name": "abq-cpu_usage" } { "name": "abq-ram_usage" }
Get existing VM metadata
When you write to metadata, you will overwrite all existing metadata. So always start with a GET request to retrieve the existing metadata to use as the base object for adding metadata.
Reference: https://wiki.abiquo.com/api/latest/VirtualMachinesResource.html#get-virtual-machine-metadata
cURL
curl -X GET "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metadata" \ -H 'Accept: application/vnd.abiquo.virtualdatacenter+json;version=5.1' \ -u user:password --verbose
Sample response. Success status code: 200. Note that the platform stores the VM startup script in metadata.
{ "links": [] }
Prepare a metadata object for monitoring and metrics
Use the "monitoring-metrics" keyword and add the metrics to enable
{ "links": [], "metadata": { "monitoring-metrics": [ { "name": "abq-cpu_usage" }, { "name": "abq-ram_usage" } ] } }
Update the VM metadata
Reference: https://wiki.abiquo.com/api/latest/VirtualMachinesResource.html#update-virtual-machine-metadata
cURL
curl --verbose -X PUT -u user:password \ "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/metadata" -H "Accept : application/vnd.abiquo.metadata+json; version=5.1" \ -H "Content-Type : application/vnd.abiquo.metadata+json; version=5.1" \ -d @virtualMachineMD.json
Request data for this request will be in the file named "virtualMachineMD.json".
Sample response. Success status code: 200
{ "metadata": { "monitoring-metrics": [ { "name": "abq-cpu_usage" }, { "name": "abq-ram_usage" } ] }, "links": [] }
Enable monitoring and fetch metrics
cURL
curl -X POST "https://abiquo.example.com:443/api/cloud/virtualdatacenters/35/virtualappliances/29/virtualmachines/634/enablemonitoring" \ -H 'Accept:text/json,application/json' \ -u user:password --verbose
Success status code: 204 - No content
Now when you access the VM in the UI, you should see the metrics symbol on the VM icon.
And when you edit the VM on the Monitoring tab, the above metrics should be selected.
And if you deploy the VM and wait a little while, the platform should display the requested metrics!