2022-03-11 11:39:25 +00:00
---
title: Getting Started
---
{{< toc > }}
2024-11-21 21:42:50 +00:00
## Prometheus User
To allow prometheus-pve-sd to access the Proxmox API, we recommend creating a dedicated user.
The minimum set of privileges for the user is as follows:
- `VM.Audit`
- `VM.Monitor`
Below are the commands to create the new user `prometheus-pve-sd@pve` and assign the necessary privileges:
```Shell
pveum role add prometheus-pve-sd-role --privs 'VM.Audit,VM.Monitor'
pveum user add prometheus-pve-sd@pve --password < password >
pveum aclmod / -user prometheus-pve-sd@pve -role prometheus-pve-sd-role
```
2022-03-11 11:39:25 +00:00
## Available Labels
The following list of meta labels can be used to relabel your scrape results:
`__meta_pve_ipv4`
: Discovered IPv4 address or `False` if not found. To discover the IP address either QEMU guest agent or a cloud-init configuration is required.
`__meta_pve_ipv6`
: Discovered IPv6 address or `False` if not found. To discover the IP address either QEMU guest agent or a cloud-init configuration is required.
`__meta_pve_name`
: Name of the node.
`__meta_pve_type`
: Node type, either `qemu` or `lxc` .
`__meta_pve_vmid`
: VMID of the node.
`__meta_pve_cpu`
: Current CPU load of the node.
`__meta_pve_cores`
: Assigned CPU cores for the node.
`__meta_pve_memory`
: Assigned RAM for the node.
`__meta_pve_status`
: Current state of the node.
`__meta_pve_tags`
: A comma-separated list of tags, as set on the node. The label is not getting exported if no tags were found. (Requires PVE 6+)
`__meta_pve_groups`
: Groups discovered from the `Notes` field of the node. Need to be a valid JSON string e.g. `{"groups":["group1","group2"]}` .
## Prometheus configuration
2022-03-11 12:37:19 +00:00
### File service discovery
2022-05-21 11:21:04 +00:00
Prometheus needs a basic file service discovery configuration to fetch system metrics from the host's discovered from PVE. Depending on the used metrics exporter the configuration need to be adjusted, using [Telegraf ](https://github.com/influxdata/telegraf/ ) a starter configuration might look like this:
2022-03-11 11:39:25 +00:00
```YAML
- file_sd_configs:
- files:
- /opt/prometheus/conf/file_sd/proxmox.json
job_name: telegraf-pve
metrics_path: /metrics
relabel_configs:
- replacement: ${1}:9273
source_labels:
- __meta_pve_name
target_label: __address__
- source_labels:
- __meta_pve_name
target_label: instance
```
2022-03-11 12:37:19 +00:00
### HTTP service discovery
2022-03-11 11:39:25 +00:00
2022-03-11 12:37:19 +00:00
If the static file is served by a web server, e.g. while using the [Prometheus Operator ](/setup/prometheus-operator/ ) setup, a HTTP service discovery configuration is required:
2022-03-11 11:39:25 +00:00
```YAML
2022-03-11 12:37:19 +00:00
- http_sd_configs:
2022-03-30 18:48:39 +00:00
- url: http://pve-sd-service:80/proxmox.json
2022-03-11 12:37:19 +00:00
job_name: telegraf-pve
metrics_path: /metrics
relabel_configs:
- replacement: ${1}:9273
source_labels:
- __meta_pve_name
target_label: __address__
- source_labels:
- __meta_pve_name
target_label: instance
2022-03-11 11:39:25 +00:00
```