zabbix日常監控Apache2.4


Apache的安裝請參考https://www.cnblogs.com/huangyanqi/p/9168637.html

 

  1、修改配置

[root@apache ~]# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built:   Apr 20 2018 18:10:38
[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/32
</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 \$1
修改下路徑
UserParameter=zapache[*],/etc/zabbix/scripts/zapache \$1

#設置權限
[root@agent ~]#chown root.zabbix /etc/zabbix/scripts/zapache 
[root@agent ~]#chmod 550 /etc/zabbix/scripts/zapache 
[root@agent ~]#ll /etc/zabbix/scripts/
total 20
-r-xr-x--- 1 root zabbix  514 May 29 16:50 check_port1.sh
-r-xr-x--- 1 root zabbix  437 May 29 18:00 disk_scan.sh
-r-xr-x--- 1 root zabbix 1044 Jun 11 14:25 nginx_zbx.sh
-r-xr-x--- 1 root zabbix 6110 Jun 12 15:26 zapache

#重啟服務
[root@agent ~]#systemctl restart zabbix-agent.service 

 

 

  5、zabbix-server導入模板

 

  6、導入模板

 

 

  7、結果如下

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM