Project: VictoriaMetrics (Observability and Analysis / Observability)
File: sd_configs.md

sort: 36 weight: 36 title: Prometheus service discovery menu: docs: parent: 'victoriametrics' weight: 36 aliases: /sd_configs.html and supports the following Prometheus-compatible service discovery options for Prometheus-compatible scrape targets in the file pointed by `-promscrape.config` command-line flag: `azuresdconfigs` is for scraping the targets registered in . See . `consulsdconfigs` is for discovering and scraping targets registered in . See . `consulagentsdconfigs` is for discovering and scraping targets registered in . See . `digitaloceansdconfigs` is for discovering and scraping targets registered in . See . `dnssdconfigs` is for discovering and scraping targets from records (SRV, A and AAAA). See . `dockersdconfigs` is for discovering and scraping targets. See . `dockerswarmsdconfigs` is for discovering and scraping targets. See . `ec2sdconfigs` is for discovering and scraping targets. See . `eurekasdconfigs` is for discovering and scraping targets registered in . See . `filesdconfigs` is for scraping targets defined in external files (aka file-based service discovery). See . `gcesdconfigs` is for discovering and scraping targets. See . `hetznersdconfigs` is for discovering and scraping and targets. See . `httpsdconfigs` is for discovering and scraping targets provided by external http-based service discovery. See . `kubernetessdconfigs` is for discovering and scraping targets. See . `kumasdconfigs` is for discovering and scraping targets. See . `nomadsdconfigs` is for discovering and scraping targets registered in . See . `openstacksdconfigs` is for discovering and scraping OpenStack targets. See . `static_configs` is for scraping statically defined targets. See . `vultrsdconfigs` is for discovering and scraping targets. See . `yandexcloudsdconfigs` is for discovering and scraping targets. See . 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 `refreshinterval` for all the `consulsd_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 if you need other service discovery mechanisms to be supported by VictoriaMetrics and `vmagent`. Azure SD configuration discovers scrape targets from VMs. Configuration example: ```yaml scrape_configs: job_name: azure azuresdconfigs: subscription_id: "..." ``` Each discovered target has an label set to `<privateip>:<port>`, where `<privateip>` is the machine's private IP and the `<port>` is the `port` option specified in the `azuresdconfigs`. The following meta labels are available on discovered targets during : `metaazuremachine_id`: the machine ID `metaazuremachine_location`: the location the machine runs in `metaazuremachine_name`: the machine name `metaazuremachinecomputername`: the machine computer name `metaazuremachineostype`: the machine operating system `metaazuremachineprivateip`: the machine's private IP `metaazuremachinepublicip`: the machine's public IP if it exists `metaazuremachineresourcegroup`: the machine's resource group `metaazuremachinescaleset`: the name of the scale set which the vm is part of (this value is only set if you are using a scale set) `metaazuremachine_size`: the machine size `metaazuremachinetag<tagname>`: each tag value of the machine `metaazuresubscription_id`: the subscription ID `metaazuretenant_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 configuration allows retrieving scrape targets from . Configuration example: ```yaml scrape_configs: job_name: consul consulsdconfigs: server: "localhost:8500" ``` Each discovered target has an label set to `<serviceornodeaddr>:<serviceport>`, where `<serviceornode_addr>` is the service address. If the service address is empty, then the node address is used instead. The `<service_port>` is the service

The following meta labels are available on discovered targets during : `metaconsuladdress`: the address of the target `metaconsuldc`: the datacenter name for the target `metaconsulhealth`: the health status of the service `metaconsulmetadata_<key>`: each node metadata key value of the target `metaconsulnamespace`: namespace of the service - see `metaconsulnode`: the node name defined for the target `metaconsulpartition`: partition of the service - see `metaconsulservice_address`: the service address of the target `metaconsulservice_id`: the service ID of the target `metaconsulservicemetadata<key>`: each service metadata key value of the target `metaconsulservice_port`: the service port of the target `metaconsulservice`: the name of the service the target belongs to `metaconsultaggedaddress<key>`: each node tagged address key value of the target `metaconsultag_<tagname>`: the value for the given <tagname> tag of the target `metaconsultagpresent_<tagname>`: "true" for every <tagname> tag of the target `metaconsultags`: the list of tags of the target joined by the `tag_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 `consulsdconfigs` on a large cluster, then consider using instead. Consul Agent SD configuration allows retrieving scrape targets from . 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 would be too slow or resource intensive, in other cases it is recommended to use . Configuration example: ```yaml scrape_configs: job_name: consulagent consulagentsdconfigs: server: "localhost:8500" ``` Each discovered target has an label set to `<serviceornodeaddr>:<serviceport>`, where `<serviceornode_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 : `metaconsulagentaddress`: the address of the target `metaconsulagentdc`: the datacenter name for the target `metaconsulagenthealth`: the health status of the service `metaconsulagentmetadata_<key>`: each node metadata key value of the target `metaconsulagentnamespace`: namespace of the service - see `metaconsulagentnode`: the node name defined for the target `metaconsulagentservice_address`: the service address of the target `metaconsulagentservice_id`: the service ID of the target `metaconsulagentservicemetadata<key>`: each service metadata key value of the target `metaconsulagentservice_port`: the service port of the target `metaconsulagentservice`: the name of the service the target belongs to `metaconsulagenttaggedaddress<key>`: each node tagged address key value of the target `metaconsulagenttag_<tagname>`: the value for the given <tagname> tag of the target `metaconsulagenttagpresent_<tagname>`: "true" for every <tagname> tag of the target `metaconsulagenttags`: the list of tags of the target joined by the `tag_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 configuration allows retrieving scrape targets from . Configuration example: ```yaml scrape_configs: job_name: digitalocean digitaloceansdconfigs: server: "https://api.digitalocean.com" ``` Each discovered target has an label set to `<publicip>:<port>`, where `<publicip>` is a public ipv4 address of the droplet, while `<port>` is the port specified in the

The following meta labels are available on discovered targets during : `metadigitaloceandroplet_id`: the id of the droplet `metadigitaloceandroplet_name`: the name of the droplet `metadigitaloceanimage`: the slug of the droplet's image `metadigitaloceanimage_name`: the display name of the droplet's image `metadigitaloceanprivate_ipv4`: the private IPv4 of the droplet `metadigitaloceanpublic_ipv4`: the public IPv4 of the droplet `metadigitaloceanpublic_ipv6`: the public IPv6 of the droplet `metadigitaloceanregion`: the region of the droplet `metadigitaloceansize`: the size of the droplet `metadigitaloceanstatus`: the status of the droplet `metadigitaloceanfeatures`: the comma-separated list of features of the droplet `metadigitaloceantags`: the comma-separated list of tags of the droplet `metadigitaloceanvpc`: 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-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: ```yaml scrape_configs: job_name: dns dnssdconfigs: names: ["...", "..."] ``` Each discovered target has an 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 `dnssdconfig`. The following meta labels are available on discovered targets during : `metadnsname`: the record name that produced the discovered target. `metadnssrvrecordtarget`: the target field of the SRV record `metadnssrvrecordport`: the port field of the SRV record `metadnsmxrecordtarget`: 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 configuration allows retrieving scrape targets from hosts. Configuration example: ```yaml scrape_configs: job_name: docker dockersdconfigs: host: "..." ``` Each discovered target has an label set to `<ipaddress>:<port>`, where `<ipaddress>` 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 `dockersdconfigs` 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 : `metadockercontainer_id`: the id of the container `metadockercontainer_name`: the name of the container `metadockercontainernetworkmode`: the network mode of the container `metadockercontainerlabel<labelname>`: each label of the container `metadockernetwork_id`: the ID of the network `metadockernetwork_name`: the name of the network `metadockernetwork_ingress`: whether the network is ingress `metadockernetwork_internal`: whether the network is internal `metadockernetworklabel<labelname>`: each label of the network `metadockernetwork_scope`: the scope of the network `metadockernetwork_ip`: the IP of the container in this network `metadockerport_private`: the port on the container `metadockerport_public`: the external port if a port-mapping exists `metadockerportpublicip`: 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. Docker Swarm SD configuration allows retrieving scrape targets from . Configuration example: ```yaml scrape_configs: job_name: dockerswarm dockerswarmsdconfigs: host: "..." role: ... ``` 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 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 the `port` value obtained from

Available meta labels for `role: services` during : `metadockerswarmservice_id`: the id of the service `metadockerswarmservice_name`: the name of the service `metadockerswarmservice_mode`: the mode of the service `metadockerswarmserviceendpointport_name`: the name of the endpoint port, if available `metadockerswarmserviceendpointportpublishmode`: the publishing mode of the endpoint port `metadockerswarmservicelabel<labelname>`: each label of the service `metadockerswarmservicetaskcontainer_hostname`: the container hostname of the target, if available `metadockerswarmservicetaskcontainer_image`: the container image of the target `metadockerswarmserviceupdatingstatus`: the status of the service, if available `metadockerswarmnetwork_id`: the ID of the network `metadockerswarmnetwork_name`: the name of the network `metadockerswarmnetwork_ingress`: whether the network is ingress `metadockerswarmnetwork_internal`: whether the network is internal `metadockerswarmnetworklabel<labelname>`: each label of the network `metadockerswarmnetwork_scope`: the scope of the network `role: tasks` The `tasks` role discovers all Swarm tasks. Each discovered target has an 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 the `port` value obtained from `dockerswarmsdconfigs`. Available meta labels for `role: tasks` during : `metadockerswarmcontainerlabel<labelname>`: each label of the container `metadockerswarmtask_id`: the id of the task `metadockerswarmtaskcontainerid`: the container id of the task `metadockerswarmtaskdesiredstate`: the desired state of the task `metadockerswarmtask_slot`: the slot of the task `metadockerswarmtask_state`: the state of the task `metadockerswarmtaskportpublish_mode`: the publishing mode of the task port `metadockerswarmservice_id`: the id of the service `metadockerswarmservice_name`: the name of the service `metadockerswarmservice_mode`: the mode of the service `metadockerswarmservicelabel<labelname>`: each label of the service `metadockerswarmnetwork_id`: the ID of the network `metadockerswarmnetwork_name`: the name of the network `metadockerswarmnetwork_ingress`: whether the network is ingress `metadockerswarmnetwork_internal`: whether the network is internal `metadockerswarmnetworklabel<labelname>`: each label of the network `metadockerswarmnetwork_label`: each label of the network `metadockerswarmnetwork_scope`: the scope of the network `metadockerswarmnode_id`: the ID of the node `metadockerswarmnode_hostname`: the hostname of the node `metadockerswarmnode_address`: the address of the node `metadockerswarmnode_availability`: the availability of the node `metadockerswarmnodelabel<labelname>`: each label of the node `metadockerswarmnodeplatformarchitecture`: the architecture of the node `metadockerswarmnodeplatformos`: the operating system of the node `metadockerswarmnode_role`: the role of the node `metadockerswarmnode_status`: the status of the node The `metadockerswarmnetwork_*` meta labels are not populated for ports which are published with `mode=host`. `role: nodes` The `nodes` role is used to discover Swarm nodes. Each discovered target has an label set to `<ip>:<port>`, where `<ip>` is the node IP, while the `<port>` is the `port` value obtained from the `dockerswarmsdconfigs`. Available meta labels for `role: nodes` during : `metadockerswarmnode_address`: the address of the node `metadockerswarmnode_availability`: the availability of the node `metadockerswarmnodeengineversion`: the version of the node engine `metadockerswarmnode_hostname`: the hostname of the node `metadockerswarmnode_id`: the ID of the node `metadockerswarmnodelabel<labelname>`: each label of the node `metadockerswarmnodemanageraddress`: the address of the manager component of the node `metadockerswarmnodemanagerleader`: the leadership status of the manager component of the node (true or false) `metadockerswarmnodemanagerreachability`: the reachability of the manager component of the node `metadockerswarmnodeplatformarchitecture`: the architecture of the node `metadockerswarmnodeplatformos`: the operating system of the node `metadockerswarmnode_role`: the role of the node `metadockerswarmnode_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 configuration allows retrieving scrape targets from . Configuration example: ```yaml scrape_configs: job_name: ec2 ec2sdconfigs: region: "..." ``` Each discovered target has an label set to `<instanceip>:<port>`, where `<instanceip>` is the private IP of the instance, while the `<port>` is set to the `port` value obtain from

The following meta labels are available on discovered targets during : `metaec2ami`: the EC2 Amazon Machine Image `metaec2architecture`: the architecture of the instance `metaec2availability_zone`: the availability zone in which the instance is running `metaec2availabilityzoneid`: the availability zone ID in which the instance is running (requires ec2:DescribeAvailabilityZones) `metaec2instance_id`: the EC2 instance ID `metaec2instance_lifecycle`: the lifecycle of the EC2 instance, set only for 'spot' or 'scheduled' instances, absent otherwise `metaec2instance_state`: the state of the EC2 instance `metaec2instance_type`: the type of the EC2 instance `metaec2ipv6_addresses`: comma separated list of IPv6 addresses assigned to the instance's network interfaces, if present `metaec2owner_id`: the ID of the AWS account that owns the EC2 instance `metaec2platform`: the Operating System platform, set to 'windows' on Windows servers, absent otherwise `metaec2primarysubnetid`: the subnet ID of the primary network interface, if available `metaec2privatednsname`: the private DNS name of the instance, if available `metaec2private_ip`: the private IP address of the instance, if present `metaec2publicdnsname`: the public DNS name of the instance, if available `metaec2public_ip`: the public IP address of the instance, if available `metaec2region`: EC2 region for the discovered instance `metaec2subnet_id`: comma separated list of subnets IDs in which the instance is running, if available `metaec2tag_<tagkey>`: each tag value of the instance `metaec2vpc_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 configuration allows retrieving scrape targets using the . Configuration example: ```yaml scrape_configs: job_name: eureka eurekasdconfigs: server: "..." ``` Each discovered target has an label set to `<instancehost>:<instanceport>`, where `<instancehost>` is the discovered instance hostname, while the `<instanceport>` 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 : `metaeurekaapp_name`: the name of the app `metaeurekaappinstanceid`: the ID of the app instance `metaeurekaappinstancehostname`: the hostname of the instance `metaeurekaappinstancehomepage_url`: the homepage url of the app instance `metaeurekaappinstancestatuspage_url`: the status page url of the app instance `metaeurekaappinstancehealthcheck_url`: the health check url of the app instance `metaeurekaappinstanceip_addr`: the IP address of the app instance `metaeurekaappinstancevip_address`: the VIP address of the app instance `metaeurekaappinstancesecurevipaddress`: the secure VIP address of the app instance `metaeurekaappinstancestatus`: the status of the app instance `metaeurekaappinstanceport`: the port of the app instance `metaeurekaappinstanceport_enabled`: the port enabled of the app instance `metaeurekaappinstancesecure_port`: the secure port address of the app instance `metaeurekaappinstancesecureportenabled`: the secure port of the app instance `metaeurekaappinstancecountry_id`: the country ID of the app instance `metaeurekaappinstancemetadata_<metadataname>`: app instance metadata `metaeurekaappinstancedatacenterinfo_name`: the datacenter name of the app instance `metaeurekaappinstancedatacenterinfometadata<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-based service discovery reads a set of files with lists of targets to scrape. Configuration example: ```yaml scrape_configs: job_name: file filesdconfigs: files: "my/path/*.yaml" "another/path.json" "http://central-config-server/targets?type=foobar" ``` See 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: ```json [ { "targets": ["<host>", ... ], "labels": { "<labelname>": "<labelvalue>", ..., } }, ... ] ``` YAML: ```yaml targets: ["<host>", ... ] labels: <labelname>: <labelvalue> ... ... ``` Each discovered target has an label set to one of the `target` value specified in the target files. The following meta labels are available on discovered targets during : `meta_filepath`: the filepath from which the target was extracted See the with `filesdconfigs`. The list of discovered file-based targets is refreshed at the interval, which can be configured via `-promscrape.fileSDCheckInterval` command-line flag. GCE SD configuration allows retrieving scrape targets from . Configuration example: ```yaml scrape_configs: job_name: gce gcesdconfigs: project: "..." ``` Credentials are discovered by looking in the following places, preferring the first location found: a JSON file specified by the `GOOGLEAPPLICATIONCREDENTIALS` environment variable a JSON file in the well-known path

fetched from the GCE metadata server Each discovered target has an label set to `<ifaceip>:<port>`, where `<ifaceip>` is private IP of the discovered instance, while `<port>` is the `port` value specified in the `gcesdconfigs`. The following meta labels are available on discovered targets during : `metagceinstance_id`: the numeric id of the instance `metagceinstance_name`: the name of the instance `metagcelabel_<labelname>`: each GCE label of the instance `metagcemachine_type`: full or partial URL of the machine type of the instance `metagcemetadata_<name>`: each metadata item of the instance `metagcenetwork`: the network URL of the instance `metagceprivate_ip`: the private IP address of the instance `metagceinterfaceipv4<name>`: IPv4 address of each named interface `metagceproject`: the GCP project in which the instance is running `metagcepublic_ip`: the public IP address of the instance, if present `metagcesubnetwork`: the subnetwork URL of the instance `metagcetags`: list of instance tags separated by tag_separator `metagcezone`: 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 configuration allows retrieving scrape targets from and . Configuration example: ```yaml scrape_configs: job_name: hetzner hetznersdconfigs: role: "hcloud" authorization: credentials: "..." ``` Each discovered target has an label set to `<FQDN>:<port>`, where FQDN is discovered instance address and `<port>` is the port from the `hetznersdconfigs` (default port is `80`). The following meta labels are available on discovered targets during : Common labels for both `hcloud` and `robot` roles: `metahetznerdatacenter`: the datacenter of the server `metahetznerpublic_ipv4`: the public IPv4 address of the server `metahetznerpublicipv6network`: the public IPv6 network (/64) of the server `metahetznerrole`: the current role `hcloud` or `robot` `metahetznerserver_id`: the ID of the server `metahetznerserver_name`: the name of the server `metahetznerserver_status`: the status of the server Additional labels for `role: hcloud`: `metahetznerhclouddatacenterlocation`: the location of the server `metahetznerhclouddatacenterlocationnetworkzone`: the network zone of the server `metahetznerhcloudcpucores`: the CPU cores count of the server `metahetznerhcloudcputype`: the CPU type of the server (shared or dedicated) `metahetznerhclouddisksize_gb`: the disk size of the server (in GB) `metahetznerhcloudimagedescription`: the description of the server image `metahetznerhcloudimagename`: the image name of the server `metahetznerhcloudimageos_flavor`: the OS flavor of the server image `metahetznerhcloudimageos_version`: the OS version of the server image `metahetznerhcloudlabel<labelname>`: each label of the server `metahetznerhcloudlabelpresent<labelname>`: true for each label of the server `metahetznerhcloudmemorysize_gb`: the amount of memory of the server (in GB) `metahetznerhcloudprivateipv4_<networkname>`: the private IPv4 address of the server within a given network `metahetznerhcloudservertype`: the type of the server Additional labels for `role: robot`: `metahetznerrobot_cancelled`: the server cancellation status `metahetznerrobot_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-based service discovery fetches targets from the specified `url`. Configuration example: ```yaml scrape_configs: job_name: http httpsdconfigs: url: "http://..." ``` See on how to configure http-based target discovery. The service at `url` must return JSON response in the following format: ```json [ { "targets": [ "<host>", ... ], "labels": { "<labelname>": "<labelvalue>", ... } }, ... ] ``` The `url` is queried periodically with the interval specified in `-promscrape.httpSDCheckInterval` command-line flag. Discovery errors are tracked in `promscrapediscoveryhttperrorstotal` metric. Each discovered target has an label set to one of the targets returned by the http

The following meta labels are available on discovered targets during : `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 configuration allows retrieving scrape targets from . Configuration example: ```yaml scrape_configs: job_name: kubernetes kubernetessdconfigs: role: "..." ``` See 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 label set to `<ip>:<port>`, where `<ip>` is to the first existing address of the Kubernetes node object in the address type order of `NodeInternalIP`, `NodeExternalIP`, `NodeLegacyHostIP` and `NodeHostName`, while `<port>` is the kubelet port on the given node. Available meta labels for `role: node` during : `metakubernetesnode_name`: The name of the node object. `metakubernetesnodeproviderid`: The cloud provider's name for the node object. `metakubernetesnodelabel<labelname>`: Each label from the node object. `metakubernetesnodelabelpresent<labelname>`: "true" for each label from the node object. `metakubernetesnodeannotation<annotationname>`: Each annotation from the node object. `metakubernetesnodeannotationpresent<annotationname>`: "true" for each annotation from the node object. `metakubernetesnodeaddress<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 label set to `<servicename>.<namespace>:<port>`, where `<servicename>` 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 : `metakubernetesnamespace`: The namespace of the service object. `metakubernetesserviceannotation<annotationname>`: Each annotation from the service object. `metakubernetesserviceannotationpresent<annotationname>`: "true" for each annotation of the service object. `metakubernetesserviceclusterip`: The cluster IP address of the service. (Does not apply to services of type ExternalName) `metakubernetesserviceexternalname`: The DNS name of the service. (Applies to services of type ExternalName) `metakubernetesservicelabel<labelname>`: Each label from the service object. `metakubernetesservicelabelpresent<labelname>`: "true" for each label of the service object. `metakubernetesservice_name`: The name of the service object. `metakubernetesserviceportname`: Name of the service port for the target. `metakubernetesserviceportnumber`: Service port number for the target. `metakubernetesserviceportprotocol`: Protocol of the service port for the target. `metakubernetesservice_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 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 : `metakubernetesnamespace`: The namespace of the pod object. `metakubernetespod_name`: The name of the pod object. `metakubernetespod_ip`: The pod IP of the pod object. `metakubernetespodlabel<labelname>`: Each label from the pod object. `metakubernetespodlabelpresent<labelname>`: "true" for each label from the pod object. `metakubernetespodannotation<annotationname>`: Each annotation from the pod object. `metakubernetespodannotationpresent<annotationname>`: "true" for each annotation from the pod object. `metakubernetespodcontainerid`: ID of the container in the form `<type>://<container_id>`. `metakubernetespodcontainerimage`: Container image the target address points to. `metakubernetespodcontainerinit`: "true" if the container is an InitContainer. `metakubernetespodcontainername`: Name of the container the target address points to. `metakubernetespodcontainerport_name`: Name of the container

`metakubernetespodcontainerport_number`: Number of the container port. `metakubernetespodcontainerport_protocol`: Protocol of the container port. `metakubernetespod_ready`: Set to true or false for the pod's ready state. `metakubernetespod_phase`: Set to Pending, Running, Succeeded, Failed or Unknown in the lifecycle. `metakubernetespodnodename`: The name of the node the pod is scheduled onto. `metakubernetespodhostip`: The current host IP of the pod object. `metakubernetespod_uid`: The UID of the pod object. `metakubernetespodcontrollerkind`: Object kind of the pod controller. `metakubernetespodcontrollername`: Name of the pod controller. `role: endpoints` The `role: endpoints` discovers targets from listed endpoints of a service. Each discovered target has an 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 : `metakubernetesnamespace`: The namespace of the endpoints object. `metakubernetesendpoints_name`: The names of the endpoints object. `metakubernetesendpointslabel<labelname>`: Each label from the endpoints object. `metakubernetesendpointslabelpresent<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: `metakubernetesendpoint_hostname`: Hostname of the endpoint. `metakubernetesendpointnodename`: Name of the node hosting the endpoint. `metakubernetesendpoint_ready`: Set to true or false for the endpoint's ready state. `metakubernetesendpointportname`: Name of the endpoint port. `metakubernetesendpointportprotocol`: Protocol of the endpoint port. `metakubernetesendpointaddresstarget_kind`: Kind of the endpoint address target. `metakubernetesendpointaddresstarget_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 the `role: pod` are attached. `role: endpointslice` The `role: endpointslice` discovers targets from existing endpointslices. Each discovered target has an 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 : `metakubernetesnamespace`: The namespace of the endpointslice object. `metakubernetesendpointslice_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: `metakubernetesendpointsliceaddresstarget_kind`: Kind of the referenced object. `metakubernetesendpointsliceaddresstarget_name`: Name of referenced object. `metakubernetesendpointsliceaddresstype`: The ip protocol family of the address of the target. `metakubernetesendpointsliceendpointconditions_ready`: Set to true or false for the referenced endpoint's ready state. `metakubernetesendpointsliceendpointtopologykubernetesio_hostname`: Name of the node hosting the referenced endpoint. `metakubernetesendpointsliceendpointtopologypresentkubernetesiohostname`: Flag that shows if the referenced object has a kubernetes.io/hostname annotation. `metakubernetesendpointslice_port`: Port of the referenced endpoint. `metakubernetesendpointsliceportname`: Named port of the referenced endpoint. `metakubernetesendpointsliceportprotocol`: 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 the `role: pod` are attached. `role: ingress` The `role: ingress` discovers a target for each path of each ingress. Each discovered target has an 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

Available meta labels for `role: ingress` during : `metakubernetesnamespace`: The namespace of the ingress object. `metakubernetesingress_name`: The name of the ingress object. `metakubernetesingresslabel<labelname>`: Each label from the ingress object. `metakubernetesingresslabelpresent<labelname>`: "true" for each label from the ingress object. `metakubernetesingressannotation<annotationname>`: Each annotation from the ingress object. `metakubernetesingressannotationpresent<annotationname>`: "true" for each annotation from the ingress object. `metakubernetesingressclassname`: Class name from ingress spec, if present. `metakubernetesingress_scheme`: Protocol scheme of ingress, https if TLS config is set. Defaults to http. `metakubernetesingress_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 service discovery config allows to fetch targets from the specified control plane `server` of . It discovers "monitoring assignments" based on Kuma Dataplane Proxies, via the . Configuration example: ```yaml scrape_configs: job_name: kuma kumasdconfigs: server: "http://localhost:5676" ``` The `server` is queried periodically with the interval specified in `-promscrape.kumaSDCheckInterval` command-line flag. Discovery errors are tracked in `promscrapediscoverykumaerrorstotal` metric. Each discovered target has an label set to one of the targets returned by the http service. The following meta labels are available on discovered targets during : `metakumamesh`: the name of the mesh `metakumadataplane`: the name of the proxy `metakumaservice`: the name of the service associated with the proxy `metakumalabel<labelname>`: 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. Nomad SD configuration allows retrieving scrape targets from . Configuration example: ```yaml scrape_configs: job_name: nomad nomadsdconfigs: server: "localhost:4646" ``` Each discovered target has an 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 : `metanomadaddress`: the address of the target `metanomaddc`: the datacenter name for the target `metanomadnamespace`: namespace of the service `metanomadnode_id`: the node ID defined for the target `metanomadservice`: the name of the service the target belongs to `metanomadservice_address`: the service address of the target `metanomadserviceallocid`: the AllocID of the target service `metanomadservice_id`: the ID of the target service `metanomadservicejobid`: the JobID of the target service `metanomadservice_port`: the service port of the target `metanomadtag_<tagname>`: the value for the given <tagname> tag of the target `metanomadtagpresent_<tagname>`: "true" for every <tagname> tag of the target `metanomadtags`: the list of tags of the target joined by the `tag_separator` The list of discovered Nomad targets is refreshed at the interval, which can be configured via `-promscrape.nomadSDCheckInterval` command-line flag. OpenStack SD configuration allows retrieving scrape targets from instances. is supported only. Configuration example: ```yaml scrape_configs: job_name: openstack openstacksdconfigs: role: "..." region: "..." ``` 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 label set to `<host>:<port>`, where `<host>` is the discovered node IP, while `<port>` is the port specified in the `openstacksdconfigs`. The following meta labels are available on discovered targets during : `metaopenstackhypervisorhostip`: the hypervisor node's IP address. `metaopenstackhypervisor_hostname`: the hypervisor node's name. `metaopenstackhypervisor_id`: the hypervisor node's ID. `metaopenstackhypervisor_state`: the hypervisor node's state. `metaopenstackhypervisor_status`: the hypervisor node's status. `metaopenstackhypervisor_type`: the hypervisor node's type. `role: instance` The `role: instance` discovers one target per network interface of Nova

Each discovered target has an label set to `<host>:<port>`, where `<host>` is the private IP address of the discovered instance, while `<port>` is the port specified in the `openstacksdconfigs`. The following meta labels are available on discovered targets during : `metaopenstackaddress_pool`: the pool of the private IP. `metaopenstackinstance_flavor`: the flavor of the OpenStack instance. `metaopenstackinstance_id`: the OpenStack instance ID. `metaopenstackinstance_name`: the OpenStack instance name. `metaopenstackinstance_status`: the status of the OpenStack instance. `metaopenstackprivate_ip`: the private IP of the OpenStack instance. `metaopenstackproject_id`: the project (tenant) owning this instance. `metaopenstackpublic_ip`: the public IP of the OpenStack instance. `metaopenstacktag_<tagkey>`: each tag value of the instance. `metaopenstackuser_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. A static config allows specifying a list of targets and a common label set for them. Configuration example: ```yaml scrape_configs: job_name: static static_configs: targets: "vmsingle1:8428" "vmsingleN:8428" ``` See on how to configure scraping for static targets. Vultr SD configuration discovers scrape targets from Instances. Configuration example: ```yaml scrape_configs: job_name: vultr vultrsdconfigs: bearer_token: "..." ``` Each discovered target has an label set to `<FQDN>:<port>`, where FQDN is discovered instance address and `<port>` is the port from the `vultrsdconfigs` (default port is `80`). The following meta labels are available on discovered targets during : `metavultrinstance_id`: A unique ID for the VPS Instance. `metavultrinstance_label`: The user-supplied label for this instance. `metavultrinstance_os`: The . `metavultrinstanceosid`: The used by this instance. `metavultrinstance_region`: The where the Instance is located. `metavultrinstance_plan`: A unique ID for the Plan. `metavultrinstancemainip`: The main IPv4 address. `metavultrinstanceinternalip`: The internal IP used by this instance, if set. Only relevant when a VPC is attached. `metavultrinstancemainipv6`: The main IPv6 network address. `metavultrinstance_hostname`: The hostname for this instance. `metavultrinstanceserverstatus`: The server health status, which could be `none`, `locked`, `installingbooting`, `ok`. `metavultrinstancevcpucount`: Number of vCPUs. `metavultrinstancerammb`: The amount of RAM in MB. `metavultrinstanceallowedbandwidth_gb`: Monthly bandwidth quota in GB. `metavultrinstancediskgb`: The size of the disk in GB. `metavultrinstancefeatures`: "autobackups", "ipv6", "ddos_protection". `metavultrinstance_tags`: Tags to apply to the instance. The list of discovered Vultr targets is refreshed at the interval, which can be configured via `-promscrape.vultrSDCheckInterval` command-line flag, default: 30s. SD configurations allow retrieving scrape targets from accessible folders. Configuration example: ```yaml scrape_configs: job_name: yandexcloud yandexcloudsdconfigs: service: compute ``` Yandex Cloud SD support both user and if `yandexpassportoauth_token` is omitted: ```yaml scrape_configs: jobname: YCwith_oauth yandexcloudsdconfigs: service: compute yandexpassportoauth_token: "AQAAAAAsfasah<...>7E10SaotuL0" relabel_configs: sourcelabels: [metayandexcloudinstancepublicip0] targetlabel: address_ replacement: "$1:9100" jobname: YCwithInstanceservice_account yandexcloudsdconfigs: service: compute relabel_configs: sourcelabels: [metayandexcloudinstanceprivateip0] targetlabel: address_ replacement: "$1:9100" ``` Each discovered target has an label set to the FQDN of the discovered instance. The following meta labels are available on discovered targets during : `metayandexcloudinstance_name`: the name of instance `metayandexcloudinstance_id`: the id of instance `metayandexcloudinstance_fqdn`: generated FQDN for instance `metayandexcloudinstance_status`: the status of instance `metayandexcloudinstanceplatformid`: instance platform ID (i.e. "standard-v3") `metayandexcloudinstanceresourcescores`: instance vCPU cores `metayandexcloudinstanceresourcescore_fraction`: instance core fraction `metayandexcloudinstanceresourcesmemory`: instance memory `metayandexcloudfolder_id`: instance folder ID `metayandexcloudinstancelabel<label name>`: each label from instance `metayandexcloudinstanceprivateip_<interface index>`: private IP of <interface index> network interface `metayandexcloudinstancepublicip_<interface index>`: public (NAT) IP of <interface index> network interface `metayandexcloudinstanceprivatedns_<record number>`: if configured DNS records for private IP `metayandexcloudinstancepublicdns_<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. The `scrape_configs` section at file pointed by `-promscrape.config` command-line flag can contain . Additionally, it can contain the following options: ```yaml scrape_configs: job_name: "..." ``` The following additional options can be specified in the and in the majority of : ```yaml ```