zabbix5.4 故障自愈功能

 


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

zabbix用户授权

echo "zabbix ALL = NOPASSWD: ALL" >> /etc/sudoers

创建脚本

创建动作

验证自愈功能

ss -tnlp |grep 3000
LISTEN     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

 

# ss -tnlp |grep 3000
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

 

posted @   小吉猫  阅读(125)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
点击右上角即可分享
微信分享提示