cd /etc/zabbix/zabbix_agentd.d
cat system.conf
如下:
UserParameter=login_number,w|awk 'NR==1{print $(NF-6)}'
UserParameter=tcp_22,netstat -tunlp | grep ssh | grep -w tcp | wc -l
UserParameter=mem_free,free | awk 'NR==2{print $NF/$2*100}'
UserParameter=nginx_process, /sbin/pidof nginx | wc -l
UserParameter=redis_status, /usr/local/redis/src/redis-cli -p 6479 -a root ping 2>/dev/null| grep -c "PONG"
UserParameter=gzm_eres, ps -ef | grep `cat /var/run/gzm_eres.pid` | grep -v grep -c
#####监控mysql是否存活
UserParameter=mysql_process,systemctl status mysql | grep -c "active"