Supported service discovery configs #
vmagent and single-node VictoriaMetrics
supports the following Prometheus-compatible service discovery options for Prometheus-compatible scrape targets in the file pointed by -promscrape.config
command-line flag:
azure_sd_configs
is for scraping the targets registered in Azure Cloud. See these docs.consul_sd_configs
is for discovering and scraping targets registered in Consul. See these docs.consulagent_sd_configs
is for discovering and scraping targets registered in Consul Agent. See these docs.digitalocean_sd_configs
is for discovering and scraping targets registered in DigitalOcean. See these docs.dns_sd_configs
is for discovering and scraping targets from DNS records (SRV, A and AAAA). See these docs.docker_sd_configs
is for discovering and scraping Docker targets. See these docs.dockerswarm_sd_configs
is for discovering and scraping Docker Swarm targets. See these docs.ec2_sd_configs
is for discovering and scraping Amazon EC2 targets. See these docs.eureka_sd_configs
is for discovering and scraping targets registered in Netflix Eureka. See these docs.file_sd_configs
is for scraping targets defined in external files (aka file-based service discovery). See these docs.gce_sd_configs
is for discovering and scraping Google Compute Engine targets. See these docs.hetzner_sd_configs
is for discovering and scraping Hetzner Cloud and Hetzner Robot targets. See these docs.http_sd_configs
is for discovering and scraping targets provided by external http-based service discovery. See these docs.kubernetes_sd_configs
is for discovering and scraping Kubernetes targets. See these docs.kuma_sd_configs
is for discovering and scraping Kuma targets. See these docs.marathon_sd_configs
is for discovering and scraping Marathon targets. See these docs.nomad_sd_configs
is for discovering and scraping targets registered in HashiCorp Nomad. See these docs.openstack_sd_configs
is for discovering and scraping OpenStack targets. See these docs.ovhcloud_sd_configs
is for discovering and scraping OVH Cloud VPS and dedicated server targets. See these docs.puppetdb_sd_configs
is for discovering and scraping PuppetDB targets. See these docs.static_configs
is for scraping statically defined targets. See these docs.vultr_sd_configs
is for discovering and scraping Vultr targets. See these docs.yandexcloud_sd_configs
is for discovering and scraping Yandex Cloud targets. See these docs.
Note that the refresh_interval
option isn’t supported for these scrape configs. Use the corresponding -promscrape.*CheckInterval
command-line flag instead. For example, -promscrape.consulSDCheckInterval=60s
sets refresh_interval
for all the consul_sd_configs
entries to 60s. Run vmagent -help
or victoria-metrics -help
in order to see default values for the -promscrape.*CheckInterval
flags.
Please file feature requests to our issue tracker if you need other service discovery mechanisms
to be supported by VictoriaMetrics and vmagent
.
azure_sd_configs #
Azure SD configuration discovers scrape targets from Microsoft Azure VMs.
Configuration example:
|
|
Each discovered target has an __address__
label set
to <private_ip>:<port>
, where <private_ip>
is the machine’s private IP and the <port>
is the port
option specified in the azure_sd_configs
.
The following meta labels are available on discovered targets during relabeling:
__meta_azure_machine_id
: the machine ID__meta_azure_machine_location
: the location the machine runs in__meta_azure_machine_name
: the machine name__meta_azure_machine_computer_name
: the machine computer name__meta_azure_machine_os_type
: the machine operating system__meta_azure_machine_private_ip
: the machine’s private IP__meta_azure_machine_public_ip
: the machine’s public IP if it exists__meta_azure_machine_resource_group
: the machine’s resource group__meta_azure_machine_scale_set
: the name of the scale set which the vm is part of (this value is only set if you are using a scale set)__meta_azure_machine_size
: the machine size__meta_azure_machine_tag_<tagname>
: each tag value of the machine__meta_azure_subscription_id
: the subscription ID__meta_azure_tenant_id
: the tenant ID
The list of discovered Azure targets is refreshed at the interval, which can be configured via -promscrape.azureSDCheckInterval
command-line flag.
consul_sd_configs #
Consul SD configuration allows retrieving scrape targets from Consul’s Catalog API.
Configuration example:
|
|
Each discovered target has an __address__
label set
to <service_or_node_addr>:<service_port>
, where <service_or_node_addr>
is the service address. If the service address is empty,
then the node address is used instead. The <service_port>
is the service port.
The following meta labels are available on discovered targets during relabeling:
__meta_consul_address
: the address of the target__meta_consul_dc
: the datacenter name for the target__meta_consul_health
: the health status of the service__meta_consul_metadata_<key>
: each node metadata key value of the target__meta_consul_namespace
: namespace of the service - see namespace docs__meta_consul_node
: the node name defined for the target__meta_consul_partition
: partition of the service - see partition docs__meta_consul_service_address
: the service address of the target__meta_consul_service_id
: the service ID of the target__meta_consul_service_metadata_<key>
: each service metadata key value of the target__meta_consul_service_port
: the service port of the target__meta_consul_service
: the name of the service the target belongs to__meta_consul_tagged_address_<key>
: each node tagged address key value of the target__meta_consul_tag_<tagname>
: the value for the giventag of the target __meta_consul_tagpresent_<tagname>
: “true” for everytag of the target __meta_consul_tags
: the list of tags of the target joined by thetag_separator
The list of discovered Consul targets is refreshed at the interval, which can be configured via -promscrape.consulSDCheckInterval
command-line flag.
If you have performance issues with consul_sd_configs
on a large cluster, then consider using consulagent_sd_configs instead.
consulagent_sd_configs #
Consul Agent SD configuration allows retrieving scrape targets from Consul Agent API. When using the Agent API, only services registered in the locally running Consul Agent are discovered. It is suitable for huge clusters for which using the Catalog API would be too slow or resource intensive, in other cases it is recommended to use consul_sd_configs.
Configuration example:
|
|
Each discovered target has an __address__
label set
to <service_or_node_addr>:<service_port>
, where <service_or_node_addr>
is the service address. If the service address is empty,
then the node address is used instead. The <service_port>
is the service port.
The following meta labels are available on discovered targets during relabeling:
__meta_consulagent_address
: the address of the target__meta_consulagent_dc
: the datacenter name for the target__meta_consulagent_health
: the health status of the service__meta_consulagent_metadata_<key>
: each node metadata key value of the target__meta_consulagent_namespace
: namespace of the service - see namespace docs__meta_consulagent_node
: the node name defined for the target__meta_consulagent_service_address
: the service address of the target__meta_consulagent_service_id
: the service ID of the target__meta_consulagent_service_metadata_<key>
: each service metadata key value of the target__meta_consulagent_service_port
: the service port of the target__meta_consulagent_service
: the name of the service the target belongs to__meta_consulagent_tagged_address_<key>
: each node tagged address key value of the target__meta_consulagent_tag_<tagname>
: the value for the giventag of the target __meta_consulagent_tagpresent_<tagname>
: “true” for everytag of the target __meta_consulagent_tags
: the list of tags of the target joined by thetag_separator
The list of discovered Consul Agent targets is refreshed at the interval, which can be configured via -promscrape.consulagentSDCheckInterval
command-line flag.
digitalocean_sd_configs #
DigitalOcean SD configuration allows retrieving scrape targets from DigitalOcean’s Droplets API.
Configuration example:
|
|
Each discovered target has an __address__
label set
to <public_ip>:<port>
, where <public_ip>
is a public ipv4 address of the droplet, while <port>
is the port specified in the digitalocean_sd_configs
.
The following meta labels are available on discovered targets during relabeling:
__meta_digitalocean_droplet_id
: the id of the droplet__meta_digitalocean_droplet_name
: the name of the droplet__meta_digitalocean_image
: the slug of the droplet’s image__meta_digitalocean_image_name
: the display name of the droplet’s image__meta_digitalocean_private_ipv4
: the private IPv4 of the droplet__meta_digitalocean_public_ipv4
: the public IPv4 of the droplet__meta_digitalocean_public_ipv6
: the public IPv6 of the droplet__meta_digitalocean_region
: the region of the droplet__meta_digitalocean_size
: the size of the droplet__meta_digitalocean_status
: the status of the droplet__meta_digitalocean_features
: the comma-separated list of features of the droplet__meta_digitalocean_tags
: the comma-separated list of tags of the droplet__meta_digitalocean_vpc
: the id of the droplet’s VPC
The list of discovered DigitalOcean targets is refreshed at the interval, which can be configured via -promscrape.digitaloceanSDCheckInterval
command-line flag.
dns_sd_configs #
DNS-based service discovery allows retrieving scrape targets from the specified DNS domain names.
These specified names are periodically queried to discover a list of targets with the interval
configured via -promscrape.dnsSDCheckInterval
command-line flag.
Configuration example:
|
|
Each discovered target has an __address__
label set
to the <addr>:<port>
, where <addr>
is the discovered DNS address, while <port>
is either the discovered port for SRV records or the port
specified in the dns_sd_config
.
The following meta labels are available on discovered targets during relabeling:
__meta_dns_name
: the record name that produced the discovered target.__meta_dns_srv_record_target
: the target field of the SRV record__meta_dns_srv_record_port
: the port field of the SRV record__meta_dns_mx_record_target
: the target field of the MX record.
The list of discovered DNS targets is refreshed at the interval, which can be configured via -promscrape.dnsSDCheckInterval
command-line flag.
docker_sd_configs #
Docker SD configuration allows retrieving scrape targets from Docker Engine hosts.
Configuration example:
|
|
Each discovered target has an __address__
label set
to <ip_address>:<port>
, where <ip_address>
is the exposed ip address of the docker container, while the <port>
is either the exposed port
of the docker container or the port specified in the docker_sd_configs
if the docker container has no exposed ports.
If a container exposes multiple ip addresses, then multiple targets will be discovered - one per each exposed ip address.
The following meta labels are available on discovered targets during relabeling:
__meta_docker_container_id
: the id of the container__meta_docker_container_name
: the name of the container__meta_docker_container_network_mode
: the network mode of the container__meta_docker_container_label_<labelname>
: each label of the container__meta_docker_network_id
: the ID of the network__meta_docker_network_name
: the name of the network__meta_docker_network_ingress
: whether the network is ingress__meta_docker_network_internal
: whether the network is internal__meta_docker_network_label_<labelname>
: each label of the network__meta_docker_network_scope
: the scope of the network__meta_docker_network_ip
: the IP of the container in this network__meta_docker_port_private
: the port on the container__meta_docker_port_public
: the external port if a port-mapping exists__meta_docker_port_public_ip
: the public IP if a port-mapping exists
The list of discovered Docker targets is refreshed at the interval, which can be configured via -promscrape.dockerSDCheckInterval
command-line flag.
dockerswarm_sd_configs #
Docker Swarm SD configuration allows retrieving scrape targets from Docker Swarm engine.
Configuration example:
|
|
One of the following roles can be configured to discover targets:
role: services
The
services
role discovers all Swarm services.Each discovered target has an
__address__
label set to<ip>:<port>
, where<ip>
is the endpoint’s virtual IP, while the<port>
is the published port of the service. If the service has multiple published ports, then multiple targets are generated - one per each port. If the service has no published ports, then the<port>
is set to theport
value obtained fromdockerswarm_sd_configs
.Available meta labels for
role: services
during relabeling:__meta_dockerswarm_service_id
: the id of the service__meta_dockerswarm_service_name
: the name of the service__meta_dockerswarm_service_mode
: the mode of the service__meta_dockerswarm_service_endpoint_port_name
: the name of the endpoint port, if available__meta_dockerswarm_service_endpoint_port_publish_mode
: the publishing mode of the endpoint port__meta_dockerswarm_service_label_<labelname>
: each label of the service__meta_dockerswarm_service_task_container_hostname
: the container hostname of the target, if available__meta_dockerswarm_service_task_container_image
: the container image of the target__meta_dockerswarm_service_updating_status
: the status of the service, if available__meta_dockerswarm_network_id
: the ID of the network__meta_dockerswarm_network_name
: the name of the network__meta_dockerswarm_network_ingress
: whether the network is ingress__meta_dockerswarm_network_internal
: whether the network is internal__meta_dockerswarm_network_label_<labelname>
: each label of the network__meta_dockerswarm_network_scope
: the scope of the network
role: tasks
The
tasks
role discovers all Swarm tasks.Each discovered target has an
__address__
label set to<ip>:<port>
, where the<ip>
is the node IP, while the<port>
is the published port of the task. If the task has multiple published ports, then multiple targets are generated - one per each port. If the task has no published ports, then the<port>
is set to theport
value obtained fromdockerswarm_sd_configs
.Available meta labels for
role: tasks
during relabeling:__meta_dockerswarm_container_label_<labelname>
: each label of the container__meta_dockerswarm_task_id
: the id of the task__meta_dockerswarm_task_container_id
: the container id of the task__meta_dockerswarm_task_desired_state
: the desired state of the task__meta_dockerswarm_task_slot
: the slot of the task__meta_dockerswarm_task_state
: the state of the task__meta_dockerswarm_task_port_publish_mode
: the publishing mode of the task port__meta_dockerswarm_service_id
: the id of the service__meta_dockerswarm_service_name
: the name of the service__meta_dockerswarm_service_mode
: the mode of the service__meta_dockerswarm_service_label_<labelname>
: each label of the service__meta_dockerswarm_network_id
: the ID of the network__meta_dockerswarm_network_name
: the name of the network__meta_dockerswarm_network_ingress
: whether the network is ingress__meta_dockerswarm_network_internal
: whether the network is internal__meta_dockerswarm_network_label_<labelname>
: each label of the network__meta_dockerswarm_network_label
: each label of the network__meta_dockerswarm_network_scope
: the scope of the network__meta_dockerswarm_node_id
: the ID of the node__meta_dockerswarm_node_hostname
: the hostname of the node__meta_dockerswarm_node_address
: the address of the node__meta_dockerswarm_node_availability
: the availability of the node__meta_dockerswarm_node_label_<labelname>
: each label of the node__meta_dockerswarm_node_platform_architecture
: the architecture of the node__meta_dockerswarm_node_platform_os
: the operating system of the node__meta_dockerswarm_node_role
: the role of the node__meta_dockerswarm_node_status
: the status of the node
The
__meta_dockerswarm_network_*
meta labels are not populated for ports which are published withmode=host
.role: nodes
The
nodes
role is used to discover Swarm nodes.Each discovered target has an
__address__
label set to<ip>:<port>
, where<ip>
is the node IP, while the<port>
is theport
value obtained from thedockerswarm_sd_configs
.Available meta labels for
role: nodes
during relabeling:__meta_dockerswarm_node_address
: the address of the node__meta_dockerswarm_node_availability
: the availability of the node__meta_dockerswarm_node_engine_version
: the version of the node engine__meta_dockerswarm_node_hostname
: the hostname of the node__meta_dockerswarm_node_id
: the ID of the node__meta_dockerswarm_node_label_<labelname>
: each label of the node__meta_dockerswarm_node_manager_address
: the address of the manager component of the node__meta_dockerswarm_node_manager_leader
: the leadership status of the manager component of the node (true or false)__meta_dockerswarm_node_manager_reachability
: the reachability of the manager component of the node__meta_dockerswarm_node_platform_architecture
: the architecture of the node__meta_dockerswarm_node_platform_os
: the operating system of the node__meta_dockerswarm_node_role
: the role of the node__meta_dockerswarm_node_status
: the status of the node
The list of discovered Docker Swarm targets is refreshed at the interval, which can be configured via -promscrape.dockerswarmSDCheckInterval
command-line flag.
ec2_sd_configs #
EC2 SD configuration allows retrieving scrape targets from AWS EC2 instances.
Configuration example:
|
|
Each discovered target has an __address__
label set
to <instance_ip>:<port>
, where <instance_ip>
is the private IP of the instance, while the <port>
is set to the port
value
obtain from ec2_sd_configs
.
The following meta labels are available on discovered targets during relabeling:
__meta_ec2_ami
: the EC2 Amazon Machine Image__meta_ec2_architecture
: the architecture of the instance__meta_ec2_availability_zone
: the availability zone in which the instance is running__meta_ec2_availability_zone_id
: the availability zone ID in which the instance is running (requires ec2:DescribeAvailabilityZones)__meta_ec2_instance_id
: the EC2 instance ID__meta_ec2_instance_lifecycle
: the lifecycle of the EC2 instance, set only for ‘spot’ or ‘scheduled’ instances, absent otherwise__meta_ec2_instance_state
: the state of the EC2 instance__meta_ec2_instance_type
: the type of the EC2 instance__meta_ec2_ipv6_addresses
: comma separated list of IPv6 addresses assigned to the instance’s network interfaces, if present__meta_ec2_owner_id
: the ID of the AWS account that owns the EC2 instance__meta_ec2_platform
: the Operating System platform, set to ‘windows’ on Windows servers, absent otherwise__meta_ec2_primary_subnet_id
: the subnet ID of the primary network interface, if available__meta_ec2_private_dns_name
: the private DNS name of the instance, if available__meta_ec2_private_ip
: the private IP address of the instance, if present__meta_ec2_public_dns_name
: the public DNS name of the instance, if available__meta_ec2_public_ip
: the public IP address of the instance, if available__meta_ec2_region
: EC2 region for the discovered instance__meta_ec2_subnet_id
: comma separated list of subnets IDs in which the instance is running, if available__meta_ec2_tag_<tagkey>
: each tag value of the instance__meta_ec2_vpc_id
: the ID of the VPC in which the instance is running, if available
The list of discovered EC2 targets is refreshed at the interval, which can be configured via -promscrape.ec2SDCheckInterval
command-line flag.
eureka_sd_configs #
Eureka SD configuration allows retrieving scrape targets using the Eureka REST API.
Configuration example:
|
|
Each discovered target has an __address__
label set
to <instance_host>:<instance_port>
, where <instance_host>
is the discovered instance hostname, while the <instance_port>
is the discovered instance port. If the instance has no port, then port 80 is used.
The following meta labels are available on discovered targets during relabeling:
__meta_eureka_app_name
: the name of the app__meta_eureka_app_instance_id
: the ID of the app instance__meta_eureka_app_instance_hostname
: the hostname of the instance__meta_eureka_app_instance_homepage_url
: the homepage url of the app instance__meta_eureka_app_instance_statuspage_url
: the status page url of the app instance__meta_eureka_app_instance_healthcheck_url
: the health check url of the app instance__meta_eureka_app_instance_ip_addr
: the IP address of the app instance__meta_eureka_app_instance_vip_address
: the VIP address of the app instance__meta_eureka_app_instance_secure_vip_address
: the secure VIP address of the app instance__meta_eureka_app_instance_status
: the status of the app instance__meta_eureka_app_instance_port
: the port of the app instance__meta_eureka_app_instance_port_enabled
: the port enabled of the app instance__meta_eureka_app_instance_secure_port
: the secure port address of the app instance__meta_eureka_app_instance_secure_port_enabled
: the secure port of the app instance__meta_eureka_app_instance_country_id
: the country ID of the app instance__meta_eureka_app_instance_metadata_<metadataname>
: app instance metadata__meta_eureka_app_instance_datacenterinfo_name
: the datacenter name of the app instance__meta_eureka_app_instance_datacenterinfo_metadata_<metadataname>
: the datacenter metadata
The list of discovered Eureka targets is refreshed at the interval, which can be configured via -promscrape.eurekaSDCheckInterval
command-line flag.
file_sd_configs #
File-based service discovery reads a set of files with lists of targets to scrape.
Configuration example:
|
|
See these examples on how to configure file-based target discovery.
The referred files and urls must contain a list of static configs in one of the following formats:
JSON:
1 2 3 4 5 6 7 8 9 10
[ { "targets": ["<host>", ... ], "labels": { "<labelname>": "<labelvalue>", ..., } }, ... ]
YAML:
1 2 3 4 5
- targets: ["<host>", ... ] labels: <labelname>: <labelvalue> ... ...
Each discovered target has an __address__
label set
to one of the target
value specified in the target files.
The following meta labels are available on discovered targets during relabeling:
__meta_filepath
: the filepath from which the target was extracted
See the list of integrations with file_sd_configs
.
The list of discovered file-based targets is refreshed at the interval, which can be configured via -promscrape.fileSDCheckInterval
command-line flag.
gce_sd_configs #
GCE SD configuration allows retrieving scrape targets from GCP GCE instances.
Configuration example:
|
|
Credentials are discovered by looking in the following places, preferring the first location found:
- a JSON file specified by the
GOOGLE_APPLICATION_CREDENTIALS
environment variable - a JSON file in the well-known path
$HOME/.config/gcloud/application_default_credentials.json
- fetched from the GCE metadata server
Each discovered target has an __address__
label set
to <iface_ip>:<port>
, where <iface_ip>
is private IP of the discovered instance, while <port>
is the port
value
specified in the gce_sd_configs
.
The following meta labels are available on discovered targets during relabeling:
__meta_gce_instance_id
: the numeric id of the instance__meta_gce_instance_name
: the name of the instance__meta_gce_label_<labelname>
: each GCE label of the instance__meta_gce_machine_type
: full or partial URL of the machine type of the instance__meta_gce_metadata_<name>
: each metadata item of the instance__meta_gce_network
: the network URL of the instance__meta_gce_private_ip
: the private IP address of the instance__meta_gce_interface_ipv4_<name>
: IPv4 address of each named interface__meta_gce_project
: the GCP project in which the instance is running__meta_gce_public_ip
: the public IP address of the instance, if present__meta_gce_subnetwork
: the subnetwork URL of the instance__meta_gce_tags
: list of instance tags separated by tag_separator__meta_gce_zone
: the GCE zone URL in which the instance is running
The list of discovered GCE targets is refreshed at the interval, which can be configured via -promscrape.gceSDCheckInterval
command-line flag.
hetzner_sd_configs #
Hetzner SD configuration allows retrieving scrape targets from Hetzner Cloud and Hetzner Robot.
Configuration example:
|
|
Each discovered target has an __address__
label set
to <FQDN>:<port>
, where FQDN is discovered instance address and <port>
is the port from the hetzner_sd_configs
(default port is 80
).
The following meta labels are available on discovered targets during relabeling:
Common labels for both hcloud
and robot
roles:
__meta_hetzner_datacenter
: the datacenter of the server__meta_hetzner_public_ipv4
: the public IPv4 address of the server__meta_hetzner_public_ipv6_network
: the public IPv6 network (/64) of the server__meta_hetzner_role
: the current rolehcloud
orrobot
__meta_hetzner_server_id
: the ID of the server__meta_hetzner_server_name
: the name of the server__meta_hetzner_server_status
: the status of the server
Additional labels for role: hcloud
:
__meta_hetzner_hcloud_datacenter_location
: the location of the server__meta_hetzner_hcloud_datacenter_location_network_zone
: the network zone of the server__meta_hetzner_hcloud_cpu_cores
: the CPU cores count of the server__meta_hetzner_hcloud_cpu_type
: the CPU type of the server (shared or dedicated)__meta_hetzner_hcloud_disk_size_gb
: the disk size of the server (in GB)__meta_hetzner_hcloud_image_description
: the description of the server image__meta_hetzner_hcloud_image_name
: the image name of the server__meta_hetzner_hcloud_image_os_flavor
: the OS flavor of the server image__meta_hetzner_hcloud_image_os_version
: the OS version of the server image__meta_hetzner_hcloud_label_<labelname>
: each label of the server__meta_hetzner_hcloud_labelpresent_<labelname>
: true for each label of the server__meta_hetzner_hcloud_memory_size_gb
: the amount of memory of the server (in GB)__meta_hetzner_hcloud_private_ipv4_<networkname>
: the private IPv4 address of the server within a given network__meta_hetzner_hcloud_server_type
: the type of the server
Additional labels for role: robot
:
__meta_hetzner_robot_cancelled
: the server cancellation status__meta_hetzner_robot_product
: the product of the server
The list of discovered Hetzner targets is refreshed at the interval, which can be configured via -promscrape.hetznerSDCheckInterval
command-line flag.
http_sd_configs #
HTTP-based service discovery fetches targets from the specified url
.
Configuration example:
|
|
See these examples on how to configure http-based target discovery.
The service at url
must return JSON response in the following format:
|
|
The url
is queried periodically with the interval specified in -promscrape.httpSDCheckInterval
command-line flag.
Discovery errors are tracked in promscrape_discovery_http_errors_total
metric.
Each discovered target has an __address__
label set
to one of the targets returned by the http service.
The following meta labels are available on discovered targets during relabeling:
__meta_url
: the URL from which the target was extracted
The list of discovered HTTP-based targets is refreshed at the interval, which can be configured via -promscrape.httpSDCheckInterval
command-line flag.
kubernetes_sd_configs #
Kubernetes SD configuration allows retrieving scrape targets from Kubernetes REST API.
Configuration example:
|
|
See these examples on how to discover and scrape Kubernetes targets.
One of the following role
types can be configured to discover targets:
role: node
The
role: node
discovers one target per cluster node.Each discovered target has an
__address__
label set to<ip>:<port>
, where<ip>
is to the first existing address of the Kubernetes node object in the address type order ofNodeInternalIP
,NodeExternalIP
,NodeLegacyHostIP
andNodeHostName
, while<port>
is the kubelet port on the given node.Available meta labels for
role: node
during relabeling:__meta_kubernetes_node_name
: The name of the node object.__meta_kubernetes_node_provider_id
: The cloud provider’s name for the node object.__meta_kubernetes_node_label_<labelname>
: Each label from the node object.__meta_kubernetes_node_labelpresent_<labelname>
: “true” for each label from the node object.__meta_kubernetes_node_annotation_<annotationname>
: Each annotation from the node object.__meta_kubernetes_node_annotationpresent_<annotationname>
: “true” for each annotation from the node object.__meta_kubernetes_node_address_<address_type>
: The first address for each node address type, if it exists.
In addition, the
instance
label for the node will be set to the node name as retrieved from the API server.role: service
The
role: service
discovers Kubernetes services.Each discovered target has an
__address__
label set to<service_name>.<namespace>:<port>
, where<service_name>
is the service name,<namespace>
is the service namespace and<port>
is the service port. If the service has multiple ports, then multiple targets are discovered for the service - one per each port.This is generally useful for blackbox monitoring of a service. The target address will be set to the Kubernetes DNS name of the service and respective service port.
Available meta labels for
role: service
during relabeling:__meta_kubernetes_namespace
: The namespace of the service object.__meta_kubernetes_service_annotation_<annotationname>
: Each annotation from the service object.__meta_kubernetes_service_annotationpresent_<annotationname>
: “true” for each annotation of the service object.__meta_kubernetes_service_cluster_ip
: The cluster IP address of the service. (Does not apply to services of type ExternalName)__meta_kubernetes_service_external_name
: The DNS name of the service. (Applies to services of type ExternalName)__meta_kubernetes_service_label_<labelname>
: Each label from the service object.__meta_kubernetes_service_labelpresent_<labelname>
: “true” for each label of the service object.__meta_kubernetes_service_name
: The name of the service object.__meta_kubernetes_service_port_name
: Name of the service port for the target.__meta_kubernetes_service_port_number
: Service port number for the target.__meta_kubernetes_service_port_protocol
: Protocol of the service port for the target.__meta_kubernetes_service_type
: The type of the service.
role: pod
The
role: pod
discovers all pods and exposes their containers as targets.Each discovered target has an
__address__
label set to<ip>:<port>
, where<ip>
is pod IP, while<port>
is the exposed container port. If the pod has multiple container ports, then multiple targets are generated for the pod - one per each exposed container port. If the pod has no exposed container ports, then the__address__
for pod target is set to the pod IP.Available meta labels for
role: pod
during relabeling:__meta_kubernetes_namespace
: The namespace of the pod object.__meta_kubernetes_pod_name
: The name of the pod object.__meta_kubernetes_pod_ip
: The pod IP of the pod object.__meta_kubernetes_pod_label_<labelname>
: Each label from the pod object.__meta_kubernetes_pod_labelpresent_<labelname>
: “true” for each label from the pod object.__meta_kubernetes_pod_annotation_<annotationname>
: Each annotation from the pod object.__meta_kubernetes_pod_annotationpresent_<annotationname>
: “true” for each annotation from the pod object.__meta_kubernetes_pod_container_id
: ID of the container in the form<type>://<container_id>
.__meta_kubernetes_pod_container_image
: Container image the target address points to.__meta_kubernetes_pod_container_init
: “true” if the container is an InitContainer.__meta_kubernetes_pod_container_name
: Name of the container the target address points to.__meta_kubernetes_pod_container_port_name
: Name of the container port.__meta_kubernetes_pod_container_port_number
: Number of the container port.__meta_kubernetes_pod_container_port_protocol
: Protocol of the container port.__meta_kubernetes_pod_ready
: Set to true or false for the pod’s ready state.__meta_kubernetes_pod_phase
: Set to Pending, Running, Succeeded, Failed or Unknown in the lifecycle.__meta_kubernetes_pod_node_name
: The name of the node the pod is scheduled onto.__meta_kubernetes_pod_host_ip
: The current host IP of the pod object.__meta_kubernetes_pod_uid
: The UID of the pod object.__meta_kubernetes_pod_controller_kind
: Object kind of the pod controller.__meta_kubernetes_pod_controller_name
: Name of the pod controller.
role: endpoints
The
role: endpoints
discovers targets from listed endpoints of a service.Each discovered target has an
__address__
label set to<addr>:<port>
, where<addr>
is the endpoint address, while<port>
is the endpoint port. If the endpoint has multiple ports, then a single target per each port is generated. If the endpoint is backed by a pod, all additional container ports of the pod, not bound to an endpoint port, are discovered as targets as well.Available meta labels for
role: endpoints
during relabeling:__meta_kubernetes_namespace
: The namespace of the endpoints object.__meta_kubernetes_endpoints_name
: The names of the endpoints object.__meta_kubernetes_endpoints_label_<labelname>
: Each label from the endpoints object.__meta_kubernetes_endpoints_labelpresent_<labelname>
: “true” for each label from the endpoints object.
For all targets discovered directly from the endpoints list (those not additionally inferred from underlying pods), the following labels are attached:
__meta_kubernetes_endpoint_hostname
: Hostname of the endpoint.__meta_kubernetes_endpoint_node_name
: Name of the node hosting the endpoint.__meta_kubernetes_endpoint_ready
: Set to true or false for the endpoint’s ready state.__meta_kubernetes_endpoint_port_name
: Name of the endpoint port.__meta_kubernetes_endpoint_port_protocol
: Protocol of the endpoint port.__meta_kubernetes_endpoint_address_target_kind
: Kind of the endpoint address target.__meta_kubernetes_endpoint_address_target_name
: Name of the endpoint address target.
If the endpoints belong to a service, all labels of the
role: service
are attached. For all targets backed by a pod, all labels of therole: pod
are attached.role: endpointslice
The
role: endpointslice
discovers targets from existing endpointslices.Each discovered target has an
__address__
label set to<addr>:<port>
, where<addr>
is the endpoint address, while<port>
is the endpoint port. If the endpoint has multiple ports, then a single target per each port is generated. If the endpoint is backed by a pod, all additional container ports of the pod, not bound to an endpoint port, are discovered as targets as well.Available meta labels for
role: endpointslice
during relabeling:__meta_kubernetes_namespace
: The namespace of the endpointslice object.__meta_kubernetes_endpointslice_name
: The name of endpointslice object.
For all targets discovered directly from the endpointslice list (those not additionally inferred from underlying pods), the following labels are attached:
__meta_kubernetes_endpointslice_address_target_kind
: Kind of the referenced object.__meta_kubernetes_endpointslice_address_target_name
: Name of referenced object.__meta_kubernetes_endpointslice_address_type
: The ip protocol family of the address of the target.__meta_kubernetes_endpointslice_endpoint_conditions_ready
: Set to true or false for the referenced endpoint’s ready state.__meta_kubernetes_endpointslice_endpoint_topology_kubernetes_io_hostname
: Name of the node hosting the referenced endpoint.__meta_kubernetes_endpointslice_endpoint_topology_present_kubernetes_io_hostname
: Flag that shows if the referenced object has a kubernetes.io/hostname annotation.__meta_kubernetes_endpointslice_port
: Port of the referenced endpoint.__meta_kubernetes_endpointslice_port_name
: Named port of the referenced endpoint.__meta_kubernetes_endpointslice_port_protocol
: Protocol of the referenced endpoint.
If the endpoints belong to a service, all labels of the
role: service
are attached. For all targets backed by a pod, all labels of therole: pod
are attached.role: ingress
The
role: ingress
discovers a target for each path of each ingress.Each discovered target has an
__address__
label set to the host obtained from ingress spec. If the ingress has multiple specs with multiple hosts, then a target per each host is created.This is generally useful for blackbox monitoring of an ingress.
Available meta labels for
role: ingress
during relabeling:__meta_kubernetes_namespace
: The namespace of the ingress object.__meta_kubernetes_ingress_name
: The name of the ingress object.__meta_kubernetes_ingress_label_<labelname>
: Each label from the ingress object.__meta_kubernetes_ingress_labelpresent_<labelname>
: “true” for each label from the ingress object.__meta_kubernetes_ingress_annotation_<annotationname>
: Each annotation from the ingress object.__meta_kubernetes_ingress_annotationpresent_<annotationname>
: “true” for each annotation from the ingress object.__meta_kubernetes_ingress_class_name
: Class name from ingress spec, if present.__meta_kubernetes_ingress_scheme
: Protocol scheme of ingress, https if TLS config is set. Defaults to http.__meta_kubernetes_ingress_path
: Path from ingress spec. Defaults to/
.
The list of discovered Kubernetes targets is refreshed at the interval, which can be configured via -promscrape.kubernetesSDCheckInterval
command-line flag.
kuma_sd_configs #
Kuma service discovery config allows to fetch targets from the specified control plane server
of Kuma Service Mesh.
It discovers “monitoring assignments” based on Kuma Dataplane Proxies, via the MADS (Monitoring Assignment Discovery Service) xDS RESP API.
Configuration example:
|
|
The server
is queried periodically with the interval specified in -promscrape.kumaSDCheckInterval
command-line flag.
Discovery errors are tracked in promscrape_discovery_kuma_errors_total
metric.
Each discovered target has an __address__
label set
to one of the targets returned by the http service.
The following meta labels are available on discovered targets during relabeling:
__meta_kuma_mesh
: the name of the mesh__meta_kuma_dataplane
: the name of the proxy__meta_kuma_service
: the name of the service associated with the proxy__meta_kuma_label_<label_name>
: each label of target given from Kuma Control Plane
The list of discovered Kuma targets is refreshed at the interval, which can be configured via -promscrape.kumaSDCheckInterval
command-line flag.
marathon_sd_configs #
Marathon SD configuration Available from v1.109.0 allows retrieving scrape targets from Marathon REST API.
Configuration example:
|
|
The following meta labels are available on discovered targets during relabeling:
__meta_marathon_app
: the name of the app (with slashes replaced by dashes)__meta_marathon_image
: the name of the Docker image used (if available)__meta_marathon_task
: the ID of the Mesos task__meta_marathon_app_label_<labelname>
: any Marathon labels attached to the app__meta_marathon_port_definition_label_<labelname>
: the port definition labels__meta_marathon_port_mapping_label_<labelname>
: the port mapping labels__meta_marathon_port_index
: the port index number (e.g.1
forPORT1
)
The list of discovered Marathon targets is refreshed at the interval, which can be configured via -promscrape.marathonSDCheckInterval
command-line flag.
nomad_sd_configs #
Nomad SD configuration allows retrieving scrape targets from HashiCorp Nomad Services.
Configuration example:
|
|
Each discovered target has an __address__
label set
to <addr>:<port>
, where <addr>
is the service address, while <port>
is the service port.
The following meta labels are available on discovered targets during relabeling:
__meta_nomad_address
: the address of the target__meta_nomad_dc
: the datacenter name for the target__meta_nomad_namespace
: namespace of the service__meta_nomad_node_id
: the node ID defined for the target__meta_nomad_service
: the name of the service the target belongs to__meta_nomad_service_address
: the service address of the target__meta_nomad_service_alloc_id
: the AllocID of the target service__meta_nomad_service_id
: the ID of the target service__meta_nomad_service_job_id
: the JobID of the target service__meta_nomad_service_port
: the service port of the target__meta_nomad_tag_<tagname>
: the value for the giventag of the target __meta_nomad_tagpresent_<tagname>
: “true” for everytag of the target __meta_nomad_tags
: the list of tags of the target joined by thetag_separator
The list of discovered Nomad targets is refreshed at the interval, which can be configured via -promscrape.nomadSDCheckInterval
command-line flag.
openstack_sd_configs #
OpenStack SD configuration allows retrieving scrape targets from OpenStack Nova instances.
OpenStack identity API v3 is supported only.
Configuration example:
|
|
One of the following role
types can be configured to discover targets:
role: hypervisor
The
role: hypervisor
discovers one target per Nova hypervisor node.Each discovered target has an
__address__
label set to<host>:<port>
, where<host>
is the discovered node IP, while<port>
is the port specified in theopenstack_sd_configs
.The following meta labels are available on discovered targets during relabeling:
__meta_openstack_hypervisor_host_ip
: the hypervisor node’s IP address.__meta_openstack_hypervisor_hostname
: the hypervisor node’s name.__meta_openstack_hypervisor_id
: the hypervisor node’s ID.__meta_openstack_hypervisor_state
: the hypervisor node’s state.__meta_openstack_hypervisor_status
: the hypervisor node’s status.__meta_openstack_hypervisor_type
: the hypervisor node’s type.
role: instance
The
role: instance
discovers one target per network interface of Nova instance.Each discovered target has an
__address__
label set to<host>:<port>
, where<host>
is the private IP address of the discovered instance, while<port>
is the port specified in theopenstack_sd_configs
.The following meta labels are available on discovered targets during relabeling:
__meta_openstack_address_pool
: the pool of the private IP.__meta_openstack_instance_flavor
: the flavor of the OpenStack instance.__meta_openstack_instance_id
: the OpenStack instance ID.__meta_openstack_instance_name
: the OpenStack instance name.__meta_openstack_instance_status
: the status of the OpenStack instance.__meta_openstack_private_ip
: the private IP of the OpenStack instance.__meta_openstack_project_id
: the project (tenant) owning this instance.__meta_openstack_public_ip
: the public IP of the OpenStack instance.__meta_openstack_tag_<tagkey>
: each tag value of the instance.__meta_openstack_user_id
: the user account owning the tenant.
The list of discovered OpenStack targets is refreshed at the interval, which can be configured via -promscrape.openstackSDCheckInterval
command-line flag.
ovhcloud_sd_configs #
OVH Cloud SD configuration Available from v1.104.0 allows retrieving scrape targets from OVH Cloud VPS and OVH Cloud dedicated server.
Configuration example:
|
|
Each discovered target has an __address__
label set to either <ipv4>
address or <ipv6>
address.
In addition, the instance
label for the VPS/dedicated server will be set to the VPS/dedicated server name as retrieved from OVH Cloud API.
The following meta labels are available on discovered targets during relabeling.
VPS:
__meta_ovhcloud_vps_cluster
: the cluster of the server.__meta_ovhcloud_vps_datacenter
: the datacenter of the server.__meta_ovhcloud_vps_disk
: the disk of the server.__meta_ovhcloud_vps_display_name
: the display name of the server.__meta_ovhcloud_vps_ipv4
: the IPv4 of the server.__meta_ovhcloud_vps_ipv6
: the IPv6 of the server.__meta_ovhcloud_vps_keymap
: the KVM keyboard layout of the server.__meta_ovhcloud_vps_maximum_additional_ip
: the maximum additional IPs of the server.__meta_ovhcloud_vps_memory_limit
: the memory limit of the server.__meta_ovhcloud_vps_memory
: the memory of the server.__meta_ovhcloud_vps_monitoring_ip_blocks
: the monitoring IP blocks of the server.__meta_ovhcloud_vps_name
: the name of the server.__meta_ovhcloud_vps_netboot_mode
: the netboot mode of the server.__meta_ovhcloud_vps_offer_type
: the offer type of the server.__meta_ovhcloud_vps_offer
: the offer of the server.__meta_ovhcloud_vps_state
: the state of the server.__meta_ovhcloud_vps_vcore
: the number of virtual cores of the server.__meta_ovhcloud_vps_version
: the version of the server.__meta_ovhcloud_vps_zone
: the zone of the server.
Dedicated servers:
__meta_ovhcloud_dedicated_server_commercial_range
: the commercial range of the server.__meta_ovhcloud_dedicated_server_datacenter
: the datacenter of the server.__meta_ovhcloud_dedicated_server_ipv4
: the IPv4 of the server.__meta_ovhcloud_dedicated_server_ipv6
: the IPv6 of the server.__meta_ovhcloud_dedicated_server_link_speed
: the link speed of the server.__meta_ovhcloud_dedicated_server_name
: the name of the server.__meta_ovhcloud_dedicated_server_no_intervention
: the intervention of the server.__meta_ovhcloud_dedicated_server_os
: the operating system of the server.__meta_ovhcloud_dedicated_server_rack
: the rack of the server.__meta_ovhcloud_dedicated_server_reverse
: the reverse DNS name of the server.__meta_ovhcloud_dedicated_server_server_id
: the ID of the server.__meta_ovhcloud_dedicated_server_state
: the state of the server.__meta_ovhcloud_dedicated_server_support_level
: the support level of the server.
The list of discovered OVH Cloud targets is refreshed at the interval, which can be configured via -promscrape.ovhcloudSDCheckInterval
command-line flag.
puppetdb_sd_configs #
PuppetDB SD configuration Available from v1.106.0 allows retrieving scrape targets from PuppetDB resources.
This SD discovers resources and will create a target for each resource returned by the API.
Configuration example:
|
|
The resource address is the certname
of the resource and can be changed during relabeling.
The following meta labels are available on targets during relabeling:
__meta_puppetdb_query
: the Puppet Query Language (PQL) query.__meta_puppetdb_certname
: the name of the node associated with the resource.__meta_puppetdb_resource
: a SHA-1 hash of the resource’s type, title, and parameters, for identification.__meta_puppetdb_type
: the resource type.__meta_puppetdb_title
: the resource title.__meta_puppetdb_exported
: whether the resource is exported ("true"
or"false"
).__meta_puppetdb_tags
: comma separated list of resource tags.__meta_puppetdb_file
: the manifest file in which the resource was declared.__meta_puppetdb_environment
: the environment of the node associated with the resource.__meta_puppetdb_parameter_<parametername>
: the parameters of the resource.
The list of discovered PuppetDB targets is refreshed at the interval, which can be configured via -promscrape.puppetdbSDCheckInterval
command-line flag.
static_configs #
A static config allows specifying a list of targets and a common label set for them.
Configuration example:
|
|
See these examples on how to configure scraping for static targets.
vultr_sd_configs #
Vultr SD configuration discovers scrape targets from Vultr Instances.
Configuration example:
|
|
Each discovered target has an __address__
label set
to <FQDN>:<port>
, where FQDN is discovered instance address and <port>
is the port from the vultr_sd_configs
(default port is 80
).
The following meta labels are available on discovered targets during relabeling:
__meta_vultr_instance_allowed_bandwidth_gb
: monthly bandwidth quota in GB.__meta_vultr_instance_disk_gb
: the size of the disk in GB.__meta_vultr_instance_features
: comma-separated list of features available to instance, such as “auto_backups”, “ipv6”, “ddos_protection”.__meta_vultr_instance_hostname
: hostname for this instance.__meta_vultr_instance_id
: unique ID for the VPS Instance.__meta_vultr_instance_internal_ip
: internal IP used by this instance, if set. Only relevant when a VPC is attached.__meta_vultr_instance_label
: user-supplied label for this instance.__meta_vultr_instance_main_ip
: main IPv4 address.__meta_vultr_instance_main_ipv6
: main IPv6 network address.__meta_vultr_instance_os
: operating System name.__meta_vultr_instance_os_id
: operating System id used by this instance.__meta_vultr_instance_plan
: unique ID for the Plan.__meta_vultr_instance_ram_mb
: the amount of RAM in MB.__meta_vultr_instance_region
: region id where the Instance is located.__meta_vultr_instance_server_status
: server health status, which could benone
,locked
,installingbooting
,ok
.__meta_vultr_instance_tags
: comma-separated list of tags applied to the instance.__meta_vultr_instance_vcpu_count
: the number of vCPUs.
The list of discovered Vultr targets is refreshed at the interval, which can be configured via -promscrape.vultrSDCheckInterval
command-line flag, default: 30s.
yandexcloud_sd_configs #
Yandex Cloud SD configurations allow retrieving scrape targets from accessible folders.
Configuration example:
|
|
Yandex Cloud SD support both user OAuth token
and instance service account if yandex_passport_oauth_token
is omitted:
|
|
Each discovered target has an __address__
label set
to the FQDN of the discovered instance.
The following meta labels are available on discovered targets during relabeling:
__meta_yandexcloud_instance_name
: the name of instance__meta_yandexcloud_instance_id
: the id of instance__meta_yandexcloud_instance_fqdn
: generated FQDN for instance__meta_yandexcloud_instance_status
: the status of instance__meta_yandexcloud_instance_platform_id
: instance platform ID (i.e. “standard-v3”)__meta_yandexcloud_instance_resources_cores
: instance vCPU cores__meta_yandexcloud_instance_resources_core_fraction
: instance core fraction__meta_yandexcloud_instance_resources_memory
: instance memory__meta_yandexcloud_folder_id
: instance folder ID__meta_yandexcloud_instance_label_<label name>
: each label from instance__meta_yandexcloud_instance_private_ip_<interface index>
: private IP ofnetwork interface __meta_yandexcloud_instance_public_ip_<interface index>
: public (NAT) IP ofnetwork interface __meta_yandexcloud_instance_private_dns_<record number>
: if configured DNS records for private IP__meta_yandexcloud_instance_public_dns_<record number>
: if configured DNS records for public IP
The list of discovered Yandex Cloud targets is refreshed at the interval, which can be configured via -promscrape.yandexcloudSDCheckInterval
command-line flag.
scrape_configs #
The scrape_configs
section at file pointed by -promscrape.config
command-line flag can contain supported service discovery options.
Additionally, it can contain the following options:
|
|
HTTP API client options #
The following additional options can be specified in the scrape_configs and in the majority of supported service discovery configs:
|
|