增加磁盘和网卡硬件信息显示
This commit is contained in:
38
agent/monitor-agent.service
Normal file
38
agent/monitor-agent.service
Normal file
@@ -0,0 +1,38 @@
|
||||
[Unit]
|
||||
# 服务描述
|
||||
Description=Monitor Agent Service
|
||||
# 依赖:网络启动后再启动该服务
|
||||
After=network.target network-online.target
|
||||
# 可选:依赖其他服务(如mysql、redis等),按需添加
|
||||
# Requires=mysql.service
|
||||
|
||||
[Service]
|
||||
# 服务类型:forking 对应脚本的后台启动(nohup)
|
||||
Type=forking
|
||||
# 启动命令(指向我们写的启动脚本)
|
||||
ExecStart=/root/monitor/agent.sh start
|
||||
# 停止命令
|
||||
ExecStop=/root/monitor/agent.sh stop
|
||||
# 重启命令
|
||||
ExecReload=/root/monitor/agent.sh restart
|
||||
# PID文件路径(必须与脚本中PID_FILE一致)
|
||||
PIDFile=/root/monitor/agent.pid
|
||||
# 运行用户(建议root,与脚本执行用户一致)
|
||||
User=root
|
||||
Group=root
|
||||
# 故障重启策略:失败后自动重启,最多重启5次
|
||||
Restart=on-failure
|
||||
RestartSec=3s
|
||||
StartLimitInterval=30s
|
||||
StartLimitBurst=5
|
||||
# 日志重定向(可选,统一到systemd日志)
|
||||
StandardOutput=append:/root/monitor/agent.log
|
||||
StandardError=append:/root/monitor/agent.log
|
||||
# 进程退出时清理环境
|
||||
KillMode=process
|
||||
# 优雅停止超时时间
|
||||
TimeoutStopSec=10s
|
||||
|
||||
[Install]
|
||||
# 开机自启级别:多用户模式
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user