init agent script (posix)

This commit is contained in:
uubulb 2024-11-30 02:39:56 +08:00
parent 6f92cf99b7
commit a55742748d
12 changed files with 379 additions and 513 deletions

View File

@ -1 +1 @@
1.0
Nezha Installation scripts (updated for v1)

163
agent/install.sh Normal file
View File

@ -0,0 +1,163 @@
#!/bin/sh
NZ_BASE_PATH="/opt/nezha"
NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
red='\033[0;31m'
green='\033[0;32m'
plain='\033[0m'
err() {
printf "${red}%s${plain}\n" "$*" >&2
}
success() {
printf "${green}%s${plain}\n" "$*"
}
sudo() {
myEUID=$(id -ru)
if [ "$myEUID" -ne 0 ]; then
if command -v sudo > /dev/null 2>&1; then
command sudo "$@"
else
err "ERROR: sudo is not installed on the system, the action cannot be proceeded."
exit 1
fi
else
"$@"
fi
}
deps_check() {
deps="wget unzip grep"
set -- "$api_list"
for dep in $deps; do
if ! command -v "$dep" >/dev/null 2>&1; then
err "$dep not found, please install it first."
exit 1
fi
done
}
geo_check() {
api_list="https://blog.cloudflare.com/cdn-cgi/trace https://developers.cloudflare.com/cdn-cgi/trace"
ua="Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0"
set -- "$api_list"
for url in $api_list; do
text="$(curl -A "$ua" -m 10 -s "$url")"
endpoint="$(echo "$text" | sed -n 's/.*h=\([^ ]*\).*/\1/p')"
if echo "$text" | grep -qw 'CN'; then
isCN=true
break
elif echo "$url" | grep -q "$endpoint"; then
break
fi
done
}
env_check() {
mach=$(uname -m)
case "$mach" in
amd64)
os_arch="amd64"
;;
i386|i686)
os_arch="386"
;;
aarch64|arm64)
os_arch="arm64"
;;
*arm*)
os_arch="arm"
;;
s390x)
os_arch="s390x"
;;
riscv64)
os_arch="riscv64"
;;
mips)
os_arch="mips"
;;
mipsel|mipsle)
os_arch="mipsle"
;;
*)
err "Unknown architecture: $uname"
exit 1
;;
esac
system=$(uname)
case "$system" in
*Linux*)
os="linux"
;;
*Darwin*)
os="darwin"
;;
*FreeBSD*)
os="freebsd"
;;
*)
err "Unknown architecture: $system"
exit 1
;;
esac
}
init() {
deps_check
env_check
## China_IP
if [ -z "$CN" ]; then
geo_check
if [ -n "$isCN" ]; then
CN=true
fi
fi
if [ -z "$CN" ]; then
GITHUB_URL="github.com"
else
GITHUB_URL="gitee.com"
fi
}
install() {
echo "Installing..."
if [ -z "$CN" ]; then
NZ_AGENT_URL="https://${GITHUB_URL}/nezhahq/agent/releases/latest/download/nezha-agent_linux_${os_arch}.zip"
else
NZ_AGENT_URL="https://${GITHUB_URL}/naibahq/agent/releases/latest/download/nezha-agent_linux_${os_arch}.zip"
fi
_cmd="wget -t 2 -T 60 -O /tmp/nezha-agent_${os}_${os_arch}.zip $NZ_AGENT_URL >/dev/null 2>&1"
if ! eval "$_cmd"; then
err "Download nezha-agent release failed, check your network connectivity"
exit 1
fi
sudo unzip -qo /tmp/nezha-agent_${os}_${os_arch}.zip -d $NZ_AGENT_PATH &&
sudo rm -rf /tmp/nezha-agent_${os}_${os_arch}.zip
path="$NZ_AGENT_PATH/config.yml"
if [ -f "$path" ]; then
random=$(LC_ALL=C tr -dc a-z0-9 </dev/urandom | head -c 5)
path=$(printf "%s" "$NZ_AGENT_PATH/config-$random.yml")
fi
_cmd="sudo $NZ_AGENT_PATH/nezha-agent service -c "$path" install"
if ! eval "$_cmd"; then
err "Install nezha-agent service failed"
exit 1
fi
success "nezha-agent successfully installed"
}
init
install

View File

@ -1,293 +0,0 @@
#!/bin/bash
#========================================================
# System Required: macOS 10.13+
# Description: Nezha Agent Install Script (macOS)
# Github: https://github.com/naiba/nezha
#========================================================
NZ_BASE_PATH="/opt/nezha"
NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
plain='\033[0m'
export PATH=$PATH:/usr/local/bin
pre_check() {
# check root
[[ $EUID -ne 0 ]] && echo -e "${red}ERROR: ${plain} This script must be run with the root user!\n" && exit 1
## os_arch
if [[ $(uname -m | grep 'x86_64') != "" ]]; then
os_arch="amd64"
elif [[ $(uname -m | grep 'arm64\|arm64e') != "" ]]; then
os_arch="arm64"
fi
## China_IP
if [[ -z "${CN}" ]]; then
if [[ $(curl -m 10 -s http://ip-api.com/json |grep 'country' |grep -q 'China') != "" ]]; then
echo "According to the information provided by ip-api.com, the current IP may be in China"
read -e -r -p "Is the installation done with a Chinese Mirror? [Y/n] (Custom Mirror Input 3):" input
case $input in
[yY][eE][sS] | [yY])
echo "Use Chinese Mirror"
CN=true
;;
[nN][oO] | [nN])
echo "No Use Chinese Mirror"
;;
[3])
echo "Use Custom Mirror"
read -e -r -p "Please enter a custom image (e.g. :dn-dao-github-mirror.daocloud.io), leave blank to nouse: " input
case $input in
*)
CUSTOM_MIRROR=$input
;;
esac
;;
*)
echo "No Use Chinese Mirror"
;;
esac
fi
fi
if [[ -n "${CUSTOM_MIRROR}" ]]; then
GITHUB_RAW_URL="gitee.com/naibahq/nezha/raw/master"
GITHUB_URL=$CUSTOM_MIRROR
else
if [[ -z "${CN}" ]]; then
GITHUB_RAW_URL="raw.githubusercontent.com/naiba/nezha/master"
GITHUB_URL="github.com"
else
GITHUB_RAW_URL="gitee.com/naibahq/nezha/raw/master"
GITHUB_URL="gitee.com"
fi
fi
}
before_show_menu() {
echo && echo -n -e "${yellow}* Press Enter to return to the main menu *${plain}" && read temp
show_menu
}
install_agent() {
echo -e "> Install Nezha Agent"
echo -e "Obtaining Agent version"
local version=$(curl -m 10 -sL "https://api.github.com/repos/nezhahq/agent/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
if [ ! -n "$version" ]; then
version=$(curl -m 10 -sL "https://gitee.com/api/v5/repos/naibahq/agent/releases/latest" | awk -F '"' '{for(i=1;i<=NF;i++){if($i=="tag_name"){print $(i+2)}}}')
fi
if [ ! -n "$version" ]; then
version=$(curl -m 10 -sL "https://fastly.jsdelivr.net/gh/nezhahq/agent/" | grep "option\.value" | awk -F "'" '{print $2}' | sed 's/nezhahq\/agent@/v/g')
fi
if [ ! -n "$version" ]; then
version=$(curl -m 10 -sL "https://gcore.jsdelivr.net/gh/nezhahq/agent/" | grep "option\.value" | awk -F "'" '{print $2}' | sed 's/nezhahq\/agent@/v/g')
fi
if [ ! -n "$version" ]; then
echo -e "Fail to obtaine agent version, please check if the network can link https://api.github.com/repos/nezhahq/agent/releases/latest"
return 0
else
echo -e "The current latest version is: ${version}"
fi
# Nezha Agent Folder
mkdir -p $NZ_AGENT_PATH
chmod -R 777 $NZ_AGENT_PATH
echo -e "Downloading Agent"
if [[ -z $CN ]]; then
NZ_AGENT_URL="https://${GITHUB_URL}/nezhahq/agent/releases/download/${version}/nezha-agent_darwin_${os_arch}.zip"
else
NZ_AGENT_URL="https://${GITHUB_URL}/naibahq/agent/releases/download/${version}/nezha-agent_darwin_${os_arch}.zip"
fi
curl -o nezha-agent_darwin_${os_arch}.zip -L -f --retry 2 --retry-max-time 60 $NZ_AGENT_URL >/dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e "${red}Fail to download agent, please check if the network can link ${GITHUB_URL}${plain}"
return 0
fi
unzip -qo nezha-agent_darwin_${os_arch}.zip &&
mv nezha-agent $NZ_AGENT_PATH &&
rm -rf nezha-agent_darwin_${os_arch}.zip README.md
if [ $# -ge 3 ]; then
modify_agent_config "$@"
else
modify_agent_config 0
fi
if [[ $# == 0 ]]; then
before_show_menu
fi
}
modify_agent_config() {
echo -e "> Modify Agent Configuration"
if [ $# -lt 3 ]; then
echo "Please add Agent in the admin panel first, record the secret" &&
read -ep "Please enter a domain that resolves to the IP where the panel is located (no CDN sets): " nz_grpc_host &&
read -ep "Please enter the panel RPC port (default 5555): " nz_grpc_port &&
read -ep "Please enter the Agent secret: " nz_client_secret &&
read -ep "Do you want to enable SSL/TLS encryption for the gRPC port (--tls)? Press [y] if yes, the default is not required, and users can press Enter to skip if you don't understand: " nz_grpc_proxy
grep -qiw 'Y' <<<"${nz_grpc_proxy}" && args='--tls'
if [[ -z "${nz_grpc_host}" || -z "${nz_client_secret}" ]]; then
echo -e "${red}All options cannot be empty${plain}"
before_show_menu
return 1
fi
if [[ -z "${nz_grpc_port}" ]]; then
nz_grpc_port=5555
fi
else
nz_grpc_host=$1
nz_grpc_port=$2
nz_client_secret=$3
shift 3
if [ $# -gt 0 ]; then
args=" $*"
fi
fi
${NZ_AGENT_PATH}/nezha-agent service install -s "$nz_grpc_host:$nz_grpc_port" -p $nz_client_secret $args >/dev/null 2>&1
if [ $? -ne 0 ]; then
${NZ_AGENT_PATH}/nezha-agent service uninstall >/dev/null 2>&1
${NZ_AGENT_PATH}/nezha-agent service install -s "$nz_grpc_host:$nz_grpc_port" -p $nz_client_secret $args >/dev/null 2>&1
fi
echo -e "Agent configuration ${green} modified successfully, please wait for agent self-restart to take effect${plain}"
#if [[ $# == 0 ]]; then
# before_show_menu
#fi
}
show_agent_log() {
echo -e "> > View Agent Log"
tail -n 10 /var/log/nezha-agent.err.log
if [[ $# == 0 ]]; then
before_show_menu
fi
}
uninstall_agent() {
echo -e "> Uninstall Agent"
${NZ_AGENT_PATH}/nezha-agent service uninstall
rm -rf $NZ_AGENT_PATH
clean_all
if [[ $# == 0 ]]; then
before_show_menu
fi
}
restart_agent() {
echo -e "> Restart Agent"
${NZ_AGENT_PATH}/nezha-agent service restart
if [[ $# == 0 ]]; then
before_show_menu
fi
}
clean_all() {
if [ -z "$(ls -A ${NZ_BASE_PATH})" ]; then
rm -rf ${NZ_BASE_PATH}
fi
}
show_usage() {
echo "Nezha Agent Management Script Usage: "
echo "--------------------------------------------------------"
echo "./nezha.sh install_agent - Install Agent"
echo "./nezha.sh modify_agent_config - Modify Agent Configuration"
echo "./nezha.sh show_agent_log - View Agent Log"
echo "./nezha.sh uninstall_agent - Uninstall Agent"
echo "./nezha.sh restart_agent - Restart Agent"
echo "./nezha.sh update_script - Update Script"
echo "--------------------------------------------------------"
}
show_menu() {
echo -e "
${green}Nezha Agent Management Script${plain} ${red}macOS${plain}
--- https://github.com/naiba/nezha ---
${green}1.${plain} Install Agent
${green}2.${plain} Modify Agent Configuration
${green}3.${plain} View Agent Log
${green}4.${plain} Uninstall Agent
${green}5.${plain} Restart Agent
————————————————-
${green}0.${plain} Exit Script
"
echo && read -ep "Please enter [0-5]: " num
case "${num}" in
0)
exit 0
;;
1)
install_agent
;;
2)
modify_agent_config
;;
3)
show_agent_log
;;
4)
uninstall_agent
;;
5)
restart_agent
;;
*)
echo -e "${red}Please enter the correct number [0-5]${plain}"
;;
esac
}
pre_check
if [[ $# > 0 ]]; then
case $1 in
"install_agent")
shift
if [ $# -ge 3 ]; then
install_agent "$@"
else
install_agent 0
fi
;;
"modify_agent_config")
modify_agent_config 0
;;
"show_agent_log")
show_agent_log 0
;;
"uninstall_agent")
uninstall_agent 0
;;
"restart_agent")
restart_agent 0
;;
*) show_usage ;;
esac
else
show_menu
fi

View File

@ -25,7 +25,7 @@ info() {
println() {
printf "$*\n"
}
sudo() {
myEUID=$(id -ru)
if [ "$myEUID" -ne 0 ]; then
@ -536,12 +536,12 @@ uninstall_dashboard_standalone() {
show_usage() {
echo "哪吒监控 管理脚本使用方法: "
echo "--------------------------------------------------------"
echo "./nezha.sh - 显示管理菜单"
echo "./nezha.sh install_dashboard - 安装面板端"
echo "./nezha.sh modify_dashboard_config - 修改面板配置"
echo "./nezha.sh restart_and_update - 重启并更新面板"
echo "./nezha.sh show_dashboard_log - 查看面板日志"
echo "./nezha.sh uninstall_dashboard - 卸载管理面板"
echo "./nezha.sh - 显示管理菜单"
echo "./nezha.sh install - 安装面板端"
echo "./nezha.sh modify_config - 修改面板配置"
echo "./nezha.sh restart_and_update - 重启并更新面板"
echo "./nezha.sh show_log - 查看面板日志"
echo "./nezha.sh uninstall - 卸载管理面板"
echo "--------------------------------------------------------"
}
@ -591,20 +591,20 @@ init
if [ $# -gt 0 ]; then
case $1 in
"install_dashboard")
install_dashboard 0
"install")
install 0
;;
"modify_dashboard_config")
modify_dashboard_config 0
"modify_config")
modify_config 0
;;
"restart_and_update")
restart_and_update 0
;;
"show_dashboard_log")
show_dashboard_log 0
"show_log")
show_log 0
;;
"uninstall_dashboard")
uninstall_dashboard 0
"uninstall")
uninstall 0
;;
"update_script")
update_script 0

View File

@ -25,7 +25,7 @@ info() {
println() {
printf "$*\n"
}
sudo() {
myEUID=$(id -ru)
if [ "$myEUID" -ne 0 ]; then
@ -536,12 +536,12 @@ uninstall_dashboard_standalone() {
show_usage() {
echo "Nezha Monitor Management Script Usage: "
echo "--------------------------------------------------------"
echo "./nezha.sh - Show Menu"
echo "./nezha.sh install_dashboard - Install Dashboard"
echo "./nezha.sh modify_dashboard_config - Modify Dashboard Configuration"
echo "./nezha.sh restart_and_update - Restart and Update the Dashboard"
echo "./nezha.sh show_dashboard_log - View Dashboard Log"
echo "./nezha.sh uninstall_dashboard - Uninstall Dashboard"
echo "./nezha.sh - Show Menu"
echo "./nezha.sh install - Install Dashboard"
echo "./nezha.sh modify_config - Modify Dashboard Configuration"
echo "./nezha.sh restart_and_update - Restart and Update the Dashboard"
echo "./nezha.sh show_log - View Dashboard Log"
echo "./nezha.sh uninstall - Uninstall Dashboard"
echo "--------------------------------------------------------"
}
@ -591,20 +591,20 @@ init
if [ $# -gt 0 ]; then
case $1 in
"install_dashboard")
install_dashboard 0
"install")
install 0
;;
"modify_dashboard_config")
modify_dashboard_config 0
"modify_config")
modify_config 0
;;
"restart_and_update")
restart_and_update 0
;;
"show_dashboard_log")
show_dashboard_log 0
"show_log")
show_log 0
;;
"uninstall_dashboard")
uninstall_dashboard 0
"uninstall")
uninstall 0
;;
"update_script")
update_script 0

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-11-29 19:59+0800\n"
"POT-Creation-Date: 2024-11-29 21:03+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -104,187 +104,186 @@ msgstr ""
msgid "* Press Enter to return to the main menu *"
msgstr ""
#: nezha/template.sh:265
#: nezha/template.sh:262
msgid "> Install"
msgstr ""
#: nezha/template.sh:271
#: nezha/template.sh:268
msgid ""
"You may have already installed the dashboard, repeated installation will "
"overwrite the data, please pay attention to backup."
msgstr ""
#: nezha/template.sh:272
#: nezha/template.sh:269
msgid "Exit the installation? [Y/n]"
msgstr ""
#: nezha/template.sh:276 nezha/template.sh:284
#: nezha/template.sh:273 nezha/template.sh:281
msgid "Exit the installation"
msgstr ""
#: nezha/template.sh:280
#: nezha/template.sh:277
msgid "Continue"
msgstr ""
#: nezha/template.sh:298
#: nezha/template.sh:295
msgid "Modify Configuration"
msgstr ""
#: nezha/template.sh:302
#: nezha/template.sh:299
msgid "Download Docker Script"
msgstr ""
#: nezha/template.sh:305 nezha/template.sh:316
#: nezha/template.sh:302 nezha/template.sh:313
msgid ""
"Script failed to get, please check if the network can link ${GITHUB_RAW_URL}"
msgstr ""
#: nezha/template.sh:309
#: nezha/template.sh:306
msgid ""
"Please install docker-compose manually. https://docs.docker.com/compose/"
"install/linux/"
msgstr ""
#: nezha/template.sh:321
#: nezha/template.sh:318
msgid "Please enter the site title: "
msgstr ""
#: nezha/template.sh:323
#: nezha/template.sh:320
msgid "Please enter the exposed port: (default 8008)"
msgstr ""
#: nezha/template.sh:325
#: nezha/template.sh:322
msgid "Please specify the backend locale"
msgstr ""
#: nezha/template.sh:330
#: nezha/template.sh:327
msgid "Please enter [1-3]: "
msgstr ""
#: nezha/template.sh:346
#: nezha/template.sh:343
msgid "Please enter the correct number [1-3]"
msgstr ""
#: nezha/template.sh:352
#: nezha/template.sh:349
msgid "All options cannot be empty"
msgstr ""
#: nezha/template.sh:376
#: nezha/template.sh:373
msgid "Downloading service file"
msgstr ""
#: nezha/template.sh:380 nezha/template.sh:386
#: nezha/template.sh:377 nezha/template.sh:383
msgid ""
"File failed to get, please check if the network can link ${GITHUB_RAW_URL}"
msgstr ""
#: nezha/template.sh:394
#: nezha/template.sh:391
msgid ""
"Dashboard configuration modified successfully, please wait for Dashboard "
"self-restart to take effect"
msgstr ""
#: nezha/template.sh:404
#: nezha/template.sh:401
msgid "> Restart and Update"
msgstr ""
#: nezha/template.sh:413
#: nezha/template.sh:410
msgid "Nezha Monitoring Restart Successful"
msgstr ""
#: nezha/template.sh:414
#: nezha/template.sh:411
msgid "Default address: domain:site_access_port"
msgstr ""
#: nezha/template.sh:416
#: nezha/template.sh:413
msgid ""
"The restart failed, probably because the boot time exceeded two seconds, "
"please check the log information later"
msgstr ""
#: nezha/template.sh:443
#: nezha/template.sh:440
msgid ""
"Fail to obtain Dashboard version, please check if the network can link "
"https://api.github.com/repos/nezhahq/nezha/releases/latest"
msgstr ""
#: nezha/template.sh:446
#: nezha/template.sh:443
msgid "The current latest version is: ${_version}"
msgstr ""
#: nezha/template.sh:477
#: nezha/template.sh:472
msgid "> View Log"
msgstr ""
#: nezha/template.sh:503
#: nezha/template.sh:498
msgid "> Uninstall"
msgstr ""
#: nezha/template.sh:550
#: nezha/template.sh:537
msgid "Nezha Monitor Management Script Usage: "
msgstr ""
#: nezha/template.sh:552
msgid "./nezha.sh - Show Menu"
#: nezha/template.sh:539
msgid "./nezha.sh - Show Menu"
msgstr ""
#: nezha/template.sh:553
msgid "./nezha.sh install_dashboard - Install Dashboard"
#: nezha/template.sh:540
msgid "./nezha.sh install - Install Dashboard"
msgstr ""
#: nezha/template.sh:554
msgid "./nezha.sh modify_dashboard_config - Modify Dashboard Configuration"
#: nezha/template.sh:541
msgid "./nezha.sh modify_config - Modify Dashboard Configuration"
msgstr ""
#: nezha/template.sh:555
msgid ""
"./nezha.sh restart_and_update - Restart and Update the Dashboard"
#: nezha/template.sh:542
msgid "./nezha.sh restart_and_update - Restart and Update the Dashboard"
msgstr ""
#: nezha/template.sh:556
msgid "./nezha.sh show_dashboard_log - View Dashboard Log"
#: nezha/template.sh:543
msgid "./nezha.sh show_log - View Dashboard Log"
msgstr ""
#: nezha/template.sh:557
msgid "./nezha.sh uninstall_dashboard - Uninstall Dashboard"
#: nezha/template.sh:544
msgid "./nezha.sh uninstall - Uninstall Dashboard"
msgstr ""
#: nezha/template.sh:562
#: nezha/template.sh:549
msgid "${green}Nezha Monitor Management Script${plain}"
msgstr ""
#: nezha/template.sh:564
#: nezha/template.sh:551
msgid "${green}1.${plain} Install Dashboard"
msgstr ""
#: nezha/template.sh:565
#: nezha/template.sh:552
msgid "${green}2.${plain} Modify Dashboard Configuration"
msgstr ""
#: nezha/template.sh:566
#: nezha/template.sh:553
msgid "${green}3.${plain} Restart and Update Dashboard"
msgstr ""
#: nezha/template.sh:567
#: nezha/template.sh:554
msgid "${green}4.${plain} View Dashboard Log"
msgstr ""
#: nezha/template.sh:568
#: nezha/template.sh:555
msgid "${green}5.${plain} Uninstall Dashboard"
msgstr ""
#: nezha/template.sh:570
#: nezha/template.sh:557
msgid "${green}6.${plain} Update Script"
msgstr ""
#: nezha/template.sh:572
#: nezha/template.sh:559
msgid "${green}0.${plain} Exit Script"
msgstr ""
#: nezha/template.sh:574
#: nezha/template.sh:561
msgid "Please enter [0-6]: "
msgstr ""
#: nezha/template.sh:598
#: nezha/template.sh:585
msgid "Please enter the correct number [0-6]"
msgstr ""

View File

@ -25,7 +25,7 @@ info() {
println() {
printf "$*\n"
}
sudo() {
myEUID=$(id -ru)
if [ "$myEUID" -ne 0 ]; then
@ -536,12 +536,12 @@ uninstall_dashboard_standalone() {
show_usage() {
echo _("Nezha Monitor Management Script Usage: ")
echo "--------------------------------------------------------"
echo _("./nezha.sh - Show Menu")
echo _("./nezha.sh install_dashboard - Install Dashboard")
echo _("./nezha.sh modify_dashboard_config - Modify Dashboard Configuration")
echo _("./nezha.sh restart_and_update - Restart and Update the Dashboard")
echo _("./nezha.sh show_dashboard_log - View Dashboard Log")
echo _("./nezha.sh uninstall_dashboard - Uninstall Dashboard")
echo _("./nezha.sh - Show Menu")
echo _("./nezha.sh install - Install Dashboard")
echo _("./nezha.sh modify_config - Modify Dashboard Configuration")
echo _("./nezha.sh restart_and_update - Restart and Update the Dashboard")
echo _("./nezha.sh show_log - View Dashboard Log")
echo _("./nezha.sh uninstall - Uninstall Dashboard")
echo "--------------------------------------------------------"
}
@ -591,20 +591,20 @@ init
if [ $# -gt 0 ]; then
case $1 in
"install_dashboard")
install_dashboard 0
"install")
install 0
;;
"modify_dashboard_config")
modify_dashboard_config 0
"modify_config")
modify_config 0
;;
"restart_and_update")
restart_and_update 0
;;
"show_dashboard_log")
show_dashboard_log 0
"show_log")
show_log 0
;;
"uninstall_dashboard")
uninstall_dashboard 0
"uninstall")
uninstall 0
;;
"update_script")
update_script 0

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-11-29 19:59+0800\n"
"PO-Revision-Date: 2024-11-29 19:59+0800\n"
"POT-Creation-Date: 2024-11-29 21:03+0800\n"
"PO-Revision-Date: 2024-11-29 21:03+0800\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: en_US\n"
@ -111,11 +111,11 @@ msgstr "Execute new script after 3s"
msgid "* Press Enter to return to the main menu *"
msgstr "* Press Enter to return to the main menu *"
#: nezha/template.sh:265
#: nezha/template.sh:262
msgid "> Install"
msgstr "> Install"
#: nezha/template.sh:271
#: nezha/template.sh:268
msgid ""
"You may have already installed the dashboard, repeated installation will "
"overwrite the data, please pay attention to backup."
@ -123,33 +123,33 @@ msgstr ""
"You may have already installed the dashboard, repeated installation will "
"overwrite the data, please pay attention to backup."
#: nezha/template.sh:272
#: nezha/template.sh:269
msgid "Exit the installation? [Y/n]"
msgstr "Exit the installation? [Y/n]"
#: nezha/template.sh:276 nezha/template.sh:284
#: nezha/template.sh:273 nezha/template.sh:281
msgid "Exit the installation"
msgstr "Exit the installation"
#: nezha/template.sh:280
#: nezha/template.sh:277
msgid "Continue"
msgstr "Continue"
#: nezha/template.sh:298
#: nezha/template.sh:295
msgid "Modify Configuration"
msgstr "Modify Configuration"
#: nezha/template.sh:302
#: nezha/template.sh:299
msgid "Download Docker Script"
msgstr "Download Docker Script"
#: nezha/template.sh:305 nezha/template.sh:316
#: nezha/template.sh:302 nezha/template.sh:313
msgid ""
"Script failed to get, please check if the network can link ${GITHUB_RAW_URL}"
msgstr ""
"Script failed to get, please check if the network can link ${GITHUB_RAW_URL}"
#: nezha/template.sh:309
#: nezha/template.sh:306
msgid ""
"Please install docker-compose manually. https://docs.docker.com/compose/"
"install/linux/"
@ -157,41 +157,41 @@ msgstr ""
"Please install docker-compose manually. https://docs.docker.com/compose/"
"install/linux/"
#: nezha/template.sh:321
#: nezha/template.sh:318
msgid "Please enter the site title: "
msgstr "Please enter the site title: "
#: nezha/template.sh:323
#: nezha/template.sh:320
msgid "Please enter the exposed port: (default 8008)"
msgstr "Please enter the exposed port: (default 8008)"
#: nezha/template.sh:325
#: nezha/template.sh:322
msgid "Please specify the backend locale"
msgstr "Please specify the backend locale"
#: nezha/template.sh:330
#: nezha/template.sh:327
msgid "Please enter [1-3]: "
msgstr "Please enter [1-3]: "
#: nezha/template.sh:346
#: nezha/template.sh:343
msgid "Please enter the correct number [1-3]"
msgstr "Please enter the correct number [1-3]"
#: nezha/template.sh:352
#: nezha/template.sh:349
msgid "All options cannot be empty"
msgstr "All options cannot be empty"
#: nezha/template.sh:376
#: nezha/template.sh:373
msgid "Downloading service file"
msgstr "Downloading service file"
#: nezha/template.sh:380 nezha/template.sh:386
#: nezha/template.sh:377 nezha/template.sh:383
msgid ""
"File failed to get, please check if the network can link ${GITHUB_RAW_URL}"
msgstr ""
"File failed to get, please check if the network can link ${GITHUB_RAW_URL}"
#: nezha/template.sh:394
#: nezha/template.sh:391
msgid ""
"Dashboard configuration modified successfully, please wait for Dashboard "
"self-restart to take effect"
@ -199,19 +199,19 @@ msgstr ""
"Dashboard configuration modified successfully, please wait for Dashboard "
"self-restart to take effect"
#: nezha/template.sh:404
#: nezha/template.sh:401
msgid "> Restart and Update"
msgstr "> Restart and Update"
#: nezha/template.sh:413
#: nezha/template.sh:410
msgid "Nezha Monitoring Restart Successful"
msgstr "Nezha Monitoring Restart Successful"
#: nezha/template.sh:414
#: nezha/template.sh:411
msgid "Default address: domain:site_access_port"
msgstr "Default address: domain:site_access_port"
#: nezha/template.sh:416
#: nezha/template.sh:413
msgid ""
"The restart failed, probably because the boot time exceeded two seconds, "
"please check the log information later"
@ -219,92 +219,90 @@ msgstr ""
"The restart failed, probably because the boot time exceeded two seconds, "
"please check the log information later"
#: nezha/template.sh:440
msgid ""
"Fail to obtain Dashboard version, please check if the network can link "
"https://api.github.com/repos/nezhahq/nezha/releases/latest"
msgstr ""
"Fail to obtain Dashboard version, please check if the network can link "
"https://api.github.com/repos/nezhahq/nezha/releases/latest"
#: nezha/template.sh:443
msgid ""
"Fail to obtain Dashboard version, please check if the network can link "
"https://api.github.com/repos/nezhahq/nezha/releases/latest"
msgstr ""
"Fail to obtain Dashboard version, please check if the network can link "
"https://api.github.com/repos/nezhahq/nezha/releases/latest"
#: nezha/template.sh:446
msgid "The current latest version is: ${_version}"
msgstr "The current latest version is: ${_version}"
#: nezha/template.sh:477
#: nezha/template.sh:472
msgid "> View Log"
msgstr "> View Log"
#: nezha/template.sh:503
#: nezha/template.sh:498
msgid "> Uninstall"
msgstr "> Uninstall"
#: nezha/template.sh:550
#: nezha/template.sh:537
msgid "Nezha Monitor Management Script Usage: "
msgstr "Nezha Monitor Management Script Usage: "
#: nezha/template.sh:552
msgid "./nezha.sh - Show Menu"
msgstr "./nezha.sh - Show Menu"
#: nezha/template.sh:539
msgid "./nezha.sh - Show Menu"
msgstr "./nezha.sh - Show Menu"
#: nezha/template.sh:553
msgid "./nezha.sh install_dashboard - Install Dashboard"
msgstr "./nezha.sh install_dashboard - Install Dashboard"
#: nezha/template.sh:540
msgid "./nezha.sh install - Install Dashboard"
msgstr "./nezha.sh install - Install Dashboard"
#: nezha/template.sh:554
msgid "./nezha.sh modify_dashboard_config - Modify Dashboard Configuration"
msgstr "./nezha.sh modify_dashboard_config - Modify Dashboard Configuration"
#: nezha/template.sh:541
msgid "./nezha.sh modify_config - Modify Dashboard Configuration"
msgstr "./nezha.sh modify_config - Modify Dashboard Configuration"
#: nezha/template.sh:555
msgid ""
"./nezha.sh restart_and_update - Restart and Update the Dashboard"
msgstr ""
"./nezha.sh restart_and_update - Restart and Update the Dashboard"
#: nezha/template.sh:542
msgid "./nezha.sh restart_and_update - Restart and Update the Dashboard"
msgstr "./nezha.sh restart_and_update - Restart and Update the Dashboard"
#: nezha/template.sh:556
msgid "./nezha.sh show_dashboard_log - View Dashboard Log"
msgstr "./nezha.sh show_dashboard_log - View Dashboard Log"
#: nezha/template.sh:543
msgid "./nezha.sh show_log - View Dashboard Log"
msgstr "./nezha.sh show_log - View Dashboard Log"
#: nezha/template.sh:557
msgid "./nezha.sh uninstall_dashboard - Uninstall Dashboard"
msgstr "./nezha.sh uninstall_dashboard - Uninstall Dashboard"
#: nezha/template.sh:544
msgid "./nezha.sh uninstall - Uninstall Dashboard"
msgstr "./nezha.sh uninstall - Uninstall Dashboard"
#: nezha/template.sh:562
#: nezha/template.sh:549
msgid "${green}Nezha Monitor Management Script${plain}"
msgstr "${green}Nezha Monitor Management Script${plain}"
#: nezha/template.sh:564
#: nezha/template.sh:551
msgid "${green}1.${plain} Install Dashboard"
msgstr "${green}1.${plain} Install Dashboard"
#: nezha/template.sh:565
#: nezha/template.sh:552
msgid "${green}2.${plain} Modify Dashboard Configuration"
msgstr "${green}2.${plain} Modify Dashboard Configuration"
#: nezha/template.sh:566
#: nezha/template.sh:553
msgid "${green}3.${plain} Restart and Update Dashboard"
msgstr "${green}3.${plain} Restart and Update Dashboard"
#: nezha/template.sh:567
#: nezha/template.sh:554
msgid "${green}4.${plain} View Dashboard Log"
msgstr "${green}4.${plain} View Dashboard Log"
#: nezha/template.sh:568
#: nezha/template.sh:555
msgid "${green}5.${plain} Uninstall Dashboard"
msgstr "${green}5.${plain} Uninstall Dashboard"
#: nezha/template.sh:570
#: nezha/template.sh:557
msgid "${green}6.${plain} Update Script"
msgstr "${green}6.${plain} Update Script"
#: nezha/template.sh:572
#: nezha/template.sh:559
msgid "${green}0.${plain} Exit Script"
msgstr "${green}0.${plain} Exit Script"
#: nezha/template.sh:574
#: nezha/template.sh:561
msgid "Please enter [0-6]: "
msgstr "Please enter [0-6]: "
#: nezha/template.sh:598
#: nezha/template.sh:585
msgid "Please enter the correct number [0-6]"
msgstr "Please enter the correct number [0-6]"

View File

@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-11-29 19:59+0800\n"
"PO-Revision-Date: 2024-11-29 20:00+0800\n"
"POT-Creation-Date: 2024-11-29 21:03+0800\n"
"PO-Revision-Date: 2024-11-29 21:05+0800\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: zh_CN\n"
@ -106,106 +106,106 @@ msgstr "3s后执行新脚本"
msgid "* Press Enter to return to the main menu *"
msgstr "* 按回车返回主菜单 *"
#: nezha/template.sh:265
#: nezha/template.sh:262
msgid "> Install"
msgstr "> 安装"
#: nezha/template.sh:271
#: nezha/template.sh:268
msgid ""
"You may have already installed the dashboard, repeated installation will "
"overwrite the data, please pay attention to backup."
msgstr "您可能已经安装过面板端,重复安装会覆盖数据,请注意备份。"
#: nezha/template.sh:272
#: nezha/template.sh:269
msgid "Exit the installation? [Y/n]"
msgstr "是否退出安装? [Y/n]"
#: nezha/template.sh:276 nezha/template.sh:284
#: nezha/template.sh:273 nezha/template.sh:281
msgid "Exit the installation"
msgstr "退出安装"
#: nezha/template.sh:280
#: nezha/template.sh:277
msgid "Continue"
msgstr "继续安装"
#: nezha/template.sh:298
#: nezha/template.sh:295
msgid "Modify Configuration"
msgstr "> 修改配置"
#: nezha/template.sh:302
#: nezha/template.sh:299
msgid "Download Docker Script"
msgstr "正在下载 Docker 脚本"
#: nezha/template.sh:305 nezha/template.sh:316
#: nezha/template.sh:302 nezha/template.sh:313
msgid ""
"Script failed to get, please check if the network can link ${GITHUB_RAW_URL}"
msgstr "脚本获取失败,请检查本机能否链接 ${GITHUB_RAW_URL}"
#: nezha/template.sh:309
#: nezha/template.sh:306
msgid ""
"Please install docker-compose manually. https://docs.docker.com/compose/"
"install/linux/"
msgstr ""
"请手动安装 docker-compose。 https://docs.docker.com/compose/install/linux/"
#: nezha/template.sh:321
#: nezha/template.sh:318
msgid "Please enter the site title: "
msgstr "请输入站点标题: "
#: nezha/template.sh:323
#: nezha/template.sh:320
msgid "Please enter the exposed port: (default 8008)"
msgstr "请输入暴露端口: (默认 8008)"
#: nezha/template.sh:325
#: nezha/template.sh:322
msgid "Please specify the backend locale"
msgstr "请指定后台语言"
#: nezha/template.sh:330
#: nezha/template.sh:327
msgid "Please enter [1-3]: "
msgstr "请输入选项 [1-3]"
#: nezha/template.sh:346
#: nezha/template.sh:343
msgid "Please enter the correct number [1-3]"
msgstr "请输入正确的选项 [1-3]"
#: nezha/template.sh:352
#: nezha/template.sh:349
msgid "All options cannot be empty"
msgstr "\"所有选项都不能为空\""
#: nezha/template.sh:376
#: nezha/template.sh:373
msgid "Downloading service file"
msgstr "正在下载服务文件"
#: nezha/template.sh:380 nezha/template.sh:386
#: nezha/template.sh:377 nezha/template.sh:383
msgid ""
"File failed to get, please check if the network can link ${GITHUB_RAW_URL}"
msgstr "文件下载失败,请检查本机能否连接 ${GITHUB_RAW_URL}"
#: nezha/template.sh:394
#: nezha/template.sh:391
msgid ""
"Dashboard configuration modified successfully, please wait for Dashboard "
"self-restart to take effect"
msgstr "Dashboard 配置 修改成功,请稍等 Dashboard 重启生效"
#: nezha/template.sh:404
#: nezha/template.sh:401
msgid "> Restart and Update"
msgstr "> 重启并更新"
#: nezha/template.sh:413
#: nezha/template.sh:410
msgid "Nezha Monitoring Restart Successful"
msgstr "哪吒监控 重启成功"
#: nezha/template.sh:414
#: nezha/template.sh:411
msgid "Default address: domain:site_access_port"
msgstr "默认地址:域名:站点访问端口"
#: nezha/template.sh:416
#: nezha/template.sh:413
msgid ""
"The restart failed, probably because the boot time exceeded two seconds, "
"please check the log information later"
msgstr "重启失败,可能是因为启动时间超过了两秒,请稍后查看日志信息"
#: nezha/template.sh:443
#: nezha/template.sh:440
msgid ""
"Fail to obtain Dashboard version, please check if the network can link "
"https://api.github.com/repos/nezhahq/nezha/releases/latest"
@ -213,84 +213,83 @@ msgstr ""
"获取 Dashboard 版本号失败,请检查本机能否链接 https://api.github.com/repos/"
"nezhahq/nezha/releases/latest"
#: nezha/template.sh:446
#: nezha/template.sh:443
msgid "The current latest version is: ${_version}"
msgstr "当前最新版本为: ${_version}"
#: nezha/template.sh:477
#: nezha/template.sh:472
msgid "> View Log"
msgstr "> 获取日志"
#: nezha/template.sh:503
#: nezha/template.sh:498
msgid "> Uninstall"
msgstr "> 卸载"
#: nezha/template.sh:550
#: nezha/template.sh:537
msgid "Nezha Monitor Management Script Usage: "
msgstr "哪吒监控 管理脚本使用方法: "
#: nezha/template.sh:552
msgid "./nezha.sh - Show Menu"
msgstr "./nezha.sh - 显示管理菜单"
#: nezha/template.sh:539
msgid "./nezha.sh - Show Menu"
msgstr "./nezha.sh - 显示管理菜单"
#: nezha/template.sh:553
msgid "./nezha.sh install_dashboard - Install Dashboard"
msgstr "./nezha.sh install_dashboard - 安装面板端"
#: nezha/template.sh:540
msgid "./nezha.sh install - Install Dashboard"
msgstr "./nezha.sh install - 安装面板端"
#: nezha/template.sh:554
msgid "./nezha.sh modify_dashboard_config - Modify Dashboard Configuration"
msgstr "./nezha.sh modify_dashboard_config - 修改面板配置"
#: nezha/template.sh:541
msgid "./nezha.sh modify_config - Modify Dashboard Configuration"
msgstr "./nezha.sh modify_config - 修改面板配置"
#: nezha/template.sh:555
msgid ""
"./nezha.sh restart_and_update - Restart and Update the Dashboard"
msgstr "./nezha.sh restart_and_update - 重启并更新面板"
#: nezha/template.sh:542
msgid "./nezha.sh restart_and_update - Restart and Update the Dashboard"
msgstr "./nezha.sh restart_and_update - 重启并更新面板"
#: nezha/template.sh:556
msgid "./nezha.sh show_dashboard_log - View Dashboard Log"
msgstr "./nezha.sh show_dashboard_log - 查看面板日志"
#: nezha/template.sh:543
msgid "./nezha.sh show_log - View Dashboard Log"
msgstr "./nezha.sh show_log - 查看面板日志"
#: nezha/template.sh:557
msgid "./nezha.sh uninstall_dashboard - Uninstall Dashboard"
msgstr "./nezha.sh uninstall_dashboard - 卸载管理面板"
#: nezha/template.sh:544
msgid "./nezha.sh uninstall - Uninstall Dashboard"
msgstr "./nezha.sh uninstall - 卸载管理面板"
#: nezha/template.sh:562
#: nezha/template.sh:549
msgid "${green}Nezha Monitor Management Script${plain}"
msgstr "${green}哪吒监控管理脚本${plain}"
#: nezha/template.sh:564
#: nezha/template.sh:551
msgid "${green}1.${plain} Install Dashboard"
msgstr "${green}1.${plain} 安装面板端"
#: nezha/template.sh:565
#: nezha/template.sh:552
msgid "${green}2.${plain} Modify Dashboard Configuration"
msgstr "${green}2.${plain} 修改面板配置"
#: nezha/template.sh:566
#: nezha/template.sh:553
msgid "${green}3.${plain} Restart and Update Dashboard"
msgstr "${green}3.${plain} 重启并更新面板"
#: nezha/template.sh:567
#: nezha/template.sh:554
msgid "${green}4.${plain} View Dashboard Log"
msgstr "${green}4.${plain} 查看面板日志"
#: nezha/template.sh:568
#: nezha/template.sh:555
msgid "${green}5.${plain} Uninstall Dashboard"
msgstr "${green}5.${plain} 卸载管理面板"
#: nezha/template.sh:570
#: nezha/template.sh:557
msgid "${green}6.${plain} Update Script"
msgstr "${green}6.${plain} 更新脚本"
#: nezha/template.sh:572
#: nezha/template.sh:559
msgid "${green}0.${plain} Exit Script"
msgstr "${green}0.${plain} 退出脚本"
#: nezha/template.sh:574
#: nezha/template.sh:561
msgid "Please enter [0-6]: "
msgstr "请输入选择 [0-6]: "
#: nezha/template.sh:598
#: nezha/template.sh:585
msgid "Please enter the correct number [0-6]"
msgstr "请输入正确的数字 [0-6]"