pond2539 发表于 2018-11-18 10:51:24

zabbix3.0.4 监控apache

  开启apache的server-status
  httpd.conf 末尾添加

# vim /usr/local/httpd-2.2.31/conf/httpd.conf  
ExtendedStatus On
  
SetHandler server-status
  
Order Allow,Deny
  
Allow from all

  重启apache
# /usr/local/bin/apachectl -t  
Syntax OK
  
# /usr/local/bin/apachectl restart
  浏览器http://localhost/server-status
  或
# curl localhost/server-status  重启zabbix
# /etc/init.d/zabbix_agentd restart  
Shutting down zabbix_agentd:                              
  
Starting zabbix_agentd:                                    
  下载模板
# wget https://github.com/lorf/zapache/archive/master.zip  解压

# 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
  

  
# cd zapache-master/# ls
  
httpd-server-status.conf.sample    zapache
  
README.md                        zapache-template-active.xml
  
userparameter_zapache.conf.samplezapache-template.xml

  把文件放到相应的目录

# cp userparameter_zapache.conf.sample /usr/local/zabbix/etc/zabbix_agentd.conf.d/  
# mv userparameter_zapache.conf.sampleuserparameter_zapache.conf
  # 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
  # cd /zapache-master/
  # cp zapache /usr/local/bin/
  查看是否有执行权限
  # ll zapache
  -rwxr-xr-x 1 root root 6110 Sep 9 16:35 zapache
  没有权限可执行下面命令
  # chmod +x zapache

  修改zabbix -agentd.conf
# vim /usr/local/zabbix/etc/  导入模板



  关联模板
  配置-主机(选择apache客户端)
  模板-选择(选择上面导入的模板)-添加-更新

  在web页面查看是否有数据


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


页: [1]
查看完整版本: zabbix3.0.4 监控apache