Skip to content

Commit 63e3619

Browse files
authored
New Script: Prometheus Proxmox VE Exporter (#1805)
* New Script: Prometheus Proxmox VE Exporter See https://github.com/prometheus-pve/prometheus-pve-exporter * Fix formatting of config file output after installation * Prometheus Proxmox VE Exporter: Set category 1 for Website * Removed blank lines * Remove `python3-dev`, as it was commented out * Prometheus Proxmox VE Exporter: Move configuration under /opt * Prometheus Proxmox VE Exporter: Add logo * Change `msg_info "Updating Python3"` to `msg_info "Setup Python3"` * Removed empty line * Add note about Proxmox credentials into the website * Temp: Replace GitHub URLs to test my fork * Set correct `APP="Prometheus-PVE-Exporter"` * Add `--root-user-action=ignore` to pip call (as root) * Revert "Temp: Replace GitHub URLs to test my fork" This reverts commit 2308d48.
1 parent 054b569 commit 63e3619

File tree

3 files changed

+167
-0
lines changed

3 files changed

+167
-0
lines changed

ct/prometheus-pve-exporter.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env bash
2+
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Andy Grunwald (andygrunwald)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/prometheus-pve/prometheus-pve-exporter
7+
8+
# App Default Values
9+
APP="Prometheus-PVE-Exporter"
10+
var_tags="monitoring"
11+
var_cpu="1"
12+
var_ram="1024"
13+
var_disk="2"
14+
var_os="debian"
15+
var_version="12"
16+
var_unprivileged="1"
17+
18+
# App Output & Base Settings
19+
header_info "$APP"
20+
base_settings
21+
22+
# Core
23+
variables
24+
color
25+
catch_errors
26+
27+
function update_script() {
28+
header_info
29+
check_container_storage
30+
check_container_resources
31+
if [[ ! -f /etc/systemd/system/prometheus-pve-exporter.service ]]; then
32+
msg_error "No ${APP} Installation Found!"
33+
exit
34+
fi
35+
msg_info "Stopping ${APP}"
36+
systemctl stop prometheus-pve-exporter
37+
msg_ok "Stopped ${APP}"
38+
39+
msg_info "Updating ${APP}"
40+
pip install prometheus-pve-exporter --upgrade --root-user-action=ignore &>/dev/null
41+
msg_ok "Updated ${APP}"
42+
43+
msg_info "Starting ${APP}"
44+
systemctl start prometheus-pve-exporter
45+
msg_ok "Started ${APP}"
46+
msg_ok "Updated Successfully"
47+
exit
48+
}
49+
50+
start
51+
build_container
52+
description
53+
54+
msg_ok "Completed Successfully!\n"
55+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
56+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
57+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:9221${CL}"
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Andy Grunwald (andygrunwald)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/prometheus-pve/prometheus-pve-exporter
7+
8+
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt-get install -y \
18+
curl \
19+
sudo \
20+
mc
21+
msg_ok "Installed Dependencies"
22+
23+
msg_info "Setup Python3"
24+
$STD apt-get install -y \
25+
python3 \
26+
python3-pip
27+
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
28+
msg_ok "Setup Python3"
29+
30+
msg_info "Installing Prometheus Proxmox VE Exporter"
31+
python3 -m pip install --quiet --root-user-action=ignore prometheus-pve-exporter
32+
mkdir -p /opt/prometheus-pve-exporter
33+
cat <<EOF > /opt/prometheus-pve-exporter/pve.yml
34+
default:
35+
user: prometheus@pve
36+
password: sEcr3T!
37+
verify_ssl: false
38+
EOF
39+
msg_ok "Installed Prometheus Proxmox VE Exporter"
40+
41+
msg_info "Creating Service"
42+
cat <<EOF >/etc/systemd/system/prometheus-pve-exporter.service
43+
[Unit]
44+
Description=Prometheus Proxmox VE Exporter
45+
Documentation=https://github.com/znerol/prometheus-pve-exporter
46+
After=syslog.target network.target
47+
48+
[Service]
49+
User=root
50+
Restart=always
51+
Type=simple
52+
ExecStart=pve_exporter \
53+
--config.file=/opt/prometheus-pve-exporter/pve.yml \
54+
--web.listen-address=0.0.0.0:9221
55+
ExecReload=/bin/kill -HUP \$MAINPID
56+
57+
[Install]
58+
WantedBy=multi-user.target
59+
EOF
60+
61+
systemctl enable -q --now prometheus-pve-exporter
62+
msg_ok "Created Service"
63+
64+
motd_ssh
65+
customize
66+
67+
msg_info "Cleaning up"
68+
$STD apt-get -y autoremove
69+
$STD apt-get -y autoclean
70+
msg_ok "Cleaned"

json/prometheus-pve-exporter.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "Prometheus Proxmox VE Exporter",
3+
"slug": "prometheus-proxmox-ve-exporter",
4+
"categories": [
5+
1,
6+
9
7+
],
8+
"date_created": "2025-01-28",
9+
"type": "ct",
10+
"updateable": true,
11+
"privileged": false,
12+
"interface_port": 9221,
13+
"documentation": "https://github.com/prometheus-pve/prometheus-pve-exporter",
14+
"website": "https://github.com/prometheus-pve/prometheus-pve-exporter",
15+
"logo": "https://raw.githubusercontent.com/home-assistant/brands/master/core_integrations/proxmoxve/icon.png",
16+
"description": "An exporter that exposes information gathered from Proxmox VE node for use by the Prometheus monitoring system.",
17+
"install_methods": [
18+
{
19+
"type": "default",
20+
"script": "ct/prometheus-pve-exporter.sh",
21+
"resources": {
22+
"cpu": 1,
23+
"ram": 1024,
24+
"hdd": 2,
25+
"os": "debian",
26+
"version": "12"
27+
}
28+
}
29+
],
30+
"default_credentials": {
31+
"username": null,
32+
"password": null
33+
},
34+
"notes": [
35+
{
36+
"text": "Please adjust the Proxmox credentials in the configuration file: /opt/prometheus-pve-exporter/pve.yml",
37+
"type": "info"
38+
}
39+
]
40+
}

0 commit comments

Comments
 (0)