From 61c8b73da9412318886429d0b7c9e99c2372c1f7 Mon Sep 17 00:00:00 2001 From: CN-JS-HuiBai Date: Sun, 8 Feb 2026 23:26:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=9B=BD=E5=AE=B6=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Prometheus/install_Prometheus.sh | 7 ++++--- Prometheus/install_cAdvisor.sh | 7 ++++--- Prometheus/install_mysqld_exporter.sh | 7 ++++--- Prometheus/install_node_exporter.sh | 7 ++++--- Prometheus/install_node_exporter_arm64.sh | 7 ++++--- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/Prometheus/install_Prometheus.sh b/Prometheus/install_Prometheus.sh index 8f10731..c39f919 100644 --- a/Prometheus/install_Prometheus.sh +++ b/Prometheus/install_Prometheus.sh @@ -27,11 +27,12 @@ TARGET="/tmp/prometheus-3.9.1.linux-amd64.tar.gz" is_cn=false echo "Detecting geographic location..." -COUNTRY=$(curl -s --max-time 5 https://ipinfo.littlediary.cn/info | grep -o '"countryName":"[^"]*"' | cut -d'"' -f4) - -if [ "$COUNTRY" = "China" ]; then +COUNTRY=$(curl -s --max-time 3 https://ipinfo.littlediary.cn/country || true) +if [ "$COUNTRY" = "CN" ]; then is_cn=true fi + + if [ "$is_cn" = true ]; then echo "Geolocation: China mainland detected" DOWNLOAD_URL="$CN_URL" diff --git a/Prometheus/install_cAdvisor.sh b/Prometheus/install_cAdvisor.sh index ea5784b..b073888 100644 --- a/Prometheus/install_cAdvisor.sh +++ b/Prometheus/install_cAdvisor.sh @@ -24,11 +24,12 @@ TARGET=/tmp/cAdvisor is_cn=false echo "Detecting geographic location..." -COUNTRY=$(curl -s --max-time 5 https://ipinfo.littlediary.cn/info | grep -o '"countryName":"[^"]*"' | cut -d'"' -f4) - -if [ "$COUNTRY" = "China" ]; then +COUNTRY=$(curl -s --max-time 3 https://ipinfo.littlediary.cn/country || true) +if [ "$COUNTRY" = "CN" ]; then is_cn=true fi + + if [ "$is_cn" = true ]; then echo "Geolocation: China mainland detected" DOWNLOAD_URL="$CN_URL" diff --git a/Prometheus/install_mysqld_exporter.sh b/Prometheus/install_mysqld_exporter.sh index d740236..5bcb79b 100644 --- a/Prometheus/install_mysqld_exporter.sh +++ b/Prometheus/install_mysqld_exporter.sh @@ -27,11 +27,12 @@ TARGET="/tmp/mysqld_exporter-0.18.0.linux-amd64.tar.gz" is_cn=false echo "Detecting geographic location..." -COUNTRY=$(curl -s --max-time 5 https://ipinfo.littlediary.cn/info | grep -o '"countryName":"[^"]*"' | cut -d'"' -f4) - -if [ "$COUNTRY" = "China" ]; then +COUNTRY=$(curl -s --max-time 3 https://ipinfo.littlediary.cn/country || true) +if [ "$COUNTRY" = "CN" ]; then is_cn=true fi + + if [ "$is_cn" = true ]; then echo "Geolocation: China mainland detected" DOWNLOAD_URL="$CN_URL" diff --git a/Prometheus/install_node_exporter.sh b/Prometheus/install_node_exporter.sh index e143c35..faf541c 100644 --- a/Prometheus/install_node_exporter.sh +++ b/Prometheus/install_node_exporter.sh @@ -27,11 +27,12 @@ TARGET="/tmp/node_exporter.tar.gz" is_cn=false echo "Detecting geographic location..." -COUNTRY=$(curl -s --max-time 5 https://ipinfo.littlediary.cn/info | grep -o '"countryName":"[^"]*"' | cut -d'"' -f4) - -if [ "$COUNTRY" = "China" ]; then +COUNTRY=$(curl -s --max-time 3 https://ipinfo.littlediary.cn/country || true) +if [ "$COUNTRY" = "CN" ]; then is_cn=true fi + + if [ "$is_cn" = true ]; then echo "Geolocation: China mainland detected" DOWNLOAD_URL="$CN_URL" diff --git a/Prometheus/install_node_exporter_arm64.sh b/Prometheus/install_node_exporter_arm64.sh index e4c6182..5b76043 100644 --- a/Prometheus/install_node_exporter_arm64.sh +++ b/Prometheus/install_node_exporter_arm64.sh @@ -27,11 +27,12 @@ TARGET="/tmp/node_exporter.tar.gz" is_cn=false echo "Detecting geographic location..." -COUNTRY=$(curl -s --max-time 5 https://ipinfo.littlediary.cn/info | grep -o '"countryName":"[^"]*"' | cut -d'"' -f4) - -if [ "$COUNTRY" = "China" ]; then +COUNTRY=$(curl -s --max-time 3 https://ipinfo.littlediary.cn/country || true) +if [ "$COUNTRY" = "CN" ]; then is_cn=true fi + + if [ "$is_cn" = true ]; then echo "Geolocation: China mainland detected" DOWNLOAD_URL="$CN_URL"