zabbix3.0.4 監控apache

開啓apache的server-status

httpd.conf 末尾添加

複製代碼

[root@test3 /]# vim /usr/local/httpd-2.2.31/conf/httpd.conf 
ExtendedStatus On<location /server-status>
 SetHandler server-status
 Order Allow,Deny
 Allow from all</location>

複製代碼

重啓apache

[root@test3 /]# /usr/local/bin/apachectl -t
Syntax OK
[root@test3 /]# /usr/local/bin/apachectl restart

瀏覽器http://localhost/server-status

[root@test3 /]# curl localhost/server-status

 重啓zabbix

[root@test3 /]# /etc/init.d/zabbix_agentd restart
Shutting down zabbix_agentd:                               [  OK  ]
Starting zabbix_agentd:                                    [  OK  ]

下載模板

[root@test3 /]# wget https://github.com/lorf/zapache/archive/master.zip

解壓

複製代碼

[root@test3 /]# unzip master.zip 
Archive:  master.zip
24a764b2e224f9b8d0a6bc94dcadd7568b2fe650
   creating: zapache-master/
  inflating: zapache-master/README.md  
  inflating: zapache-master/httpd-server-status.conf.sample  
  inflating: zapache-master/userparameter_zapache.conf.sample  
  inflating: zapache-master/zapache  
  inflating: zapache-master/zapache-template-active.xml  
  inflating: zapache-master/zapache-template.xml 

[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

複製代碼

把文件放到相應的目錄

複製代碼

[root@test3 zapache-master]# cp userparameter_zapache.conf.sample /usr/local/zabbix/etc/zabbix_agentd.conf.d/
[root@test3 zabbix_agentd.conf.d]# mv userparameter_zapache.conf.sample  userparameter_zapache.conf

[root@test3 zabbix_agentd.conf.d]# cat userparameter_zapache.conf 
#
# This is a sample zabbix_agentd config file.
# Put it to /etc/zabbix_agentd.conf.d or otherwise integrate into agent config.
# Edit to your needs.
#
UserParameter=zapache[*],/var/lib/zabbixsrv/externalscripts/zapache \$1

修改下路徑

UserParameter=zapache[*],/usr/local/bin/zapache \$1

 把zapache文件放到usr/local/bin

[root@test3 zabbix_agentd.conf.d]# cd /zapache-master/

[root@test3 zapache-master]# cp zapache /usr/local/bin/

查看是否有執行權限

[root@test3 bin]# ll zapache 
-rwxr-xr-x 1 root root 6110 Sep 9 16:35 zapache

沒有權限可執行下面命令

[root@test3 bin]# chmod +x zapache 

複製代碼

 修改zabbix -agentd.conf

[root@test3 bin]# vim /usr/local/zabbix/etc/

 

導入模板

wKioL1mIerizaJdqAADftkbvqtQ976.jpg-wh_50


wKiom1mIeuDx6lQ2AACkGNwJNaE200.jpg-wh_50



wKiom1mIewfwSG-pAABUOfH-4-Q959.jpg-wh_50

關聯模板

配置-主機(選擇apache客戶端)

模板-選擇(選擇上面導入的模板)-添加-更新

wKioL1mIezewa6rlAACKuLo5bLA744.jpg-wh_50

在web頁面查看是否有數據

wKiom1mIe23zF1GDAAJKxfPMzxY922.jpg-wh_50

wKioL1mIe3HDgMEgAAJEbes21rs605.jpg-wh_50

 

本文轉自:http://www.cnblogs.com/zzzhfo/p/5884795.html


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章