Apache的安装请参考https://www.cnblogs.com/huangyanqi/p/9168637.html
1、修改配置
[root@apache ~]# httpd -v
Server version: Apache/2.4. (CentOS)
Server built: Apr ::
[root@apache ~]# cat /etc/httpd24/httpd.conf |grep status
LoadModule status_module modules/mod_status.so
[root@apache ~]# cat /etc/httpd24/httpd.conf |grep httpd-info.conf
#Include /etc/httpd24/extra/httpd-info.conf
注释:去掉这个注释
[root@apache ~]# vim /etc/httpd24/extra/httpd-info.conf
<Location /server-status>
SetHandler server-status
Order allow,deny
Allow from localhost
Allow from 122.114.200.186/
</Location>
ExtendedStatus On
注释:去掉前面的#注释
2、浏览器查看
http://IP/server-status
或
3、下载zabbix模板
[root@test3 /]# wget https://github.com/lorf/zapache/archive/master.zip
[root@test3 /]# unzip master.zip
[root@test3 /]# cd zapache-master/
[root@test3 zapache-master]# ls
httpd-server-status.conf.sample zapache
README.md zapache-template-active.xml
userparameter_zapache.conf.sample zapache-template.xml
注释:
httpd-server-status.conf.sample 是用于配置server-status的上个步骤已经配置过了
userparameter_zapache.conf.sample 、zapache 关键的文件
zapache-template-active.xml zapache-template.xml模板
4、把文件放置到相应位置
cp userparameter_zapache.conf.sample /etc/zabbix/zabbix_agentd.d/
cd /etc/zabbix/zabbix_agentd.d/
mv userparameter_zapache.conf.sample userparameter_zapache.conf [root@test3 zabbix_agentd.conf.d]# cat userparameter_zapache.conf
UserParameter=zapache[*],/var/lib/zabbixsrv/externalscripts/zapache \$
修改下路径
UserParameter=zapache[*],/etc/zabbix/scripts/zapache \$ #设置权限
[root@agent ~]#chown root.zabbix /etc/zabbix/scripts/zapache
[root@agent ~]#chmod /etc/zabbix/scripts/zapache
[root@agent ~]#ll /etc/zabbix/scripts/
total
-r-xr-x--- root zabbix May : check_port1.sh
-r-xr-x--- root zabbix May : disk_scan.sh
-r-xr-x--- root zabbix Jun : nginx_zbx.sh
-r-xr-x--- root zabbix Jun : zapache #重启服务
[root@agent ~]#systemctl restart zabbix-agent.service