ITPub博客

首页 > 自动化运维 > 大规模网络运维 > Linux部署的WGCLOUD的探针agent如何设置开机自启动

Linux部署的WGCLOUD的探针agent如何设置开机自启动

原创 大规模网络运维 作者:年少纵马且歌 时间:2023-03-03 09:54:36 0 删除 编辑

Linux部署的WGCLOUD监控系统的server和agent都可以设置开机自启动


就像普通的应用一样,用通用的Linux设置开机启动就可以


服务端server和被控端agent的设置方式一样,以下是设置agent的开机启动方式


server开机启动方式可以看这里,https://www.wgstart.com/help/docs38.html


1、以Ubuntu 20为例,新建/etc/systemd/system/wgcloudAgent.service文件,

[root@localhost~]# vim /etc/systemd/system/wgcloudAgent.service

内容如下,将下列内容复制进/etc/systemd/system/wgcloudAgent.service文件

[Unit]
Description=auto Start Wgcloud Agent
After=network.target syslog.target
[Service]
Type=forking
ExecStart=/etc/wgcloudAgent.local 
    
[Install]
WantedBy=multi-user.target

2、创建文件/etc/wgcloudAgent.local

[root@localhost~]# vim /etc/wgcloudAgent.local

内容如下

#!/bin/sh -e
# 
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
/usr/local/wgcloud-v3.3.5/agent/start.sh
exit 0

注意:/usr/local/wgcloud-v3.3.5/agent/start.sh改为自己的agent实际部署路径


3、给/etc/wgcloudAgent.local加可执行权限

[root@localhost~]# chmod +x /etc/wgcloudAgent.local

4、最后两步,重新载入systemd服务和设置开机自启动,完成

[root@localhost~]# systemctl daemon-reload
[root@localhost~]# systemctl enable wgcloudAgent


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70024568/viewspace-2937981/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2022-11-25

  • 博文量
    33
  • 访问量
    17936