mirror of
https://github.com/nezhahq/nezha.git
synced 2025-02-02 09:38:13 -05:00
Merge branch 'master' of github.com:naiba/nezha
This commit is contained in:
commit
a09628ed42
2
.github/workflows/dashboard.yml
vendored
2
.github/workflows/dashboard.yml
vendored
@ -42,11 +42,13 @@ jobs:
|
|||||||
- name: Purge jsdelivr cache
|
- name: Purge jsdelivr cache
|
||||||
run: |
|
run: |
|
||||||
curl -s https://purge.jsdelivr.net/gh/${{ github.repository_owner }}/nezha@master/script/install.sh
|
curl -s https://purge.jsdelivr.net/gh/${{ github.repository_owner }}/nezha@master/script/install.sh
|
||||||
|
curl -s https://purge.jsdelivr.net/gh/${{ github.repository_owner }}/nezha@master/script/fetch.sh
|
||||||
curl -s https://purge.jsdelivr.net/gh/${{ github.repository_owner }}/nezha@master/script/nezha-agent.service
|
curl -s https://purge.jsdelivr.net/gh/${{ github.repository_owner }}/nezha@master/script/nezha-agent.service
|
||||||
curl -s https://purge.jsdelivr.net/gh/${{ github.repository_owner }}/nezha@master/script/docker-compose.yaml
|
curl -s https://purge.jsdelivr.net/gh/${{ github.repository_owner }}/nezha@master/script/docker-compose.yaml
|
||||||
curl -s https://purge.jsdelivr.net/gh/${{ github.repository_owner }}/nezha@master/script/config.yaml
|
curl -s https://purge.jsdelivr.net/gh/${{ github.repository_owner }}/nezha@master/script/config.yaml
|
||||||
LOWER_USERNAME=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
|
LOWER_USERNAME=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
|
||||||
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/nezha@master/script/install.sh
|
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/nezha@master/script/install.sh
|
||||||
|
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/nezha@master/script/fetch.sh
|
||||||
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/nezha@master/script/nezha-agent.service
|
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/nezha@master/script/nezha-agent.service
|
||||||
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/nezha@master/script/docker-compose.yaml
|
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/nezha@master/script/docker-compose.yaml
|
||||||
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/nezha@master/script/config.yaml
|
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/nezha@master/script/config.yaml
|
||||||
|
15
README.md
15
README.md
@ -1,7 +1,7 @@
|
|||||||
<div align="center" style="background-color: white">
|
<div align="center" style="background-color: white">
|
||||||
<img width="500" style="max-width:100%" src="https://raw.githubusercontent.com/naiba/nezha/master/resource/static/brand.png" title="哪吒监控">
|
<img width="500" style="max-width:100%" src="https://raw.githubusercontent.com/naiba/nezha/master/resource/static/brand.png" title="哪吒监控">
|
||||||
<br><br>
|
<br><br>
|
||||||
<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.7.1&logo=github&style=for-the-badge"> <img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github"> <img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge"> <img src="https://img.shields.io/badge/Installer-v0.5.0-brightgreen?style=for-the-badge&logo=linux">
|
<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.7.1&logo=github&style=for-the-badge"> <img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github"> <img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge"> <img src="https://img.shields.io/badge/Installer-v0.6.0-brightgreen?style=for-the-badge&logo=linux">
|
||||||
<br>
|
<br>
|
||||||
<p>:trollface: 哪吒监控 一站式轻监控轻运维系统。支持系统状态、HTTP(SSL 证书变更、即将到期、到期)、TCP、Ping 监控报警,命令批量执行和计划任务。</p>
|
<p>:trollface: 哪吒监控 一站式轻监控轻运维系统。支持系统状态、HTTP(SSL 证书变更、即将到期、到期)、TCP、Ping 监控报警,命令批量执行和计划任务。</p>
|
||||||
</div>
|
</div>
|
||||||
@ -21,15 +21,20 @@
|
|||||||
**推荐配置:** 安装前准备 _两个域名_,一个可以 **接入 CDN** 作为 _公开访问_,比如 (status.nai.ba);另外一个解析到面板服务器作为 Agent 连接 Dashboard 使用,**不能接入 CDN** 直接暴露面板主机 IP,比如(randomdashboard.nai.ba)。
|
**推荐配置:** 安装前准备 _两个域名_,一个可以 **接入 CDN** 作为 _公开访问_,比如 (status.nai.ba);另外一个解析到面板服务器作为 Agent 连接 Dashboard 使用,**不能接入 CDN** 直接暴露面板主机 IP,比如(randomdashboard.nai.ba)。
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh
|
curl -sSL https://raw.githubusercontent.com/naiba/nezha/master/script/fetch.sh | bash
|
||||||
./nezha.sh
|
/opt/nezha/nezha.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
国内镜像加速:
|
国内镜像加速:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
curl -L https://cdn.jsdelivr.net/gh/naiba/nezha@master/script/install.sh -o nezha.sh && chmod +x nezha.sh
|
curl -sSL https://cdn.jsdelivr.net/gh/naiba/nezha@master/script/fetch.sh | CN=true bash
|
||||||
CN=true ./nezha.sh
|
CN=true /opt/nezha/nezha.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
再次运行仅需:
|
||||||
|
```
|
||||||
|
/opt/nezha/nezha.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
_\* 使用 WatchTower 可以自动更新面板,Windows 终端可以使用 nssm 配置自启动(见尾部教程)_
|
_\* 使用 WatchTower 可以自动更新面板,Windows 终端可以使用 nssm 配置自启动(见尾部教程)_
|
||||||
|
9
script/fetch.sh
Normal file
9
script/fetch.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
if [[ -z "${CN}" ]]; then
|
||||||
|
GITHUB_RAW_URL="raw.githubusercontent.com/naiba/nezha/master"
|
||||||
|
else
|
||||||
|
GITHUB_RAW_URL="cdn.jsdelivr.net/gh/naiba/nezha@master"
|
||||||
|
fi
|
||||||
|
mkdir -p /opt/nezha
|
||||||
|
chmod 777 /opt/nezha
|
||||||
|
curl -sSL https://${GITHUB_RAW_URL}/script/install.sh -o /opt/nezha/nezha.sh
|
||||||
|
chmod +x /opt/nezha/nezha.sh
|
@ -11,7 +11,7 @@ NZ_BASE_PATH="/opt/nezha"
|
|||||||
NZ_DASHBOARD_PATH="${NZ_BASE_PATH}/dashboard"
|
NZ_DASHBOARD_PATH="${NZ_BASE_PATH}/dashboard"
|
||||||
NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
|
NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
|
||||||
NZ_AGENT_SERVICE="/etc/systemd/system/nezha-agent.service"
|
NZ_AGENT_SERVICE="/etc/systemd/system/nezha-agent.service"
|
||||||
NZ_VERSION="v0.5.0"
|
NZ_VERSION="v0.6.0"
|
||||||
|
|
||||||
red='\033[0;31m'
|
red='\033[0;31m'
|
||||||
green='\033[0;32m'
|
green='\033[0;32m'
|
||||||
@ -93,6 +93,28 @@ confirm() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update_script () {
|
||||||
|
echo -e "> 更新脚本"
|
||||||
|
|
||||||
|
mkdir -p $NZ_BASE_PATH
|
||||||
|
chmod 777 -R $NZ_BASE_PATH
|
||||||
|
curl -sL https://${GITHUB_RAW_URL}/script/install.sh -o /tmp/nezha.sh
|
||||||
|
new_version=$(cat /tmp/nezha.sh | grep "NZ_VERSION" | head -n 1 | awk -F "=" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
|
||||||
|
if [ ! -n "$new_version" ]; then
|
||||||
|
echo -e "脚本获取失败,请检查本机能否链接 https://${GITHUB_RAW_URL}/script/install.sh"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
echo -e "当前最新版本为: ${new_version}"
|
||||||
|
mv -f /tmp/nezha.sh ${NZ_BASE_PATH}/nezha.sh && chmod a+x ${NZ_BASE_PATH}/nezha.sh
|
||||||
|
|
||||||
|
echo -e "脚本获取成功,脚本固定位置为${NZ_BASE_PATH}/nezha.sh,请今后使用 ${NZ_BASE_PATH}/nezha.sh 运行脚本"
|
||||||
|
echo -e "10s后执行新脚本"
|
||||||
|
sleep 10s
|
||||||
|
clear
|
||||||
|
exec ${NZ_BASE_PATH}/nezha.sh
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
before_show_menu() {
|
before_show_menu() {
|
||||||
echo && echo -n -e "${yellow}* 按回车返回主菜单 *${plain}" && read temp
|
echo && echo -n -e "${yellow}* 按回车返回主菜单 *${plain}" && read temp
|
||||||
show_menu
|
show_menu
|
||||||
@ -156,12 +178,22 @@ install_agent() {
|
|||||||
|
|
||||||
echo -e "> 安装监控Agent"
|
echo -e "> 安装监控Agent"
|
||||||
|
|
||||||
|
echo -e "正在获取监控Agent版本号"
|
||||||
|
|
||||||
|
local version=$(curl -sL "https://api.github.com/repos/naiba/nezha/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
|
||||||
|
|
||||||
|
if [ ! -n "$version" ]; then
|
||||||
|
echo -e "获取版本号失败,请检查本机能否链接 https://api.github.com/repos/naiba/nezha/releases/latest"
|
||||||
|
else
|
||||||
|
echo -e "当前最新版本为: ${version}"
|
||||||
|
fi
|
||||||
|
|
||||||
# 哪吒监控文件夹
|
# 哪吒监控文件夹
|
||||||
mkdir -p $NZ_AGENT_PATH
|
mkdir -p $NZ_AGENT_PATH
|
||||||
chmod 777 -R $NZ_AGENT_PATH
|
chmod 777 -R $NZ_AGENT_PATH
|
||||||
|
|
||||||
echo -e "正在下载监控端"
|
echo -e "正在下载监控端"
|
||||||
wget -O nezha-agent_linux_${os_arch}.tar.gz https://${GITHUB_URL}/naiba/nezha/releases/latest/download/nezha-agent_linux_${os_arch}.tar.gz >/dev/null 2>&1
|
wget -O nezha-agent_linux_${os_arch}.tar.gz https://${GITHUB_URL}/naiba/nezha/releases/download/${version}/nezha-agent_linux_${os_arch}.tar.gz >/dev/null 2>&1
|
||||||
if [[ $? != 0 ]]; then
|
if [[ $? != 0 ]]; then
|
||||||
echo -e "${red}Release 下载失败,请检查本机能否连接 ${GITHUB_URL}${plain}"
|
echo -e "${red}Release 下载失败,请检查本机能否连接 ${GITHUB_URL}${plain}"
|
||||||
return 0
|
return 0
|
||||||
@ -394,20 +426,21 @@ clean_all() {
|
|||||||
show_usage() {
|
show_usage() {
|
||||||
echo "哪吒监控 管理脚本使用方法: "
|
echo "哪吒监控 管理脚本使用方法: "
|
||||||
echo "--------------------------------------------------------"
|
echo "--------------------------------------------------------"
|
||||||
echo "./nbdomain.sh - 显示管理菜单"
|
echo "/opt/nezha/nezha.sh - 显示管理菜单"
|
||||||
echo "./nbdomain.sh install_dashboard - 安装面板端"
|
echo "/opt/nezha/nezha.sh install_dashboard - 安装面板端"
|
||||||
echo "./nbdomain.sh modify_dashboard_config - 修改面板配置"
|
echo "/opt/nezha/nezha.sh modify_dashboard_config - 修改面板配置"
|
||||||
echo "./nbdomain.sh start_dashboard - 启动面板"
|
echo "/opt/nezha/nezha.sh start_dashboard - 启动面板"
|
||||||
echo "./nbdomain.sh stop_dashboard - 停止面板"
|
echo "/opt/nezha/nezha.sh stop_dashboard - 停止面板"
|
||||||
echo "./nbdomain.sh restart_and_update - 重启并更新面板"
|
echo "/opt/nezha/nezha.sh restart_and_update - 重启并更新面板"
|
||||||
echo "./nbdomain.sh show_dashboard_log - 查看面板日志"
|
echo "/opt/nezha/nezha.sh show_dashboard_log - 查看面板日志"
|
||||||
echo "./nbdomain.sh uninstall_dashboard - 卸载管理面板"
|
echo "/opt/nezha/nezha.sh uninstall_dashboard - 卸载管理面板"
|
||||||
echo "--------------------------------------------------------"
|
echo "--------------------------------------------------------"
|
||||||
echo "./nbdomain.sh install_agent - 安装监控Agent"
|
echo "/opt/nezha/nezha.sh install_agent - 安装监控Agent"
|
||||||
echo "./nbdomain.sh modify_agent_config - 修改Agent配置"
|
echo "/opt/nezha/nezha.sh modify_agent_config - 修改Agent配置"
|
||||||
echo "./nbdomain.sh show_agent_log - 查看Agent日志"
|
echo "/opt/nezha/nezha.sh show_agent_log - 查看Agent日志"
|
||||||
echo "./nbdomain.sh uninstall_agent - 卸载Agen"
|
echo "/opt/nezha/nezha.sh uninstall_agent - 卸载Agen"
|
||||||
echo "./nbdomain.sh restart_agent - 重启Agen"
|
echo "/opt/nezha/nezha.sh restart_agent - 重启Agen"
|
||||||
|
echo "/opt/nezha/nezha.sh update_script - 更新脚本"
|
||||||
echo "--------------------------------------------------------"
|
echo "--------------------------------------------------------"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,8 +448,6 @@ show_menu() {
|
|||||||
echo -e "
|
echo -e "
|
||||||
${green}哪吒监控管理脚本${plain} ${red}${NZ_VERSION}${plain}
|
${green}哪吒监控管理脚本${plain} ${red}${NZ_VERSION}${plain}
|
||||||
--- https://github.com/naiba/nezha ---
|
--- https://github.com/naiba/nezha ---
|
||||||
${green}0.${plain} 退出脚本
|
|
||||||
————————————————-
|
|
||||||
${green}1.${plain} 安装面板端
|
${green}1.${plain} 安装面板端
|
||||||
${green}2.${plain} 修改面板配置
|
${green}2.${plain} 修改面板配置
|
||||||
${green}3.${plain} 启动面板
|
${green}3.${plain} 启动面板
|
||||||
@ -430,8 +461,11 @@ show_menu() {
|
|||||||
${green}10.${plain} 查看Agent日志
|
${green}10.${plain} 查看Agent日志
|
||||||
${green}11.${plain} 卸载Agent
|
${green}11.${plain} 卸载Agent
|
||||||
${green}12.${plain} 重启Agent
|
${green}12.${plain} 重启Agent
|
||||||
|
————————————————-
|
||||||
|
${green}0.${plain} 退出脚本
|
||||||
|
${green}13.${plain} 更新脚本
|
||||||
"
|
"
|
||||||
echo && read -p "请输入选择 [0-12]: " num
|
echo && read -p "请输入选择 [0-13]: " num
|
||||||
|
|
||||||
case "${num}" in
|
case "${num}" in
|
||||||
0)
|
0)
|
||||||
@ -473,6 +507,9 @@ show_menu() {
|
|||||||
12)
|
12)
|
||||||
restart_agent
|
restart_agent
|
||||||
;;
|
;;
|
||||||
|
13)
|
||||||
|
update_script
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo -e "${red}请输入正确的数字 [0-12]${plain}"
|
echo -e "${red}请输入正确的数字 [0-12]${plain}"
|
||||||
;;
|
;;
|
||||||
@ -519,6 +556,9 @@ if [[ $# > 0 ]]; then
|
|||||||
"restart_agent")
|
"restart_agent")
|
||||||
restart_agent 0
|
restart_agent 0
|
||||||
;;
|
;;
|
||||||
|
"update_script")
|
||||||
|
update_script 0
|
||||||
|
;;
|
||||||
*) show_usage ;;
|
*) show_usage ;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user