zabbix agent需要开启远程命令执行 sed -i 's@#EnableRemoteCommands=0@EnableRemoteCommands=1@' /etc/zabbix/zabbix_agentd.conf sed -i 's@#UnsafeUserParameters=0@UnsafeUserParameters=1@' /etc/zabbix/zabbix_agentd.conf systemctl restart
zabbix agent需要开启远程命令执行
sed -i 's@#EnableRemoteCommands=0@EnableRemoteCommands=1@' /etc/zabbix/zabbix_agentd.confsed -i 's@#UnsafeUserParameters=0@UnsafeUserParameters=1@' /etc/zabbix/zabbix_agentd.conf
systemctl restart zabbix-agent
zabbix用户授权
echo "zabbix ALL = NOPASSWD: ALL" >> /etc/sudoers创建脚本
创建动作
验证自愈功能
ss -tnlp |grep 3000LISTEN 0 511 *:3000 *:* users:(("node",pid=27323,fd=19))
ps -ef |grep npm
zabbix 27304 1 0 16:26 ? 00:00:00 npm
root 27605 25719 0 16:34 pts/0 00:00:00 grep --color=auto npm
kill 27304
LISTEN 0 511 *:3000 *:* users:(("node",pid=27631,fd=19))ps -ef |grep npm
zabbix 27611 1 0 16:35 ? 00:00:00 sh -c export PATH=$PATH:/usr/local/node/bin cd /data/explorer && nohup npm start &
zabbix 27612 27611 0 16:35 ? 00:00:00 npm
root 27707 25719 0 16:36 pts/0 00:00:00 grep --color=auto npm