PBS InfluxDB2/Grafana External Metric Server

tcabernoch

Well-Known Member
Apr 27, 2024
515
199
53
Portland, OR
www.gnetsys.net
My boss had me setup the Proxmox Metric Server feature to see if that would help provide backup reports to client.

Spoiler alert: No.
PBS External Metric Server feature does not provide Backup reporting info.

(Any suggestions for providing backup reports are appreciated.)

The PBS manual is pretty clear about this.
"Proxmox Backup Server periodically sends various metrics about your host's memory, network and disk activity to configured external metric servers."
And that's what I see: memory, network and disk activity
No backup info.

I am not an expert on this. If someone points out glaring omissions or errors, I'll update this post.
With that said, here's how to configure PBS InfluxDB2/Grafana External Metric Server.
(Covers PVE as well.)

-----------------

References.

These directions are adapted from a Starwind article that has fallen out of date.
Check out the article. Its got some nice screenshots and slightly bad advice.
https://www.starwindsoftware.com/blog/proxmox-monitoring-influxdb-grafana/

This appears (as of this writing) to be out of date for PVE 9.x.
https://pve.proxmox.com/wiki/External_Metric_Server

The PBS manual has 4 sentences about how to do this.
https://<PBS_IP_Address>:8007/docs/sysadmin.html#influxdb-http-plugin-configuration

-----------------

Setup an Ubuntu VM.
You don't need any desktop software. You can use the Server install.

-----------------

Install InfluxDB.

***If these repo directions get out of date, check here for current info: https://repos.influxdata.com/ubuntu

Download the key.
wget -q https://repos.influxdata.com/influxdata-archive.key

Run this in the same directory where you put the key.
gpg --show-keys --with-fingerprint --with-colons ./influxdata-archive.key 2>&1 | grep -q '^fpr:\+24C975CBA61A024EE1B631787C3D57159FC2F927:$' && cat influxdata-archive.key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/influxdata-archive.gpg > /dev/null

Add the repo.
echo 'deb [signed-by=/etc/apt/trusted.gpg.d/influxdata-archive.gpg] https://repos.influxdata.com/debian stable main' | tee /etc/apt/sources.list.d/influxdata.list

Install.
apt install influxdb2
systemctl start influxdb
systemctl enable influxdb

-----------------

Configure InfluxDB

http://<InfluxDB2_IP_Address>:8086.
Click Get Started.

Create an initial Username.
Organization Name and Bucket Name can just be 'proxmox'.
When finished, click Continue.

Copy the API token. You only get one chance to do this. Record it somewhere.

-----------------

Connect Proxmox VE to InfluxDB.

In your Proxmox web interface, select your cluster. Navigate to Metric Server, click Add, and choose InfluxDB.

Name - whatever you named your InfluxDB2 server.
IP - address or hostname (if you have DNS)
Port - 8086
Protocol - HTTP ***SET THIS FIRST. The rest of the form changes.

Enter the Organization and Bucket names you configured earlier in InfluxDB2.
Paste the token you copied.
Click Create.

Back to the InfluxDB2 web interface and refresh the page.
If you did all this in turn, it may still say "Initial User is already set up."
Click Return to Home Page.
Click on Data Explorer icon.

At the bottom you will see the bucket created earlier.
Select the created bucket and you should see metrics to monitor.
(If you DON'T see them, Influx is not talking to Proxmox. Go back and check settings.)

-----------------

Connect Proxmox Backup Server to InfluxDB2.

Of course, the PBS Metric Server configuration interface is completely different from PVE.
It also provides a disappointingly small amount of info.
PBS Metric Server DOES NOT know about backups, just host metrics, datastore usage, etc.

Click Create Bucket under the other bucket on the Data Explorer page in Influx.
Call it 'pbs'.

In PBS under Configuration, go to the Metric Server tab.
Click the Add dropdown.
Choose InfluxDB (HTTP). ***The "InfluxDB UDP" option only works for old InfluxDB v1. You just installed InfluxDB2 and need to use HTTP.

Name - whatever you named your InfluxDB2 server.
URL - http://<IP_Address>:8086 ***You have to include the port here. Unlike PVE, there's no separate field for it.
Organization - proxmox
Bucket - pbs
Paste the token you copied.

-----------------

Grafana Prerequisites.

apt-get install -y apt-transport-https software-properties-common wget
I did not need to install this stuff, but it can't hurt to make sure.

-----------------

Install Grafana.

Download the key.
mkdir -p /etc/apt/keyrings/
wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg > /dev/null

Add the repo.
echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list

Install.
apt install grafana
systemctl start grafana-server
systemctl enable grafana-server

-----------------

Configure Grafana.

http://<IP_Address>:3000.
Default credentials:

Username: admin
Password: admin

Click Log in. Make a new password. Save it somewhere.

-----------------

Generate an API key in InfluxDB.

Go back to the InfluxDB web interface.
Click Load Data on the left and then API Tokens.
Click Generate API Token and select Custom API Token.
Assign it access to your bucket(s).
Generate.
Copy the key and save it somewhere.

-----------------

Add InfluxDB as a Data Source in Grafana.

In Grafana, expand Connections and select Data sources.
Add data source.
Select InfluxDB

Query Language - Flux
HTTP - http://<IP_Address>:8086
Organization - proxmox
Token - paste the token you just created in here.
Default Bucket - proxmox
Hit Save & test.

If you setup both PVE and PBS, you'll see: "datasource is working. 2 buckets found"

-----------------

Import a Proxmox Dashboard in Grafana.

Search for promxox and select a dashboard that works with InfluxDB2.
https://grafana.com/grafana/dashboards/
(If you have setup PBS monitoring too, get a dash for the backup server as well.)
Copy the ID number of the selected Dashboard.

In Grafana select Dashboards.
On the right, click the New dropdown and Import dashboard.
Put the ID number and click Load.
Select the influxdb connection you configured.
Import.

NOTE: If you have 2 buckets, you may need to tell the dash which bucket to use.
Adjust each dash for the PBS or Proxmox bucket in the settings at the top.
You can click Edit and then Save this as the new default for the dashboard.

You might need to try a few dashboards. There are lots of choices. Look for stuff that's compatible with InfluxDB2.
I'm using these.

23164 Proxmox VE [InfluxDBv2]
23102 Proxmox Backup Server [InfluxDBv2]
-----------------

You're done.

Admire your new widgets.
 
Last edited:
  • Like
Reactions: Johannes S
if that would help provide backup reports to client.
What specific data would you like to see here? I.e., how would you like to graph that then in Grafana? Just to see if the metrics stack might be a fit for that in general.
 
Hi Thomas
Thanks for the follow up.

This is what I got from my boss.
All he originally wanted from me was to setup the Influx data collection so it could be piped to our own reporting database.
(I went ahead and built out the Grafana stuff anyway for the experience.)

He intended to build the report from our database, not Grafana.
I've had limited experience with Grafana, and I've never used it to export a report, so I don't know its capabilities in that regard.

I think the primary business goal here is to send clients a report confirming that their backups have taken place, succeeded, and what times that happened. The clients are the drivers here. They ask us for this stuff, I take it its a compliance or auditing requirement for them.

------------------------------
Data

Vmhost name We can figure out client via internal references
Backup End: Datetime
Backup Status: Success or Failure
Reason For Failure?
Start Time ??

-----------------------------
Report

Client Backup Report:

Date:
Host1. Backend End Time. Status
Host2. “” “”
Host3. “” “”

Date:
Host1. Backend End Time. Status
Host2. Backend End Time. Status
Host3. Backend End Time. Status
-----------------------------

Thanks for your time.
- t
 
  • Like
Reactions: Johannes S