mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-07 16:29:18 +00:00
adds VictoriaMetrics, cost-effective and scalable monitoring solution and time series database
see also https://docs.victoriametrics.com/
This commit is contained in:
parent
22c0757b4d
commit
9aab7e675d
65
ct/victoriametrics.sh
Normal file
65
ct/victoriametrics.sh
Normal file
@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
||||
# Copyright (c) 2021-2024 tteck
|
||||
# Author: tteck (tteckster)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://prometheus.io/
|
||||
|
||||
# App Default Values
|
||||
APP="VictoriaMetrics"
|
||||
var_tags="monitoring"
|
||||
var_cpu="1"
|
||||
var_ram="2048"
|
||||
var_disk="4"
|
||||
var_os="debian"
|
||||
var_version="12"
|
||||
var_unprivileged="1"
|
||||
|
||||
# App Output & Base Settings
|
||||
header_info "$APP"
|
||||
base_settings
|
||||
|
||||
# Core
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
if [[ ! -f /etc/systemd/system/victoriametrics.service ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
RELEASE=$(curl -s https://api.github.com/repos/VictoriaMetrics/VictoriaMetrics/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
||||
msg_info "Stopping ${APP}"
|
||||
systemctl stop victoriametrics
|
||||
msg_ok "Stopped ${APP}"
|
||||
msg_info "Updating ${APP} to ${RELEASE}"
|
||||
wget -q https://github.com/VictoriaMetrics/VictoriaMetrics/releases/download/v${RELEASE}/victoria-metrics-linux-amd64-${RELEASE}.tar.gz
|
||||
tar -xf victoria-metrics-linux-amd64-${RELEASE}.tar.gz
|
||||
cp -rf victoria-metrics-prod /usr/local/bin/
|
||||
rm -rf victoria-metrics-linux-amd64-${RELEASE}.tar.gz
|
||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||
msg_ok "Updated ${APP} to ${RELEASE}"
|
||||
|
||||
msg_info "Starting ${APP}"
|
||||
systemctl start victoriametrics
|
||||
msg_ok "Started ${APP}"
|
||||
msg_ok "Updated Successfully"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
start
|
||||
build_container
|
||||
description
|
||||
|
||||
msg_ok "Completed Successfully!\n"
|
||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8429${CL}"
|
93
install/victoriametrics-install.sh
Normal file
93
install/victoriametrics-install.sh
Normal file
@ -0,0 +1,93 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2024 tteck
|
||||
# Author: tteck (tteckster)
|
||||
# License: MIT
|
||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y curl
|
||||
$STD apt-get install -y sudo
|
||||
$STD apt-get install -y mc
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Installing VictoriaMetrics"
|
||||
RELEASE=$(curl -s https://api.github.com/repos/VictoriaMetrics/VictoriaMetrics/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
mkdir -p /etc/victoriametrics
|
||||
mkdir -p /var/lib/victoriametrics
|
||||
groupadd -r victoriametrics
|
||||
useradd -g victoriametrics -d /var/lib/victoriametrics -s /sbin/nologin --system victoriametrics
|
||||
chown -R victoriametrics:victoriametrics /var/lib/victoria-metrics
|
||||
wget -q https://github.com/VictoriaMetrics/VictoriaMetrics/releases/download/v${RELEASE}/victoria-metrics-linux-amd64-${RELEASE}.tar.gz
|
||||
tar -xf victoria-metrics-linux-amd64-${RELEASE}.tar.gz
|
||||
chmod +x /usr/bin/victoria-metrics-prod
|
||||
chown root:root /usr/bin/victoria-metrics-prod
|
||||
|
||||
cat <<END >/etc/victoriametrics/scrape.yml
|
||||
# Scrape config example
|
||||
#
|
||||
scrape_configs:
|
||||
- job_name: self_scrape
|
||||
scrape_interval: 10s
|
||||
static_configs:
|
||||
- targets: ['127.0.0.1:8428']
|
||||
END
|
||||
|
||||
mv victoria-metrics-prod /usr/local/bin/
|
||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||
msg_ok "Installed VictoriaMetrics"
|
||||
|
||||
msg_info "Creating Service"
|
||||
service_path="/etc/systemd/system/victoriametrics.service"
|
||||
echo "[Unit]
|
||||
Description=VictoriaMetrics is a fast, cost-effective and scalable monitoring solution and time series database.
|
||||
# https://docs.victoriametrics.com
|
||||
# See https://docs.victoriametrics.com/#list-of-command-line-flags to get more information about supported command-line flags
|
||||
Description=VictoriaMetrics
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
ExecStop=/bin/kill -s SIGTERM \$MAINPID
|
||||
ExecReload=/bin/kill -HUP \$MAINPID
|
||||
User=root
|
||||
Restart=always
|
||||
Type=simple
|
||||
ExecStart=/usr/local/bin/victoria-metrics-prod \
|
||||
-promscrape.config=/etc/victoriametrics/scrape.yml \
|
||||
-storageDataPath=/var/lib/victoriametrics \
|
||||
-retentionPeriod=12 \
|
||||
-httpListenAddr=:8428 \
|
||||
-graphiteListenAddr=:2003 \
|
||||
-opentsdbListenAddr=:4242 \
|
||||
-influxListenAddr=:8089 \
|
||||
-enableTCP6
|
||||
|
||||
LimitNOFILE=1048576
|
||||
LimitNPROC=1048576
|
||||
LimitCORE=infinity
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
SyslogIdentifier=victoriametrics
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target" >$service_path
|
||||
systemctl enable -q --now victoriametrics
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
rm -rf victoria-metrics-linux-amd64-${RELEASE}.tar.gz
|
||||
msg_ok "Cleaned"
|
34
json/victoriametrics.json
Normal file
34
json/victoriametrics.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "VictoriaMetrics",
|
||||
"slug": "victoriametrics",
|
||||
"categories": [
|
||||
7
|
||||
],
|
||||
"date_created": "2024-12-18",
|
||||
"type": "ct",
|
||||
"updateable": true,
|
||||
"privileged": false,
|
||||
"interface_port": 8428,
|
||||
"documentation": null,
|
||||
"website": "https://victoriametrics.com/",
|
||||
"logo": "https://raw.githubusercontent.com/loganmarchione/homelab-svg-assets/main/assets/victoriametrics-black.svg",
|
||||
"description": "VictoriaMetrics is a fast, cost-effective and scalable monitoring solution and time series database.",
|
||||
"install_methods": [
|
||||
{
|
||||
"type": "default",
|
||||
"script": "ct/victoriametrics.sh",
|
||||
"resources": {
|
||||
"cpu": 1,
|
||||
"ram": 2048,
|
||||
"hdd": 4,
|
||||
"os": "debian",
|
||||
"version": "12"
|
||||
}
|
||||
}
|
||||
],
|
||||
"default_credentials": {
|
||||
"username": null,
|
||||
"password": null
|
||||
},
|
||||
"notes": []
|
||||
}
|
Loading…
Reference in New Issue
Block a user