本文共 3377 字,大约阅读时间需要 11 分钟。
以下操作均在zabbix-agent端操作:
sh init.sh
yum install -y httpd* #安装httpd
systemctl start httpd.service;systemctl enable httpd.service #服务的启动与开机自启
ss -ant |grep :80 #查看httpd的80是否起来LISTEN 0 128 *:10050 *:* users:(("zabbix_agentd",pid=16735,fd=4),("zabbix_agentd",pid=16734,fd=4),("zabbix_agentd",pid=16733,fd=4),("zabbix_agentd",pid=16732,fd=4),("zabbix_agentd",pid=16731,fd=4),("zabbix_agentd",pid=16730,fd=4))LISTEN 0 128 :::10050 :::* users:(("zabbix_agentd",pid=16735,fd=5),("zabbix_agentd",pid=16734,fd=5),("zabbix_agentd",pid=16733,fd=5),("zabbix_agentd",pid=16732,fd=5),("zabbix_agentd",pid=16731,fd=5),("zabbix_agentd",pid=16730,fd=5))
在/etc/httpd/conf/httpd.conf的末尾加上如下代码ExtendedStatus OnSetHandler server-status Order Allow,Deny Allow from all
systemctl restart httpd.service #修改配置文件之后重启服务
#执行下方命令看是否status是否配置成功/usr/bin/curl --insecure --silent --location http://localhost/server-status?auto Total Accesses: 146Total kBytes: 97Uptime: 226ReqPerSec: .646018BytesPerSec: 439.504BytesPerReq: 680.329BusyWorkers: 1IdleWorkers: 5Scoreboard: _W____..........................................................................................................................................................................................................................................................
部署zabbix-agent端
rpm -Uvh https://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
-安装agent端软件
yum install zabbix-agent
-修改配置启动agent端服务
vim /etc/zabbix/zabbix_agentd.confServer=192.168.122.105 //被动模式 zabbix-server-ipServerActive=192.168.122.105 //主动模式 zabbix-server-ipHostname=Zabbix server //Agent端主机名,最终显示在监控页面上的名字UnsafeUserParameters=1 //是否限制用户自定义keys使用特殊字符
-服务的启动与开机自启动
systemctl start zabbix-agent
netstat -antp | grep agentLISTEN 0 128 *:10050 *:* users:(("zabbix_agentd",pid=16735,fd=4),("zabbix_agentd",pid=16734,fd=4),("zabbix_agentd",pid=16733,fd=4),("zabbix_agentd",pid=16732,fd=4),("zabbix_agentd",pid=16731,fd=4),("zabbix_agentd",pid=16730,fd=4))LISTEN 0 128 :::10050 :::* users:(("zabbix_agentd",pid=16735,fd=5),("zabbix_agentd",pid=16734,fd=5),("zabbix_agentd",pid=16733,fd=5),("zabbix_agentd",pid=16732,fd=5),("zabbix_agentd",pid=16731,fd=5),("zabbix_agentd",pid=16730,fd=5))
-配置snmp
yum -y install net-snmp net-snmp-utils
vim /etc/snmp/snmpd.conf com2sec notConfigUser 192.168.122.105 public access notConfigGroup "" any noauth exact all none noneview all included .1 80
systemctl start snmpd;systemctl enable snmpd
ss -anup |grep snmpUNCONN 0 0 *:161 *:* users:(("snmpd",pid=4315,fd=6))
cd /etc/zabbixmkdir scriptstouch apache_status.shchomd +x apache_status.sh
把脚本执行一边,检查脚本看是否能够正常获取到数值。
sh apache_status.sh TotalAccesses37552
cd /etc/zabbix/zabbix_agentd.dtouch apache_status.confcat apache_status.confUserParameter=apache.status[*],/etc/zabbix/scripts/apache_status.sh $1
转载地址:http://msssl.baihongyu.com/