mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-11-18 20:08:23 +01:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e73d9f09f1 |
No files matched your search
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
|
||||
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/AnalogJ/scrutiny
|
||||
|
||||
APP="Scrutiny"
|
||||
var_tags="${var_tags:-monitoring;smart;disk}"
|
||||
var_cpu="${var_cpu:-1}"
|
||||
var_ram="${var_ram:-1024}"
|
||||
var_disk="${var_disk:-4}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-13}"
|
||||
var_arm64="${var_arm64:-yes}"
|
||||
var_unprivileged="${var_unprivileged:-1}"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
if [[ ! -f /opt/scrutiny/scrutiny ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if check_for_gh_release "scrutiny" "AnalogJ/scrutiny"; then
|
||||
msg_info "Stopping Scrutiny"
|
||||
systemctl stop scrutiny
|
||||
msg_ok "Stopped Scrutiny"
|
||||
|
||||
fetch_and_deploy_gh_release "scrutiny" "AnalogJ/scrutiny" "singlefile" "latest" "/opt/scrutiny" "scrutiny-web-linux-$(arch_resolve "amd64" "arm64")"
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "scrutiny-web" "AnalogJ/scrutiny" "prebuild" "latest" "/opt/scrutiny/web" "scrutiny-web-frontend.tar.gz"
|
||||
|
||||
msg_info "Starting Scrutiny"
|
||||
systemctl start scrutiny
|
||||
msg_ok "Started Scrutiny"
|
||||
msg_ok "Updated successfully!"
|
||||
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 "${GATEWAY}${BGN}http://${IP}:8080${CL}"
|
||||
@@ -0,0 +1,101 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/AnalogJ/scrutiny
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Setting up InfluxDB Repository"
|
||||
setup_deb822_repo \
|
||||
"influxdata" \
|
||||
"https://repos.influxdata.com/influxdata-archive.key" \
|
||||
"https://repos.influxdata.com/debian" \
|
||||
"stable"
|
||||
msg_ok "Set up InfluxDB Repository"
|
||||
|
||||
msg_info "Installing InfluxDB"
|
||||
$STD apt install -y influxdb2
|
||||
systemctl enable -q --now influxdb
|
||||
for _ in {1..30}; do
|
||||
curl -fsS http://127.0.0.1:8086/health >/dev/null 2>&1 && break
|
||||
sleep 1
|
||||
done
|
||||
msg_ok "Installed InfluxDB"
|
||||
|
||||
msg_info "Configuring InfluxDB"
|
||||
INFLUX_PASS="$(random_password)"
|
||||
INFLUX_TOKEN="$(random_password 48)"
|
||||
curl -fsS -X POST http://127.0.0.1:8086/api/v2/setup \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"username\":\"admin\",\"password\":\"${INFLUX_PASS}\",\"org\":\"scrutiny\",\"bucket\":\"metrics\",\"token\":\"${INFLUX_TOKEN}\"}" >/dev/null
|
||||
mkdir -p /opt/scrutiny_data
|
||||
cat <<EOT >/opt/scrutiny_data/.env
|
||||
INFLUXDB_USER=admin
|
||||
INFLUXDB_PASSWORD=${INFLUX_PASS}
|
||||
INFLUXDB_TOKEN=${INFLUX_TOKEN}
|
||||
EOT
|
||||
chmod 600 /opt/scrutiny_data/.env
|
||||
msg_ok "Configured InfluxDB"
|
||||
|
||||
fetch_and_deploy_gh_release "scrutiny" "AnalogJ/scrutiny" "singlefile" "latest" "/opt/scrutiny" "scrutiny-web-linux-$(arch_resolve "amd64" "arm64")"
|
||||
fetch_and_deploy_gh_release "scrutiny-web" "AnalogJ/scrutiny" "prebuild" "latest" "/opt/scrutiny/web" "scrutiny-web-frontend.tar.gz"
|
||||
|
||||
msg_info "Configuring Scrutiny"
|
||||
cat <<EOT >/opt/scrutiny_data/scrutiny.yaml
|
||||
version: 1
|
||||
web:
|
||||
listen:
|
||||
port: 8080
|
||||
host: 0.0.0.0
|
||||
basepath: ''
|
||||
database:
|
||||
location: /opt/scrutiny_data/scrutiny.db
|
||||
src:
|
||||
frontend:
|
||||
path: /opt/scrutiny/web
|
||||
influxdb:
|
||||
scheme: 'http'
|
||||
host: 127.0.0.1
|
||||
port: 8086
|
||||
token: '${INFLUX_TOKEN}'
|
||||
org: 'scrutiny'
|
||||
bucket: 'metrics'
|
||||
retention_policy: true
|
||||
log:
|
||||
file: ''
|
||||
level: INFO
|
||||
EOT
|
||||
chmod 600 /opt/scrutiny_data/scrutiny.yaml
|
||||
msg_ok "Configured Scrutiny"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOT >/etc/systemd/system/scrutiny.service
|
||||
[Unit]
|
||||
Description=Scrutiny
|
||||
After=network-online.target influxdb.service
|
||||
Requires=influxdb.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/opt/scrutiny_data
|
||||
ExecStart=/opt/scrutiny/scrutiny start --config /opt/scrutiny_data/scrutiny.yaml
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOT
|
||||
systemctl enable -q --now scrutiny
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
Reference in new issue
Block a user