diff --git a/misc/alpine-install.func b/misc/alpine-install.func index 49b83dbae..28b6ce8d4 100644 --- a/misc/alpine-install.func +++ b/misc/alpine-install.func @@ -11,6 +11,13 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV load_functions catch_errors +# Persist diagnostics setting inside container (exported from build.func) +# so addon scripts running later can find the user's choice +if [[ ! -f /usr/local/community-scripts/diagnostics ]]; then + mkdir -p /usr/local/community-scripts + echo "DIAGNOSTICS=${DIAGNOSTICS:-no}" >/usr/local/community-scripts/diagnostics +fi + # Get LXC IP address (must be called INSIDE container, after network is up) get_lxc_ip @@ -30,7 +37,7 @@ post_progress_to_api() { curl -fsS -m 5 -X POST "https://telemetry.community-scripts.org/telemetry" \ -H "Content-Type: application/json" \ - -d "{\"random_id\":\"${RANDOM_UUID}\",\"type\":\"lxc\",\"nsapp\":\"${app:-unknown}\",\"status\":\"configuring\"}" &>/dev/null || true + -d "{\"random_id\":\"${RANDOM_UUID}\",\"execution_id\":\"${EXECUTION_ID:-${RANDOM_UUID}}\",\"type\":\"lxc\",\"nsapp\":\"${app:-unknown}\",\"status\":\"configuring\"}" &>/dev/null || true } # This function enables IPv6 if it's not disabled and sets verbose mode diff --git a/misc/api.func b/misc/api.func index 457f5cc75..0ae647ca2 100644 --- a/misc/api.func +++ b/misc/api.func @@ -552,6 +552,7 @@ post_to_api() { cat </dev/null || true -# init_tool_telemetry "post-pve-install" "tool" +# init_tool_telemetry "post-pve-install" "pve" # init_tool_telemetry "" "addon" # uses $APP at exit time # ------------------------------------------------------------------------------ init_tool_telemetry() { local name="${1:-}" - local type="${2:-tool}" + local type="${2:-pve}" [[ -n "$name" ]] && TELEMETRY_TOOL_NAME="$name" TELEMETRY_TOOL_TYPE="$type" @@ -1088,7 +1094,8 @@ post_tool_to_api() { cat </usr/local/community-scripts/diagnostics -DIAGNOSTICS=yes + local result + result=$(whiptail --backtitle "Proxmox VE Helper Scripts" \ + --title "TELEMETRY & DIAGNOSTICS" \ + --ok-button "Confirm" --cancel-button "Exit" \ + --radiolist "\nHelp improve Community-Scripts by sharing anonymous data.\n\nWhat we collect:\n - Container resources (CPU, RAM, disk), OS & PVE version\n - Application name, install method and status\n\nWhat we DON'T collect:\n - No IP addresses, hostnames, or personal data\n\nYou can change this anytime in the Settings menu.\nPrivacy: https://github.com/community-scripts/telemetry-service/blob/main/docs/PRIVACY.md\n\nUse SPACE to select, ENTER to confirm." 22 76 2 \ + "yes" "Yes, share anonymous data" OFF \ + "no" "No, opt out" OFF \ + 3>&1 1>&2 2>&3) || result="no" -#This file is used to store the diagnostics settings for the Community-Scripts API. -#https://github.com/community-scripts/ProxmoxVE/discussions/1836 -#Your diagnostics will be sent to the Community-Scripts API for troubleshooting/statistical purposes. -#You can review the data at https://community-scripts.github.io/ProxmoxVE/data -#If you do not wish to send diagnostics, please set the variable 'DIAGNOSTICS' to "no" in /usr/local/community-scripts/diagnostics, or use the menue. -#This will disable the diagnostics feature. -#To send diagnostics, set the variable 'DIAGNOSTICS' to "yes" in /usr/local/community-scripts/diagnostics, or use the menue. -#This will enable the diagnostics feature. -#The following information will be sent: -#"disk_size" -#"core_count" -#"ram_size" -#"os_type" -#"os_version" -#"nsapp" -#"method" -#"pve_version" -#"status" -#If you have any concerns, please review the source code at /misc/build.func + DIAGNOSTICS="${result:-no}" + + cat <"$config_file" +DIAGNOSTICS=${DIAGNOSTICS} + +# Community-Scripts Telemetry Configuration +# https://telemetry.community-scripts.org +# +# This file stores your telemetry preference. +# Set DIAGNOSTICS=yes to share anonymous installation data. +# Set DIAGNOSTICS=no to disable telemetry. +# +# You can also change this via the Settings menu during installation. +# +# Data collected (when enabled): +# disk_size, core_count, ram_size, os_type, os_version, +# nsapp, method, pve_version, status, exit_code +# +# No personal data (IPs, hostnames, passwords) is ever collected. +# Privacy: https://github.com/community-scripts/telemetry-service/blob/main/docs/PRIVACY.md EOF - DIAGNOSTICS="yes" - else - cat </usr/local/community-scripts/diagnostics -DIAGNOSTICS=no - -#This file is used to store the diagnostics settings for the Community-Scripts API. -#https://github.com/community-scripts/ProxmoxVE/discussions/1836 -#Your diagnostics will be sent to the Community-Scripts API for troubleshooting/statistical purposes. -#You can review the data at https://community-scripts.github.io/ProxmoxVE/data -#If you do not wish to send diagnostics, please set the variable 'DIAGNOSTICS' to "no" in /usr/local/community-scripts/diagnostics, or use the menue. -#This will disable the diagnostics feature. -#To send diagnostics, set the variable 'DIAGNOSTICS' to "yes" in /usr/local/community-scripts/diagnostics, or use the menue. -#This will enable the diagnostics feature. -#The following information will be sent: -#"disk_size" -#"core_count" -#"ram_size" -#"os_type" -#"os_version" -#"nsapp" -#"method" -#"pve_version" -#"status" -#If you have any concerns, please review the source code at /misc/build.func -EOF - DIAGNOSTICS="no" - fi - else - DIAGNOSTICS=$(awk -F '=' '/^DIAGNOSTICS/ {print $2}' /usr/local/community-scripts/diagnostics) - - fi } diagnostics_menu() { - if [ "${DIAGNOSTICS:-no}" = "yes" ]; then + local current="${DIAGNOSTICS:-no}" + local status_text="DISABLED" + [[ "$current" == "yes" ]] && status_text="ENABLED" + + local dialog_text=( + "Telemetry is currently: ${status_text}\n\n" + "Anonymous data helps us improve scripts and track issues.\n" + "No personal data is ever collected.\n\n" + "More info: https://telemetry.community-scripts.org\n\n" + "Do you want to ${current:+change this setting}?" + ) + + if [[ "$current" == "yes" ]]; then if whiptail --backtitle "Proxmox VE Helper Scripts" \ - --title "DIAGNOSTIC SETTINGS" \ - --yesno "Send Diagnostics?\n\nCurrent: ${DIAGNOSTICS}" 10 58 \ - --yes-button "No" --no-button "Back"; then + --title "TELEMETRY SETTINGS" \ + --yesno "${dialog_text[*]}" 14 64 \ + --yes-button "Disable" --no-button "Keep enabled"; then DIAGNOSTICS="no" sed -i 's/^DIAGNOSTICS=.*/DIAGNOSTICS=no/' /usr/local/community-scripts/diagnostics - whiptail --msgbox "Diagnostics set to ${DIAGNOSTICS}." 8 58 + whiptail --msgbox "Telemetry disabled.\n\nNote: Existing containers keep their current setting.\nNew containers will inherit this choice." 10 58 fi else if whiptail --backtitle "Proxmox VE Helper Scripts" \ - --title "DIAGNOSTIC SETTINGS" \ - --yesno "Send Diagnostics?\n\nCurrent: ${DIAGNOSTICS}" 10 58 \ - --yes-button "Yes" --no-button "Back"; then + --title "TELEMETRY SETTINGS" \ + --yesno "${dialog_text[*]}" 14 64 \ + --yes-button "Enable" --no-button "Keep disabled"; then DIAGNOSTICS="yes" sed -i 's/^DIAGNOSTICS=.*/DIAGNOSTICS=yes/' /usr/local/community-scripts/diagnostics - whiptail --msgbox "Diagnostics set to ${DIAGNOSTICS}." 8 58 + whiptail --msgbox "Telemetry enabled.\n\nNote: Existing containers keep their current setting.\nNew containers will inherit this choice." 10 58 fi fi } @@ -3561,6 +3554,7 @@ build_container() { # Core exports for install.func export DIAGNOSTICS="$DIAGNOSTICS" export RANDOM_UUID="$RANDOM_UUID" + export EXECUTION_ID="$EXECUTION_ID" export SESSION_ID="$SESSION_ID" export CACHER="$APT_CACHER" export CACHER_IP="$APT_CACHER_IP" @@ -5552,6 +5546,8 @@ ensure_log_on_host() { # - Exit trap handler for reporting to API telemetry # - Captures exit code and reports to PocketBase using centralized error descriptions # - Uses explain_exit_code() from api.func for consistent error messages +# - For signal exits (>128): sends telemetry FIRST before log collection +# to prevent pct pull hangs from blocking status updates # - For non-zero exit codes: posts "failed" status # - For zero exit codes where post_update_to_api was never called: # catches orphaned "installing" records (e.g., script exited cleanly @@ -5560,8 +5556,15 @@ ensure_log_on_host() { api_exit_script() { local exit_code=$? if [ $exit_code -ne 0 ]; then - ensure_log_on_host - post_update_to_api "failed" "$exit_code" + if [ $exit_code -gt 128 ]; then + # Signal exit: send telemetry IMMEDIATELY (container may be dying) + post_update_to_api "failed" "$exit_code" 2>/dev/null || true + ensure_log_on_host 2>/dev/null || true + else + # Normal error: collect logs first for better error details + ensure_log_on_host 2>/dev/null || true + post_update_to_api "failed" "$exit_code" + fi elif [[ "${POST_TO_API_DONE:-}" == "true" && "${POST_UPDATE_DONE:-}" != "true" ]]; then # Script exited with 0 but never sent a completion status # exit_code=0 is never an error — report as success @@ -5572,7 +5575,7 @@ api_exit_script() { if command -v pveversion >/dev/null 2>&1; then trap 'api_exit_script' EXIT fi -trap 'local _ec=$?; if [[ $_ec -ne 0 ]]; then ensure_log_on_host; post_update_to_api "failed" "$_ec"; fi' ERR -trap 'ensure_log_on_host; post_update_to_api "failed" "129"; exit 129' SIGHUP -trap 'ensure_log_on_host; post_update_to_api "failed" "130"; exit 130' SIGINT -trap 'ensure_log_on_host; post_update_to_api "failed" "143"; exit 143' SIGTERM +trap 'local _ec=$?; if [[ $_ec -ne 0 ]]; then ensure_log_on_host 2>/dev/null || true; post_update_to_api "failed" "$_ec"; fi' ERR +trap 'post_update_to_api "failed" "129" 2>/dev/null || true; ensure_log_on_host 2>/dev/null || true; exit 129' SIGHUP +trap 'post_update_to_api "failed" "130" 2>/dev/null || true; ensure_log_on_host 2>/dev/null || true; exit 130' SIGINT +trap 'post_update_to_api "failed" "143" 2>/dev/null || true; ensure_log_on_host 2>/dev/null || true; exit 143' SIGTERM diff --git a/misc/error_handler.func b/misc/error_handler.func index febd28c3b..d3dbde80a 100644 --- a/misc/error_handler.func +++ b/misc/error_handler.func @@ -329,6 +329,8 @@ error_handler() { # - Cleans up lock files if lockfile variable is set # - Exits with captured exit code # - Always runs on script termination (success or failure) +# - For signal exits (>128): sends telemetry FIRST before log collection +# to prevent pct pull hangs from blocking status updates # ------------------------------------------------------------------------------ on_exit() { local exit_code=$? @@ -337,14 +339,24 @@ on_exit() { # post_to_api was called ("installing" sent) but post_update_to_api was never called if [[ "${POST_TO_API_DONE:-}" == "true" && "${POST_UPDATE_DONE:-}" != "true" ]]; then if declare -f post_update_to_api >/dev/null 2>&1; then - # Ensure log is accessible on host before reporting - if declare -f ensure_log_on_host >/dev/null 2>&1; then - ensure_log_on_host - fi - if [[ $exit_code -ne 0 ]]; then - post_update_to_api "failed" "$exit_code" + if [[ $exit_code -gt 128 ]]; then + # Signal exit: send telemetry IMMEDIATELY (container may be dying, pct pull could hang) + post_update_to_api "failed" "$exit_code" 2>/dev/null || true + # Then try log collection (non-critical, best-effort) + if declare -f ensure_log_on_host >/dev/null 2>&1; then + ensure_log_on_host 2>/dev/null || true + fi else - post_update_to_api "failed" "1" + # Normal exit: collect logs first for better error details + if declare -f ensure_log_on_host >/dev/null 2>&1; then + ensure_log_on_host 2>/dev/null || true + fi + if [[ $exit_code -ne 0 ]]; then + post_update_to_api "failed" "$exit_code" + else + # exit_code=0 is never an error — report as success + post_update_to_api "done" "0" + fi fi fi fi @@ -356,22 +368,26 @@ on_exit() { # on_interrupt() # # - SIGINT (Ctrl+C) trap handler +# - Reports to telemetry FIRST (time-critical: container may be dying) # - Displays "Interrupted by user" message # - Exits with code 130 (128 + SIGINT=2) +# - Output redirected to /dev/null fallback to prevent SIGPIPE on closed terminals # ------------------------------------------------------------------------------ on_interrupt() { - # Ensure log is accessible on host before reporting - if declare -f ensure_log_on_host >/dev/null 2>&1; then - ensure_log_on_host - fi - # Report interruption to telemetry API (prevents stuck "installing" records) + # CRITICAL: Send telemetry FIRST before any cleanup or output + # If ensure_log_on_host hangs (e.g. pct pull on dying container), + # the status update would never be sent, leaving records stuck in "installing" if declare -f post_update_to_api >/dev/null 2>&1; then - post_update_to_api "failed" "130" + post_update_to_api "failed" "130" 2>/dev/null || true + fi + # Best-effort log collection (non-critical after telemetry is sent) + if declare -f ensure_log_on_host >/dev/null 2>&1; then + ensure_log_on_host 2>/dev/null || true fi if declare -f msg_error >/dev/null 2>&1; then - msg_error "Interrupted by user (SIGINT)" + msg_error "Interrupted by user (SIGINT)" 2>/dev/null || true else - echo -e "\n${RD}Interrupted by user (SIGINT)${CL}" + echo -e "\n${RD}Interrupted by user (SIGINT)${CL}" 2>/dev/null || true fi exit 130 } @@ -380,23 +396,27 @@ on_interrupt() { # on_terminate() # # - SIGTERM trap handler +# - Reports to telemetry FIRST (time-critical: process being killed) # - Displays "Terminated by signal" message # - Exits with code 143 (128 + SIGTERM=15) # - Triggered by external process termination +# - Output redirected to /dev/null fallback to prevent SIGPIPE on closed terminals # ------------------------------------------------------------------------------ on_terminate() { - # Ensure log is accessible on host before reporting - if declare -f ensure_log_on_host >/dev/null 2>&1; then - ensure_log_on_host - fi - # Report termination to telemetry API (prevents stuck "installing" records) + # CRITICAL: Send telemetry FIRST before any cleanup or output + # Same rationale as on_interrupt: ensure status gets reported even if + # ensure_log_on_host hangs or terminal is already closed if declare -f post_update_to_api >/dev/null 2>&1; then - post_update_to_api "failed" "143" + post_update_to_api "failed" "143" 2>/dev/null || true + fi + # Best-effort log collection (non-critical after telemetry is sent) + if declare -f ensure_log_on_host >/dev/null 2>&1; then + ensure_log_on_host 2>/dev/null || true fi if declare -f msg_error >/dev/null 2>&1; then - msg_error "Terminated by signal (SIGTERM)" + msg_error "Terminated by signal (SIGTERM)" 2>/dev/null || true else - echo -e "\n${RD}Terminated by signal (SIGTERM)${CL}" + echo -e "\n${RD}Terminated by signal (SIGTERM)${CL}" 2>/dev/null || true fi exit 143 } diff --git a/misc/install.func b/misc/install.func index ed7205c7d..8253c4272 100644 --- a/misc/install.func +++ b/misc/install.func @@ -37,6 +37,13 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV load_functions catch_errors +# Persist diagnostics setting inside container (exported from build.func) +# so addon scripts running later can find the user's choice +if [[ ! -f /usr/local/community-scripts/diagnostics ]]; then + mkdir -p /usr/local/community-scripts + echo "DIAGNOSTICS=${DIAGNOSTICS:-no}" >/usr/local/community-scripts/diagnostics +fi + # Get LXC IP address (must be called INSIDE container, after network is up) get_lxc_ip @@ -56,7 +63,7 @@ post_progress_to_api() { curl -fsS -m 5 -X POST "https://telemetry.community-scripts.org/telemetry" \ -H "Content-Type: application/json" \ - -d "{\"random_id\":\"${RANDOM_UUID}\",\"type\":\"lxc\",\"nsapp\":\"${app:-unknown}\",\"status\":\"configuring\"}" &>/dev/null || true + -d "{\"random_id\":\"${RANDOM_UUID}\",\"execution_id\":\"${EXECUTION_ID:-${RANDOM_UUID}}\",\"type\":\"lxc\",\"nsapp\":\"${app:-unknown}\",\"status\":\"configuring\"}" &>/dev/null || true } # ============================================================================== diff --git a/tools/addon/add-netbird-lxc.sh b/tools/addon/add-netbird-lxc.sh index d0b28b4d5..68b0e9bd4 100644 --- a/tools/addon/add-netbird-lxc.sh +++ b/tools/addon/add-netbird-lxc.sh @@ -22,7 +22,7 @@ set -e # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "add-netbird-lxc" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "add-netbird-lxc" "addon" while true; do read -p "This will add NetBird to an existing LXC Container ONLY. Proceed(y/n)?" yn diff --git a/tools/addon/add-tailscale-lxc.sh b/tools/addon/add-tailscale-lxc.sh index 0fcce0328..a12830018 100644 --- a/tools/addon/add-tailscale-lxc.sh +++ b/tools/addon/add-tailscale-lxc.sh @@ -25,7 +25,7 @@ function msg_error() { echo -e " \e[1;31m✖\e[0m $1"; } # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "add-tailscale-lxc" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "add-tailscale-lxc" "addon" header_info diff --git a/tools/addon/all-templates.sh b/tools/addon/all-templates.sh index 8e2af5ff2..f8d35619d 100644 --- a/tools/addon/all-templates.sh +++ b/tools/addon/all-templates.sh @@ -45,7 +45,7 @@ function msg() { # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "all-templates" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "all-templates" "addon" function validate_container_id() { local ctid="$1" diff --git a/tools/addon/netdata.sh b/tools/addon/netdata.sh index 5bdb418e0..da5625003 100644 --- a/tools/addon/netdata.sh +++ b/tools/addon/netdata.sh @@ -29,7 +29,7 @@ silent() { "$@" >/dev/null 2>&1; } # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "netdata" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "netdata" "addon" set -e header_info diff --git a/tools/pve/add-iptag.sh b/tools/pve/add-iptag.sh index a9b8904a7..4ea32df91 100644 --- a/tools/pve/add-iptag.sh +++ b/tools/pve/add-iptag.sh @@ -33,7 +33,7 @@ CROSS="${RD}✗${CL} " # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "add-iptag" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "add-iptag" "pve" # Stop any running spinner stop_spinner() { diff --git a/tools/pve/clean-lxcs.sh b/tools/pve/clean-lxcs.sh index 9cf101b6b..1f326de87 100644 --- a/tools/pve/clean-lxcs.sh +++ b/tools/pve/clean-lxcs.sh @@ -24,7 +24,7 @@ CL="\033[m" # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "clean-lxcs" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "clean-lxcs" "pve" header_info echo "Loading..." diff --git a/tools/pve/clean-orphaned-lvm.sh b/tools/pve/clean-orphaned-lvm.sh index 677b10d87..319497cd7 100644 --- a/tools/pve/clean-orphaned-lvm.sh +++ b/tools/pve/clean-orphaned-lvm.sh @@ -18,7 +18,7 @@ EOF # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "clean-orphaned-lvm" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "clean-orphaned-lvm" "pve" # Function to check for orphaned LVM volumes function find_orphaned_lvm { diff --git a/tools/pve/container-restore-from-backup.sh b/tools/pve/container-restore-from-backup.sh index de7615db2..c5d5a0841 100644 --- a/tools/pve/container-restore-from-backup.sh +++ b/tools/pve/container-restore-from-backup.sh @@ -46,7 +46,7 @@ header_info # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "container-restore" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "container-restore" "pve" function msg_info() { local msg="$1" diff --git a/tools/pve/core-restore-from-backup.sh b/tools/pve/core-restore-from-backup.sh index 22a6775fc..855767dae 100644 --- a/tools/pve/core-restore-from-backup.sh +++ b/tools/pve/core-restore-from-backup.sh @@ -46,7 +46,7 @@ header_info # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "core-restore" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "core-restore" "pve" function msg_info() { local msg="$1" diff --git a/tools/pve/execute.sh b/tools/pve/execute.sh index c863e361c..1ffbcc57d 100644 --- a/tools/pve/execute.sh +++ b/tools/pve/execute.sh @@ -25,7 +25,7 @@ CL=$(echo "\033[m") # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "execute-lxcs" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "execute-lxcs" "pve" header_info echo "Loading..." diff --git a/tools/pve/frigate-support.sh b/tools/pve/frigate-support.sh index e7b902fce..1616b9cfb 100644 --- a/tools/pve/frigate-support.sh +++ b/tools/pve/frigate-support.sh @@ -18,7 +18,7 @@ EOF # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "frigate-support" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "frigate-support" "pve" header_info while true; do diff --git a/tools/pve/fstrim.sh b/tools/pve/fstrim.sh index 31a78742c..90e3aa236 100644 --- a/tools/pve/fstrim.sh +++ b/tools/pve/fstrim.sh @@ -21,7 +21,7 @@ CL="\033[m" # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "fstrim" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "fstrim" "pve" LOGFILE="/var/log/fstrim.log" touch "$LOGFILE" diff --git a/tools/pve/host-backup.sh b/tools/pve/host-backup.sh index a0592463f..5509dd4c6 100644 --- a/tools/pve/host-backup.sh +++ b/tools/pve/host-backup.sh @@ -18,7 +18,7 @@ EOF # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "host-backup" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "host-backup" "pve" # Function to perform backup function perform_backup { diff --git a/tools/pve/hw-acceleration.sh b/tools/pve/hw-acceleration.sh index 0f73a65dd..8db10554e 100644 --- a/tools/pve/hw-acceleration.sh +++ b/tools/pve/hw-acceleration.sh @@ -32,7 +32,7 @@ set -e # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "hw-acceleration" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "hw-acceleration" "pve" header_info echo "Loading..." diff --git a/tools/pve/kernel-clean.sh b/tools/pve/kernel-clean.sh index fb178d250..e8dd68848 100644 --- a/tools/pve/kernel-clean.sh +++ b/tools/pve/kernel-clean.sh @@ -24,7 +24,7 @@ CL="\033[m" # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "kernel-clean" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "kernel-clean" "pve" # Detect current kernel current_kernel=$(uname -r) diff --git a/tools/pve/kernel-pin.sh b/tools/pve/kernel-pin.sh index 534ddac0f..95ca34f35 100644 --- a/tools/pve/kernel-pin.sh +++ b/tools/pve/kernel-pin.sh @@ -28,7 +28,7 @@ available_kernels=$(dpkg --list | grep 'kernel-.*-pve' | awk '{print substr($2, # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "kernel-pin" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "kernel-pin" "pve" header_info diff --git a/tools/pve/lxc-delete.sh b/tools/pve/lxc-delete.sh index 755e3d4c4..8fb43af9b 100644 --- a/tools/pve/lxc-delete.sh +++ b/tools/pve/lxc-delete.sh @@ -40,7 +40,7 @@ CM="${TAB}✔️${TAB}${CL}" # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "lxc-delete" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "lxc-delete" "pve" header_info echo "Loading..." diff --git a/tools/pve/microcode.sh b/tools/pve/microcode.sh index ef1144c41..7024c089e 100644 --- a/tools/pve/microcode.sh +++ b/tools/pve/microcode.sh @@ -31,7 +31,7 @@ msg_error() { echo -e "${BFR} ${CROSS} ${RD}$1${CL}"; } # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "microcode" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "microcode" "pve" header_info current_microcode=$(journalctl -k | grep -i 'microcode: Current revision:' | grep -oP 'Current revision: \K0x[0-9a-f]+') diff --git a/tools/pve/monitor-all.sh b/tools/pve/monitor-all.sh index 6d69b59c9..9e29fdc8b 100644 --- a/tools/pve/monitor-all.sh +++ b/tools/pve/monitor-all.sh @@ -17,7 +17,7 @@ EOF # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "monitor-all" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "monitor-all" "pve" add() { echo -e "\n IMPORTANT: Tag-Based Monitoring Enabled" diff --git a/tools/pve/nic-offloading-fix.sh b/tools/pve/nic-offloading-fix.sh index b1199f12d..e22d0d669 100644 --- a/tools/pve/nic-offloading-fix.sh +++ b/tools/pve/nic-offloading-fix.sh @@ -35,7 +35,7 @@ EOF # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "nic-offloading-fix" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "nic-offloading-fix" "pve" header_info diff --git a/tools/pve/pbs3-upgrade.sh b/tools/pve/pbs3-upgrade.sh index 8c539ff84..bc0a3066a 100644 --- a/tools/pve/pbs3-upgrade.sh +++ b/tools/pve/pbs3-upgrade.sh @@ -46,7 +46,7 @@ msg_error() { # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "pbs3-upgrade" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "pbs3-upgrade" "pve" start_routines() { header_info diff --git a/tools/pve/pbs4-upgrade.sh b/tools/pve/pbs4-upgrade.sh index 6689d48af..2a2fa59fd 100644 --- a/tools/pve/pbs4-upgrade.sh +++ b/tools/pve/pbs4-upgrade.sh @@ -34,7 +34,7 @@ msg_error() { echo -e "${BFR} ${CROSS} ${RD}$1${CL}"; } # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "pbs4-upgrade" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "pbs4-upgrade" "pve" start_routines() { header_info diff --git a/tools/pve/pbs_microcode.sh b/tools/pve/pbs_microcode.sh index 6850f2078..ccd47ffe4 100644 --- a/tools/pve/pbs_microcode.sh +++ b/tools/pve/pbs_microcode.sh @@ -31,7 +31,7 @@ msg_info() { echo -ne " ${HOLD} ${YW}$1..."; } # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "pbs-microcode" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "pbs-microcode" "pve" msg_ok() { echo -e "${BFR} ${CM} ${GN}$1${CL}"; } msg_error() { echo -e "${BFR} ${CROSS} ${RD}$1${CL}"; } diff --git a/tools/pve/post-pbs-install.sh b/tools/pve/post-pbs-install.sh index 09cfc2ef8..3b21f37e4 100644 --- a/tools/pve/post-pbs-install.sh +++ b/tools/pve/post-pbs-install.sh @@ -34,7 +34,7 @@ msg_error() { echo -e "${BFR} ${CROSS} ${RD}$1${CL}"; } # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "post-pbs-install" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "post-pbs-install" "pve" # ---- helpers ---- get_pbs_codename() { diff --git a/tools/pve/post-pmg-install.sh b/tools/pve/post-pmg-install.sh index 60159afe2..579e0b513 100644 --- a/tools/pve/post-pmg-install.sh +++ b/tools/pve/post-pmg-install.sh @@ -45,7 +45,7 @@ msg_error() { # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "post-pmg-install" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "post-pmg-install" "pve" if ! grep -q "Proxmox Mail Gateway" /etc/issue 2>/dev/null; then msg_error "This script is only intended for Proxmox Mail Gateway" diff --git a/tools/pve/post-pve-install.sh b/tools/pve/post-pve-install.sh index 9926f8636..291c1c2bd 100644 --- a/tools/pve/post-pve-install.sh +++ b/tools/pve/post-pve-install.sh @@ -46,7 +46,7 @@ msg_error() { # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "post-pve-install" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "post-pve-install" "pve" get_pve_version() { local pve_ver diff --git a/tools/pve/pve-privilege-converter.sh b/tools/pve/pve-privilege-converter.sh index 4f470e6fb..791c4008b 100644 --- a/tools/pve/pve-privilege-converter.sh +++ b/tools/pve/pve-privilege-converter.sh @@ -13,7 +13,7 @@ fi source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVE/raw/branch/main/misc/core.func) source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true load_functions -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "pve-privilege-converter" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "pve-privilege-converter" "pve" set -euo pipefail shopt -s inherit_errexit nullglob diff --git a/tools/pve/pve8-upgrade.sh b/tools/pve/pve8-upgrade.sh index 3529c8fe1..0d9524a0a 100644 --- a/tools/pve/pve8-upgrade.sh +++ b/tools/pve/pve8-upgrade.sh @@ -46,7 +46,7 @@ msg_error() { # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "pve8-upgrade" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "pve8-upgrade" "pve" start_routines() { header_info diff --git a/tools/pve/scaling-governor.sh b/tools/pve/scaling-governor.sh index d22656594..175012aaf 100644 --- a/tools/pve/scaling-governor.sh +++ b/tools/pve/scaling-governor.sh @@ -8,7 +8,7 @@ set -e # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "scaling-governor" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "scaling-governor" "pve" header_info() { clear diff --git a/tools/pve/update-apps.sh b/tools/pve/update-apps.sh index 8089a329c..b36ec09ed 100644 --- a/tools/pve/update-apps.sh +++ b/tools/pve/update-apps.sh @@ -6,7 +6,7 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/refs/heads/main/misc/core.func) source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "update-apps" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "update-apps" "pve" # ============================================================================= # CONFIGURATION VARIABLES diff --git a/tools/pve/update-lxcs.sh b/tools/pve/update-lxcs.sh index a737caf80..5b0dfc2a5 100644 --- a/tools/pve/update-lxcs.sh +++ b/tools/pve/update-lxcs.sh @@ -27,7 +27,7 @@ CL=$(echo "\033[m") # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "update-lxcs" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "update-lxcs" "pve" header_info echo "Loading..." diff --git a/tools/pve/update-repo.sh b/tools/pve/update-repo.sh index 6d425aac7..9bd56b5a8 100644 --- a/tools/pve/update-repo.sh +++ b/tools/pve/update-repo.sh @@ -25,7 +25,7 @@ CL=$(echo "\033[m") # Telemetry source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func) 2>/dev/null || true -declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "update-repo" "tool" +declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "update-repo" "pve" header_info echo "Loading..."