群晖dsm7安装哪吒监控 简易教程

研究了下 其实挺简单

dsm7的群晖 启动项管理 变成了 systemd

路径在 /usr/lib/systemd/system/

那么就简单了

ssh登陆群晖 然后切换成root

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
sudo -s

cd  /volume1/@apphome

mkdir NezhaAgent

# 这里得注意 下载你群晖对应架构的agent
#wget https://github.com/naiba/nezha/releases/download/v0.12.3/nezha-agent_linux_amd64.tar.gz

#ps 20241002修正 现在仓库变了
wget https://github.com/nezhahq/agent/releases/download/v0.19.8/nezha-agent_linux_amd64.zip

#tar -zxvf nezha-agent_linux_amd64.tar.gz
#ps 20241002修正 现在是zip了 但是dms默认没有unzip命令 那么就用7z解压就可以了
7z x nezha-agent_linux_amd64.zip

chmod +x nezha-agent

下面就设置systemd脚本

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
vim /usr/lib/systemd/system/nezha-agent.service
#下面是systemd脚本

[Unit]
Description=Nezha Agent
After=syslog.target
#After=network.target
#After=nezha-dashboard.service

[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
Type=simple
User=root
Group=root
WorkingDirectory=/volume1/@apphome/NezhaAgent
ExecStart=/volume1/@apphome/NezhaAgent/nezha-agent --report-delay 3 --disable-command-execute --skip-conn --skip-procs -s 你自己的服务器:443 -p 你自己的密钥 --tls
Restart=always
#Environment=DEBUG=true

# Some distributions may not support these hardening directives. If you cannot start the service due
# to an unknown option, comment out the ones not supported by your version of systemd.
#ProtectSystem=full
#PrivateDevices=yes
#PrivateTmp=yes
#NoNewPrivileges=true

[Install]
WantedBy=multi-user.target
1
2
3
4
5
6
7
8
9
//然后启用就行了

systemctl daemon-reload
systemctl enable nezha-agent
systemctl start nezha-agent

// 看下状态

systemctl status nezha-agent
updatedupdated2024-10-152024-10-15