Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

VM monitoring and metrics via API tutorial

This tutorial will show you the basics of working with VM monitoring and metrics via API.

To work through this tutorial, you will need:

  • A VM that is not deployed (or powered off)
    • This tutorial uses an example VM that is not deployed
  • A monitoring server and a user with the privileges to Manage virtual machine metrics (USERS_ENABLE_DISABLE_VM_METRICS)
  • ??? User with privileges to work with VMs and Manage virtual machine backup configuration (VAPP_MANAGE_BACKUP) because backups previously used metadata

Get the VM and the link to enable monitoring

To get started, use a query to retrieve all of your VMs from the cloud and select the desired VM. Here we are filtering the VMs using the "has" parameter to select one using part of the name, which is an easy way to find a VM that you have located in the UI.

GET all virtual machines in the cloud, filtering by name
curl -X GET https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualmachines?has=ABQ_4fd49a02 \
	-H "Accept: application/vnd.abiquo.virtualmachines+json; version=4.2" \ 
	-u user:password --verbose | pjson


 Click here to show or hide the API response example

Success status code: 200

Response:

{
    "links": [
        {
            "rel": "first",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualmachines?limit=25&has=ABQ_4fd49a02&by=name&asc=true"
        },
        {
            "rel": "last",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualmachines?startwith=0&limit=25&has=ABQ_4fd49a02&by=name&asc=true"
        }
    ],
    "collection": [
        {
            "id": 12,
            "uuid": "4fd49a02-033a-4e0a-b27b-a295f6f858a4",
            "name": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
            "label": "yVM (9)",
            "description": "A virtual machine",
            "cpu": 1,
            "ram": 48,
            "vdrpEnabled": false,
            "vdrpPort": 0,
            "idState": 1,
            "state": "NOT_ALLOCATED",
            "idType": 0,
            "type": "MANAGED",
            "highDisponibility": 0,
            "password": "h0gfuBUu",
            "metadata": null,
            "monitored": false,
            "protected": false,
            "variables": {},
            "creationTimestamp": 1520595596000,
            "backuppolicies": [],
            "generateGuestInitialPassword": false,
            "natrules": [],
            "links": [
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "edit",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                },
                {
                    "title": "Abiquo",
                    "rel": "enterprise",
                    "type": "application/vnd.abiquo.enterprise+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/1"
                },
                {
                    "title": "Cloud Administrator",
                    "rel": "user",
                    "type": "application/vnd.abiquo.user+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/1/users/1"
                },
                {
                    "title": "MJ_backup",
                    "rel": "virtualdatacenter",
                    "type": "application/vnd.abiquo.virtualdatacenter+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2"
                },
                {
                    "title": "vapp_mj_backup",
                    "rel": "virtualappliance",
                    "type": "application/vnd.abiquo.virtualappliance+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3"
                },
                {
                    "title": "metadata",
                    "rel": "metadata",
                    "type": "application/vnd.abiquo.metadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metadata"
                },
                {
                    "title": "vlan network configurations",
                    "rel": "configurations",
                    "type": "application/vnd.abiquo.virtualmachinenetworkconfigurations+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/network/configurations"
                },
                {
                    "title": "nics",
                    "rel": "nics",
                    "type": "application/vnd.abiquo.nics+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/network/nics"
                },
                {
                    "title": "disks",
                    "rel": "harddisks",
                    "type": "application/vnd.abiquo.harddisks+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/storage/disks"
                },
                {
                    "title": "NOT_ALLOCATED",
                    "rel": "state",
                    "type": "application/vnd.abiquo.virtualmachinestate+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/state"
                },
                {
                    "title": "virtual machine undeploy",
                    "rel": "undeploy",
                    "type": "application/vnd.abiquo.acceptedrequest+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/action/undeploy"
                },
                {
                    "title": "virtual machine deploy",
                    "rel": "deploy",
                    "type": "application/vnd.abiquo.acceptedrequest+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/action/deploy"
                },
                {
                    "title": "virtual machine reset",
                    "rel": "reset",
                    "type": "application/vnd.abiquo.acceptedrequest+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/action/reset"
                },
                {
                    "title": "virtual machine snapshot",
                    "rel": "instance",
                    "type": "application/vnd.abiquo.acceptedrequest+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/action/instance"
                },
                {
                    "title": "remote access",
                    "rel": "rdpaccess",
                    "type": "application/vnd.abiquo.virtualmachineconsole+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/config/rdpaccess"
                },
                {
                    "title": "tasks",
                    "rel": "tasks",
                    "type": "application/vnd.abiquo.tasks+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/tasks"
                },
                {
                    "title": "firewalls",
                    "rel": "firewalls",
                    "type": "application/vnd.abiquo.links+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/firewalls"
                },
                {
                    "title": "load balancers",
                    "rel": "loadbalancers",
                    "type": "application/vnd.abiquo.loadbalancers+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/loadbalancers"
                },
                {
                    "title": "request on demand backup",
                    "rel": "requestbackup",
                    "type": "application/vnd.abiquo.ondemandbackup+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/backup/action/request"
                },
                {
                    "title": "request a restore of a backup",
                    "rel": "requestrestore",
                    "type": "application/vnd.abiquo.restore+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/backup/action/restore"
                },
                {
                    "title": "volumes",
                    "rel": "volumes",
                    "type": "application/vnd.abiquo.volumes+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/storage/volumes"
                },
                {
                    "diskControllerType": "IDE",
                    "diskLabel": "Hard disk 1",
                    "length": "64",
                    "title": "8629d108-9b47-4014-8256-eebf5ff25ec0",
                    "rel": "disk0",
                    "type": "application/vnd.abiquo.harddisk+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/disks/18"
                },
                {
                    "title": "protect",
                    "rel": "protect",
                    "type": "text/plain",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/action/protect"
                },
                {
                    "title": "unprotect",
                    "rel": "unprotect",
                    "type": "text/plain",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/action/unprotect"
                },
                {
                    "title": "metricsmetadata",
                    "rel": "metricsmetadata",
                    "type": "application/vnd.abiquo.metricsmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics"
                },
                {
                    "title": "enablemonitoring",
                    "rel": "enablemonitoring",
                    "type": "",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/enablemonitoring"
                },
                {
                    "title": "collectd",
                    "rel": "collectd",
                    "type": "application/json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/collectd"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/alarms"
                },
                {
                    "title": "actionplans",
                    "rel": "actionplans",
                    "type": "application/vnd.abiquo.virtualmachineactionplans+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/actionplans"
                },
                {
                    "title": "actionplansflat",
                    "rel": "actionplansflat",
                    "type": "application/vnd.abiquo.virtualmachineactionplansflat+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/actionplans"
                },
                {
                    "title": "clone",
                    "rel": "clone",
                    "type": "application/vnd.abiquo.virtualmachinecloneoptions+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/action/clone"
                },
                {
                    "title": "KVM",
                    "rel": "hypervisortype",
                    "type": "application/vnd.abiquo.hypervisortype+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/config/hypervisortypes/KVM"
                },
                {
                    "title": "yVM",
                    "rel": "virtualmachinetemplate",
                    "type": "application/vnd.abiquo.virtualmachinetemplate+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/3"
                },
                {
                    "title": "Others",
                    "rel": "category",
                    "type": "application/vnd.abiquo.category+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/config/categories/1"
                }
            ]
        }
    ],
    "totalSize": 1,
    "duplicatedvms": []
}

From the VM data object, we will now focus on the monitoring and metrics attributes and links.

First note that the "monitored" attribute has a value of "false", which means that the platform will not fetch metrics for the VM. Also note that the VM metadata does not have a "monitoring-metrics" object. 

	"metadata": null,
	"monitored": false

Also from the VM data object, note the link to access metrics, which is as follows.

                {
                    "title": "metricsmetadata",
                    "rel": "metricsmetadata",
                    "type": "application/vnd.abiquo.metricsmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics"
                },

Later on, we will also need the VM metadata link to store the names of the specific metrics to retrieve.

                {
                    "title": "metadata",
                    "rel": "metadata",
                    "type": "application/vnd.abiquo.metadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metadata"
                },

The link to enable monitoring and metrics fetch is the one with the "rel" value of "enablemonitoring".

                {
                    "title": "enablemonitoring",
                    "rel": "enablemonitoring",
                    "type": "",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/enablemonitoring"
                },

Obtain the metrics available for the VM

First  to obtain all the information about the metrics available for the VM, perform a GET request to metricsmetadata link.

GET VM metrics metadata
curl -X GET https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics \
	-H "Accept: application/vnd.abiquo.metricsmetadata+json; version=4.2" \ 
	-u user:password --verbose | pjson

The request returns a lot of information including links that you can use to access the data for retrieved metrics when the VM is deployed.

 Click here to expand...
{
    "links": [
        {
            "title": "metricsmetadata",
            "rel": "self",
            "type": "application/vnd.abiquo.metricsmetadata+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics"
        },
        {
            "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
            "rel": "virtualmachine",
            "type": "application/vnd.abiquo.virtualmachine+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
        }
    ],
    "collection": [
        {
            "links": [
                {
                    "title": "disk_rd_requests_total",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_rd_requests_total"
                },
                {
                    "title": "disk_rd_requests_total",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_rd_requests_total"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_rd_requests_total/alarms"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                }
            ],
            "name": "disk_rd_requests_total",
            "description": "total read requests of the block devices",
            "unit": "",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "cpu_usage",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/cpu_usage"
                },
                {
                    "title": "cpu_usage",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/cpu_usage"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/cpu_usage/alarms"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                }
            ],
            "name": "cpu_usage",
            "description": "cpu usage charged to user instructions",
            "unit": "percentage",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                },
                {
                    "title": "vcpu_number",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/vcpu_number"
                },
                {
                    "title": "vcpu_number",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/vcpu_number"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/vcpu_number/alarms"
                }
            ],
            "name": "vcpu_number",
            "description": "number of vcpus",
            "unit": "",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/cpu_time/alarms"
                },
                {
                    "title": "cpu_time",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/cpu_time"
                },
                {
                    "title": "cpu_time",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/cpu_time"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                }
            ],
            "name": "cpu_time",
            "description": "cpu time charged to user instructions",
            "unit": "nanoseconds",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_wr_requests_total/alarms"
                },
                {
                    "title": "disk_wr_requests_total",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_wr_requests_total"
                },
                {
                    "title": "disk_wr_requests_total",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_wr_requests_total"
                }
            ],
            "name": "disk_wr_requests_total",
            "description": "total write requests of the block devices",
            "unit": "",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "vcpu_time",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/vcpu_time"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/vcpu_time/alarms"
                },
                {
                    "title": "vcpu_time",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/vcpu_time"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                }
            ],
            "name": "vcpu_time",
            "description": "vcpu time (cpu_time excluding hypervisor time)",
            "unit": "nanoseconds",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_bytes_total/alarms"
                },
                {
                    "title": "if_rx_bytes_total",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_bytes_total"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                },
                {
                    "title": "if_rx_bytes_total",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_bytes_total"
                }
            ],
            "name": "if_rx_bytes_total",
            "description": "total number of received bytes of the network interfaces",
            "unit": "bytes",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "if_rx_drops_total",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_drops_total"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                },
                {
                    "title": "if_rx_drops_total",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_drops_total"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_drops_total/alarms"
                }
            ],
            "name": "if_rx_drops_total",
            "description": "total drops on receive of the network interfaces",
            "unit": "",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                },
                {
                    "title": "vcpu_usage",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/vcpu_usage"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/vcpu_usage/alarms"
                },
                {
                    "title": "vcpu_usage",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/vcpu_usage"
                }
            ],
            "name": "vcpu_usage",
            "description": "vcpu usage (cpu_time excluding hypervisor time)",
            "unit": "percentage",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "if_tx_packets",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_packets"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_packets/alarms"
                },
                {
                    "title": "if_tx_packets",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_packets"
                }
            ],
            "name": "if_tx_packets",
            "description": "transmitted packets of the network interfaces",
            "unit": "",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_packets_total/alarms"
                },
                {
                    "title": "if_tx_packets_total",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_packets_total"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                },
                {
                    "title": "if_tx_packets_total",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_packets_total"
                }
            ],
            "name": "if_tx_packets_total",
            "description": "total transmitted packets of the network interfaces",
            "unit": "",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                },
                {
                    "title": "disk_wr_bytes_total",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_wr_bytes_total"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_wr_bytes_total/alarms"
                },
                {
                    "title": "disk_wr_bytes_total",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_wr_bytes_total"
                }
            ],
            "name": "disk_wr_bytes_total",
            "description": "total number of write bytes of the block devices",
            "unit": "bytes",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "disk_wr_requests",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_wr_requests"
                },
                {
                    "title": "disk_wr_requests",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_wr_requests"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_wr_requests/alarms"
                }
            ],
            "name": "disk_wr_requests",
            "description": "write requests of the block devices",
            "unit": "",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "disk_rd_requests",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_rd_requests"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_rd_requests/alarms"
                },
                {
                    "title": "disk_rd_requests",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_rd_requests"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                }
            ],
            "name": "disk_rd_requests",
            "description": "read requests of the block devices",
            "unit": "",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "if_rx_packets",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_packets"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_packets/alarms"
                },
                {
                    "title": "if_rx_packets",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_packets"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                }
            ],
            "name": "if_rx_packets",
            "description": "received packets of the network interfaces",
            "unit": "",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_bytes/alarms"
                },
                {
                    "title": "if_tx_bytes",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_bytes"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                },
                {
                    "title": "if_tx_bytes",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_bytes"
                }
            ],
            "name": "if_tx_bytes",
            "description": "number of transmitted bytes of the network interfaces",
            "unit": "bytes",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_drops/alarms"
                },
                {
                    "title": "if_tx_drops",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_drops"
                },
                {
                    "title": "if_tx_drops",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_drops"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                }
            ],
            "name": "if_tx_drops",
            "description": "drops on transmit of the network interfaces",
            "unit": "",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "used_mem",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/used_mem"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/used_mem/alarms"
                },
                {
                    "title": "used_mem",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/used_mem"
                }
            ],
            "name": "used_mem",
            "description": "the memory used by the domain",
            "unit": "KBytes",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_errors_total/alarms"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                },
                {
                    "title": "if_rx_errors_total",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_errors_total"
                },
                {
                    "title": "if_rx_errors_total",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_errors_total"
                }
            ],
            "name": "if_rx_errors_total",
            "description": "total errors on receive of the network interfaces",
            "unit": "",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "if_tx_bytes_total",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_bytes_total"
                },
                {
                    "title": "if_tx_bytes_total",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_bytes_total"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_bytes_total/alarms"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                }
            ],
            "name": "if_tx_bytes_total",
            "description": "total number of transmitted bytes of the network interfaces",
            "unit": "bytes",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "if_tx_errors_total",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_errors_total"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_errors_total/alarms"
                },
                {
                    "title": "if_tx_errors_total",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_errors_total"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                }
            ],
            "name": "if_tx_errors_total",
            "description": "total errors on transmit of the network interfaces",
            "unit": "",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_drops/alarms"
                },
                {
                    "title": "if_rx_drops",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_drops"
                },
                {
                    "title": "if_rx_drops",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_drops"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                }
            ],
            "name": "if_rx_drops",
            "description": "drops on receive of the network interfaces",
            "unit": "",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "if_rx_errors",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_errors"
                },
                {
                    "title": "if_rx_errors",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_errors"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_errors/alarms"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                }
            ],
            "name": "if_rx_errors",
            "description": "errors on receive of the network interfaces",
            "unit": "",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_wr_bytes/alarms"
                },
                {
                    "title": "disk_wr_bytes",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_wr_bytes"
                },
                {
                    "title": "disk_wr_bytes",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_wr_bytes"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                }
            ],
            "name": "disk_wr_bytes",
            "description": "number of write bytes of the block devices",
            "unit": "bytes",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "if_tx_drops_total",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_drops_total"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                },
                {
                    "title": "if_tx_drops_total",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_drops_total"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_drops_total/alarms"
                }
            ],
            "name": "if_tx_drops_total",
            "description": "total drops on transmit of the network interfaces",
            "unit": "",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_rd_bytes_total/alarms"
                },
                {
                    "title": "disk_rd_bytes_total",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_rd_bytes_total"
                },
                {
                    "title": "disk_rd_bytes_total",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_rd_bytes_total"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                }
            ],
            "name": "disk_rd_bytes_total",
            "description": "total number of read bytes of the block devices",
            "unit": "bytes",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_rd_bytes/alarms"
                },
                {
                    "title": "disk_rd_bytes",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_rd_bytes"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                },
                {
                    "title": "disk_rd_bytes",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/disk_rd_bytes"
                }
            ],
            "name": "disk_rd_bytes",
            "description": "number of read bytes of the block devices",
            "unit": "bytes",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "if_rx_packets_total",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_packets_total"
                },
                {
                    "title": "if_rx_packets_total",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_packets_total"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_packets_total/alarms"
                }
            ],
            "name": "if_rx_packets_total",
            "description": "total received packets of the network interfaces",
            "unit": "",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "if_tx_errors",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_errors"
                },
                {
                    "title": "if_tx_errors",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_errors"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_tx_errors/alarms"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                }
            ],
            "name": "if_tx_errors",
            "description": "errors on transmit of the network interfaces",
            "unit": "",
            "namespace": "virtualmachine",
            "dimensions": {}
        },
        {
            "links": [
                {
                    "title": "if_rx_bytes",
                    "rel": "metric",
                    "type": "application/vnd.abiquo.metric+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_bytes"
                },
                {
                    "title": "ABQ_4fd49a02-033a-4e0a-b27b-a295f6f858a4",
                    "rel": "virtualmachine",
                    "type": "application/vnd.abiquo.virtualmachine+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12"
                },
                {
                    "title": "alarms",
                    "rel": "alarms",
                    "type": "application/vnd.abiquo.alarms+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_bytes/alarms"
                },
                {
                    "title": "if_rx_bytes",
                    "rel": "self",
                    "type": "application/vnd.abiquo.metricmetadata+json",
                    "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metrics/if_rx_bytes"
                }
            ],
            "name": "if_rx_bytes",
            "description": "number of received bytes of the network interfaces",
            "unit": "bytes",
            "namespace": "virtualmachine",
            "dimensions": {}
        }
    ]
}

To start with, we will use the name attributes of metrics to fetch specific metrics for the VM, in this example, the "vcpu_time" and "used_mem".

Enable monitoring and fetch metrics

When you enable monitoring in the UI, you edit the VM and go to the Monitoring and Metrics tab, select "Fetch metrics" and select the metrics to retrieve.

In the API, we will do this in two steps. First send a POST request to the link with the "rel" value of "enablemonitoring".

curl -X POST https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/enablemonitoring \
     -H 'Accept:text/json,application/json' \
     -u user:password --verbose

For the example VM, which is undeployed, the successful request returns a status code of 204 with no content.

However, the platform will not retrieve any metrics yet. 

Prepare a metadata object 

To retrieve specific metrics, add the metric names to the VM metadata.

Writing to metadata overwrites all existing metadata, so always start with a GET request to retrieve the existing metadata to use as the base object for adding metadata.

curl -X GET https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metadata \
     -H 'Accept:application/vnd.abiquo.metadata+json; version=4.2' \
     -u user:password --verbose

In this example, the metadata was null but it could contain user data, a startup script, Chef integration data, and so on.

Here we replaced the null metadata value with a "monitoring-metrics" attribute, with a list two metric names from the metricsmetadata request above. 

{
    "links": [],
    "metadata": {
        "monitoring-metrics": [
            {
                "name": "vcpu_time"
            },
            {
                "name": "used_mem"
            }
        ]
    }
} 


Update VM metadata

To update the VM metadata, perform a PUT request to the VM metadata link.

curl -X PUT https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/3/virtualmachines/12/metadata \
     -H 'Accept:application/vnd.abiquo.metadata+json; version=4.2' \
     -H 'Content-Type:application/vnd.abiquo.metadata+json; version=4.2' \
     -d @requestpayload.json \
     -u user:password --verbose

In this case, the requestpayload.json file should contain the JSON object from the previous step.

Metadata requestpayload.json object
{
    "links": [],
    "metadata": {
        "monitoring-metrics": [
            {
                "name": "cpu_time"
            },
            {
                "name": "used_mem"
            }
        ]
	}
} 

If the request is successful, it will return a status code of 200 and the updated metadata object.

{
    "links": [],
    "metadata": {
        "monitoring-metrics": [
            {
                "name": "cpu_time"
            },
            {
                "name": "used_mem"
            }
        ]
    }
}

Now when you access the VM in the UI, you should see the metrics symbol on the VM icon. 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.

  • No labels