一 zabbix客户端配置
###bash脚本进行配置 {centos环境,自己选择特定的agent版本}
#!/bin/bash
#zabbix-agent在服务器上进行安装
#date 2020.3.10
v=`sudo cat /etc/redhat-release|sed -r 's/.* ([0-9]+)\..*/\1/'`
if [ $v -eq 6 ]; then
echo "centos6"
sudo rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/6/x86_64/zabbix-release-4.0-1.el6.noarch.rpm
sudo yum clean all && sudo yum update zabbix-agent -y
sudo yum install zabbix-agent-4.0.7 -y
fi
if [ $v -eq 7 ]; then
echo "centos 7"
sudo rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
sudo yum clean all && sudo yum update zabbix-agent -y
sudo yum install zabbix-agent-4.0.7 -y
fi
echo "agent install successful!"
agent文件配置
[zhangguangjun@10-23-240-118 ~]$ cat /etc/zabbix/zabbix_agentd.conf|grep -vE "^$|#|^&"
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=x.x.x.x #zabbix-server的IP
ListenPort=10050 #zabbix端口
ServerActive=x.x.x.x:10051 #serverip:port
Hostname=x.x.x.x
#Hostname一般填写你的IP名称
Include=/etc/zabbix/zabbix_agentd.d/
UnsafeUserParameters=1
#下面这些是是zabbix脚本路径和选项,可以删除掉这些
UserParameter=process.nginx.memory,/etc/zabbix/scripts/processstatus.sh nginx
UserParameter=process.nginx.cpu,/etc/zabbix/scripts/processstatus.sh nginxcpu
UserParameter=process.mysql.memory,/etc/zabbix/scripts/processstatus.sh mysql
UserParameter=process.mysql.cpu,/etc/zabbix/scripts/processstatus.sh mysqlcpu
UserParameter=process.tomcat.memory,/etc/zabbix/scripts/processstatus.sh tomcat
UserParameter=process.tomcat.cpu,/etc/zabbix/scripts/processstatus.sh tomcatcpu
UserParameter=process.sentinel.memory,/etc/zabbix/scripts/processstatus.sh sentinel
UserParameter=process.sentinel.cpu,/etc/zabbix/scripts/processstatus.sh sentinelcpu
UserParameter=process.mongodb.memory,/etc/zabbix/scripts/processstatus.sh mongodb
UserParameter=process.mongodb.cpu,/etc/zabbix/scripts/processstatus.sh mongodbcpu
UserParameter=process.openfire.memory,/etc/zabbix/scripts/processstatus.sh openfire
UserParameter=process.openfire.cpu,/etc/zabbix/scripts/processstatus.sh openfirecpu
UserParameter=process.kafka.memory,/etc/zabbix/scripts/processstatus.sh kafka
UserParameter=process.kafka.cpu,/etc/zabbix/scripts/processstatus.sh kafkacpu
UserParameter=process.zookeeper.memory,/etc/zabbix/scripts/processstatus.sh zookeeper
UserParameter=process.zookeeper.cpu,/etc/zabbix/scripts/processstatus.sh zookeepercpu
UserParameter=process.twemproxy.memory,/etc/zabbix/scripts/processstatus.sh twemproxy
UserParameter=process.twemproxy.cpu,/etc/zabbix/scripts/processstatus.sh twemproxycpu
UserParameter=process.mycat.memory,/etc/zabbix/scripts/processstatus.sh mycat
UserParameter=process.mycat.cpu,/etc/zabbix/scripts/processstatus.sh mycatcpu
启动zabbix-agent
service zabbix-agent start
记得别别忘记将防火墙设置
二 server端添加监控配置
2.1 创建一个主机群组
2.2 添加主机
2.3 关联模板
2.4 添加完成后,确认状态情况
2.5查看图形
到这里,一个简单的监控就完成了。
下面我们进行其他的设置。
三 创建模板和监控项
3.1 创建模板
可以选择创建多个模板
3.2 监控项添和设置
3.2.1 FTP监控项
3.2.2 监控 memcache 监控项
3.3 监控和触发项-网卡流量
带宽触发器