Skip to content

Commit c60f29d

Browse files
committed
feat: Metric Servers management in Proxmox (tested in pve 7 only)
Signed-off-by: ThysTips <[email protected]>
1 parent 72130c0 commit c60f29d

File tree

5 files changed

+540
-0
lines changed

5 files changed

+540
-0
lines changed

README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,9 @@ of the `ops` group. Read the **User and ACL Management** section for more info.
218218
The backend needs to be supported by [Proxmox][pvesm]. Read the **Storage
219219
Management** section for more info.
220220

221+
`pve_metric_servers` allows you to configure a metric server for the PVE cluster.
222+
This is useful if you want to use InfluxDB, Graphite or other (with telegraf).
223+
221224
`pve_ssh_port` allows you to change the SSH port. If your SSH is listening on
222225
a port other than the default 22, please set this variable. If a new node is
223226
joining the cluster, the PVE cluster needs to communicate once via SSH.
@@ -420,6 +423,7 @@ pve_roles: [] # Added more roles with specific privileges. See section on User M
420423
pve_groups: [] # List of group definitions to manage in PVE. See section on User Management.
421424
pve_users: [] # List of user definitions to manage in PVE. See section on User Management.
422425
pve_storages: [] # List of storages to manage in PVE. See section on Storage Management.
426+
pve_metric_servers: [] # List of metric servers to configure in PVE.
423427
pve_datacenter_cfg: {} # Dictionary to configure the PVE datacenter.cfg config file.
424428
pve_domains_cfg: [] # List of realms to use as authentication sources in the PVE domains.cfg config file.
425429
pve_no_log: false # Set this to true in production to prevent leaking of storage credentials in run logs. (may be used in other tasks in the future)
@@ -835,6 +839,71 @@ Then system interrupt remapping is supported and you do not need to enable unsaf
835839

836840
`pve_pcie_report_msrs` can be used to enable or disable logging messages of msrs warnings. If you see a lot of warning messages in your 'dmesg' system log, this value can be used to silence msrs warnings.
837841

842+
## Metrics Server Configuration
843+
844+
You can configure metric servers in Proxmox VE using the `proxmox_metric_server` module. Below is an example configuration for different types of metric servers:
845+
846+
```yaml
847+
pve_metric_servers:
848+
- id: influxdb1
849+
port: 8086
850+
server: influxdb.example.com
851+
type: influxdb
852+
protocol: http
853+
organization: myorg
854+
bucket: mybucket
855+
token: mytoken
856+
disable: false
857+
timeout: 30
858+
max_body_size: 25000000
859+
verify_certificate: true
860+
- id: graphite1
861+
port: 2003
862+
server: graphite.example.com
863+
type: graphite
864+
protocol: tcp
865+
path: mygraphitepath
866+
disable: false
867+
mtu: 1500
868+
```
869+
870+
### Configuration Variables
871+
872+
- `id`: (required) Unique identifier for the metric server.
873+
- `port`: (optional) Port of the metric server. Default is `8089`.
874+
- `server`: (required) DNS name or IP address of the metric server.
875+
- `type`: (optional) Type of metric server. Possible values: `influxdb`, `graphite`. Default is `influxdb`.
876+
- `protocol`: (optional) Protocol used to send metrics. Possible values: `udp`, `tcp`, `http`, `https`. Default is `udp`.
877+
- `disable`: (optional) Disable the metric server. Default is `false`.
878+
- `organization`: (optional) Organization name. Available only for influxdb with the http v2 API.
879+
- `bucket`: (optional) Bucket name for influxdb. Useful only with the http v2 API or compatible.
880+
- `token`: (optional) InfluxDB access token. Required only when using the http v2 API.
881+
- `path`: (optional) Graphite root path. Available only for graphite.
882+
- `api_path_prefix`: (optional) API path prefix inserted between `<host>:<port>/` and `/api2/`. Useful if the InfluxDB service is running behind a reverse proxy. Available only for influxdb with the http v2 API.
883+
- `timeout`: (optional) Timeout in seconds. Available only for influxdb with the http v2 API or Graphite TCP socket.
884+
- `max_body_size`: (optional) Maximum body size in bytes. Available only for influxdb with the http v2 API. Default is `25000000`.
885+
- `mtu`: (optional) MTU for UDP metric transmission.
886+
- `verify_certificate`: (optional) Verify SSL certificate. Available only for influxdb with https.
887+
888+
### Example Configuration
889+
890+
Here is an example configuration to create a new InfluxDB metric server:
891+
892+
```yaml
893+
- name: Create a new InfluxDB metric server
894+
proxmox_metric_server:
895+
id: "influxdb"
896+
port: 8086
897+
server: "influxdb.example.com"
898+
type: "influxdb"
899+
protocol: "http"
900+
organization: "myorg"
901+
bucket: "mybucket"
902+
token: "mytoken"
903+
```
904+
905+
For more information, refer to the Proxmox VE API documentation: [Proxmox VE API Viewer](https://pve.proxmox.com/pve-docs/api-viewer/index.html#/cluster/metrics/server/{id}).
906+
838907
## Developer Notes
839908

840909
When developing new features or fixing something in this role, you can test out

defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ pve_groups: []
5656
pve_users: []
5757
pve_acls: []
5858
pve_storages: []
59+
pve_metric_servers: []
5960
pve_ssh_port: 22
6061
pve_manage_ssh: true
6162
pve_hooks: {}

0 commit comments

Comments
 (0)