From ebdf2b4f277b3f20908cab55eca504c7ecdea1ca Mon Sep 17 00:00:00 2001 From: CN-JS-HuiBai Date: Sun, 8 Feb 2026 22:58:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0aarch64=E6=9E=B6=E6=9E=84?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Prometheus/install_node_exporter_arm64.sh | 83 +++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Prometheus/install_node_exporter_arm64.sh diff --git a/Prometheus/install_node_exporter_arm64.sh b/Prometheus/install_node_exporter_arm64.sh new file mode 100644 index 0000000..43c44f4 --- /dev/null +++ b/Prometheus/install_node_exporter_arm64.sh @@ -0,0 +1,83 @@ +#!/bin/bash +set -e + +#Detect Operation System + +if command -v apt >/dev/null 2>&1; then + echo "Detected apt-based system" + sudo apt update + sudo apt install -y wget curl tar + +elif command -v dnf >/dev/null 2>&1; then + echo "Detected dnf-based system" + sudo dnf install -y wget curl tar + +else + echo "Unsupported package manager" + exit 1 +fi + + +# Download Node Exporter + +CN_URL="https://s3.cloudyun.top/downloads/node_exporter-1.10.2.linux-arm64.tar.gz" +GLOBAL_URL="https://github.com/prometheus/node_exporter/releases/download/v1.10.2/node_exporter-1.10.2.linux-arm64.tar.gz" +TARGET="/tmp/node_exporter.tar.gz" + +is_cn=false + +echo "Detecting geographic location..." + +COUNTRY=$(curl -s --max-time 3 https://ipinfo.io/country || true) +if [ "$COUNTRY" = "CN" ]; then + is_cn=true +fi + + +if [ "$is_cn" = true ]; then + echo "Geolocation: China mainland detected" + DOWNLOAD_URL="$CN_URL" +else + echo "Geolocation: non-China region detected" + DOWNLOAD_URL="$GLOBAL_URL" +fi + +echo "Downloading from: $DOWNLOAD_URL" +curl -fL -o "$TARGET" "$DOWNLOAD_URL" + + + + +# Extract +echo "Extracting Node Exporter..." +tar -zxvf /tmp/node_exporter.tar.gz -C /tmp + +# Copy to /node_exporter +echo "Copying Node Exporter to /node_exporter..." +sudo cp -r /tmp/node_exporter-1.10.2.linux-arm64 /node_exporter + +# Create systemd service file +SERVICE_FILE="/etc/systemd/system/node_exporter.service" + +echo "Creating systemd service file..." +sudo tee "$SERVICE_FILE" > /dev/null <