Zabbix 配置远程命令
授权Zabbix
vim /etc/sudoers
#在root ALL=(ALL) ALL 下添加
zabbix ALL=NOPASSWD: ALL
zabbix ALL=NOPASSWD: /bin/bash /home/shell/server.sh
#查看agent里有没有EnableRemoteCommands=1
cat /etc/zabbix/zabbix_agentd.conf | grep EnableRemoteCommands=1
#没有添加一个
EnableRemoteCommands=1
#重启
systemctl restart zabbix-agent
重启脚本
#!/bin/bash
sleep 5
/etc/init.d/nginx restart
sleep 5
/etc/init.d/httpd restart
sleep 5
/etc/init.d/mysqld restart
sleep 5
/etc/init.d/php-fpm-52 restart
sleep 5
/etc/init.d/php-fpm-53 restart
sleep 5
/etc/init.d/php-fpm-56 restart
sleep 5
/etc/init.d/php-fpm-70 restart
sleep 5
/etc/init.d/php-fpm-71 restart
sleep 5
/etc/init.d/php-fpm-72 restart
sleep 5
/etc/init.d/php-fpm-73 restart
sleep 5
/etc/init.d/php-fpm-74 restart
sleep 5
/etc/init.d/redis restart
sleep 5
/etc/init.d/memcached restart