---
title: KubeVirt API
description: Collect key metrics to monitor the health of your KubeVirt API service.
breadcrumbs: Docs > Integrations > KubeVirt API
---

# KubeVirt API
Supported OS Integration version2.5.1
## Overview{% #overview %}

This check monitors [KubeVirt API](https://docs.datadoghq.com/integrations/kubevirt_api.md) through the Datadog Agent.

**Minimum Agent version:** 7.59.0

## Setup{% #setup %}

Follow the instructions below to install and configure this check for an Agent running on a host. For containerized environments, see the [Autodiscovery Integration Templates](https://docs.datadoghq.com/agent/kubernetes/integrations.md) for guidance on applying these instructions.

### Installation{% #installation %}

The KubeVirt API check is included in the [Datadog Agent](https://app.datadoghq.com/account/settings/agent/latest) package. No additional installation is needed on your server.

### Configuration{% #configuration %}

The main use case to run the `kubevirt_api` check is as a [cluster level check](https://docs.datadoghq.com/containers/cluster_agent/clusterchecks.md?tab=datadogoperator).

In order to do that, you will need to update some RBAC permissions to give the `datadog-agent` service account read-only access to the`KubeVirt` resources by following the steps below:

1. Bind the `kubevirt.io:view` ClusterRole to the `datadog-agent` service account:

```yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: datadog-agent-kubevirt
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: kubevirt.io:view
subjects:
  - kind: ServiceAccount
    name: datadog-agent
    namespace: <DD_NAMESPACE>
```

Replace `<DD_NAMESPACE>` with the namespace where you installed the `datadog-agent` service account.
Annotate the pods template of your `virt-api` deployment by patching the `KubeVirt` resource as follows:
```yaml
apiVersion: kubevirt.io/v1
kind: KubeVirt
metadata:
  name: kubevirt
  namespace: kubevirt
spec:
  certificateRotateStrategy: {}
  configuration: {}
  customizeComponents:
    patches:
      - resourceType: Deployment
        resourceName: virt-api
        patch: '{"spec":{"template":{"metadata":{"annotations":{"ad.datadoghq.com/virt-api.check_names":"[\"kubevirt_api\"]","ad.datadoghq.com/virt-api.init_configs":"[{}]","ad.datadoghq.com/virt-api.instances":"[{\"kubevirt_api_metrics_endpoint\":\"https://%%host%%:%%port%%/metrics\",\"kubevirt_api_healthz_endpoint\":\"https://%%host%%:%%port%%/healthz\",\"kube_namespace\":\"%%kube_namespace%%\",\"kube_pod_name\":\"%%kube_pod_name%%\",\"tls_verify\":\"false\"}]"}}}}}'
        type: strategic
```

### Validation{% #validation %}

[Run the Cluster Agent's `clusterchecks` subcommand](https://docs.datadoghq.com/containers/troubleshooting/cluster-and-endpoint-checks.md#dispatching-logic-in-the-cluster-agent) inside your Cluster Agent container and look for the `kubevirt_api` check under the Checks section.

## Data Collected{% #data-collected %}

### Metrics{% #metrics %}

|  |
|  |
| **kubevirt\_api.can\_connect**(gauge)                                         | Value of 1 if the agent can connect to the KubeVirt Handler, and 0 otherwise.                           |
| **kubevirt\_api.process.cpu\_seconds.count**(count)                           | Total user and system CPU time spent in seconds.*Shown as second*                                       |
| **kubevirt\_api.process.max\_fds**(gauge)                                     | Maximum number of open file descriptors.*Shown as file*                                                 |
| **kubevirt\_api.process.open\_fds**(gauge)                                    | Number of open file descriptors.*Shown as file*                                                         |
| **kubevirt\_api.process.resident\_memory\_bytes**(gauge)                      | Resident memory size in bytes.*Shown as byte*                                                           |
| **kubevirt\_api.process.start\_time\_seconds**(gauge)                         | Start time of the process since unix epoch in seconds.*Shown as byte*                                   |
| **kubevirt\_api.process.virtual\_memory\_bytes**(gauge)                       | Virtual memory size in bytes.*Shown as byte*                                                            |
| **kubevirt\_api.process.virtual\_memory\_max\_bytes**(gauge)                  | Maximum amount of virtual memory available in bytes.*Shown as byte*                                     |
| **kubevirt\_api.promhttp.metric\_handler\_requests.count**(count)             | Total number of scrapes by HTTP status code.*Shown as request*                                          |
| **kubevirt\_api.promhttp.metric\_handler\_requests\_in\_flight**(gauge)       | Current number of scrapes being served.*Shown as request*                                               |
| **kubevirt\_api.rest.client\_rate\_limiter\_duration\_seconds.bucket**(count) | Histogram of client side rate limiter latency in seconds. Broken down by verb and URL.*Shown as second* |
| **kubevirt\_api.rest.client\_rate\_limiter\_duration\_seconds.count**(count)  | Histogram of client side rate limiter latency in seconds. Broken down by verb and URL.*Shown as second* |
| **kubevirt\_api.rest.client\_rate\_limiter\_duration\_seconds.sum**(count)    | Histogram of client side rate limiter latency in seconds. Broken down by verb and URL.*Shown as second* |
| **kubevirt\_api.rest.client\_request\_latency\_seconds.bucket**(count)        | Histogram of request latency in seconds. Broken down by verb and URL.*Shown as second*                  |
| **kubevirt\_api.rest.client\_request\_latency\_seconds.count**(count)         | Histogram of request latency in seconds. Broken down by verb and URL.*Shown as second*                  |
| **kubevirt\_api.rest.client\_request\_latency\_seconds.sum**(count)           | Histogram of request latency in seconds. Broken down by verb and URL.*Shown as second*                  |
| **kubevirt\_api.rest.client\_requests.count**(count)                          | Number of HTTP requests, partitioned by status code, method, and host.*Shown as request*                |
| **kubevirt\_api.vm.count**(gauge)                                             | Number of VirtualMachines in the KubeVirt API.                                                          |
| **kubevirt\_api.vmi.count**(gauge)                                            | Number of VirtualMachineInstances in the KubeVirt API.                                                  |

### Events{% #events %}

The KubeVirt API integration does not include any events.

### Service Checks{% #service-checks %}

The KubeVirt API integration does not include any service checks.

## Troubleshooting{% #troubleshooting %}

Need help? Contact [Datadog support](https://docs.datadoghq.com/help/).
