美文网首页我爱编程Linux学习之路
linux运维学习笔记:zabbix系列之:03 zabbix

linux运维学习笔记:zabbix系列之:03 zabbix

作者: 周少言 | 来源:发表于2018-01-26 21:35 被阅读0次

    linux运维学习笔记:zabbix系列之:03 zabbix 3.0监控apache

    作者:周少言
    201年 月,于北京

    声明:本博客是本人周少言在某培训机构学习期间所写,其中参考借鉴了他人的博客,本文将会选择性给出相关链接,如有侵权,恳请告知。本文如有错误,恳请告知,欢迎交流。

    参考连接

    本实验节点IP:192.168.22.32

    添加监控

    yum -y install zabbix-agent-3.2.6-1.el6.x86_64.rpm 
    
    cd /etc/zabbix  
    vim zabbix_agentd.conf 
    
    Server=192.168.22.39
    ServerActive=192.168.22.39
    Hostname=192.168.22.32  
    分别在95 136  147
    
    service zabbix-agent start
    chkconfig zabbix-agent on
    
    

    配置apache

    yum -y install httpd
    
    vim /etc/httpd/conf/httpd.conf 
    
    ExtendedStatus On
    <location /server-status> 
       SetHandler server-status 
       Order allow,deny 
       Allow from localhost 
       Allow from 192.168.22.
    </location>
    
    service httpd restart 
    chkconfig httpd on
    
    

    http://192.168.22.32/server-status

    下载 zapache

    链接:https://pan.baidu.com/s/1bqxMpxP 密码:2hgq
    本实验将其放在/root目录下

    wget https://github.com/lorf/zapache/archive/master.zip
    unzip zapache-master.zip 
    ll zapache-master/
    

    httpd-server-status.conf.sample 是用于配置server-status的上个步骤已经配置过了
    userparameter_zapache.conf.sample 、zapache 关键的文件
    zapache-template-active.xml zapache-template.xml模板

    cd  /root/zapache-master
    cp -a /root/zapache-master/userparameter_zapache.conf.sample /etc/zabbix/zabbix_agentd.d/
    cd  /etc/zabbix/zabbix_agentd.d
    mv userparameter_zapache.conf.sample userparameter_zapache.conf
    vim userparameter_zapache.conf
    

    可以看到应当把解压出来的zapache文件放到/var/lib/zabbixsrv/externalscripts/目录下,当然也可以修改这个目录位置,改为自定义的,我这里就用默认配置文件里的目录,因此,创建这个目录

    mkdir -p /var/lib/zabbixsrv/externalscripts/ 
    cp -a /root/zapache-master/zapache   /var/lib/zabbixsrv/externalscripts/ 
    chmod +x /var/lib/zabbixsrv/externalscripts/zapache 
    
    vim /etc/zabbix/zabbix_agentd.conf 
    ### Option: Include   #约莫在266行
    Include=/etc/zabbix/zabbix_agentd.d/userparameter_zapache.conf
    

    将压缩包中的模板 zapache-templete.xml在zabbix server WEB端导入

    相应主机添加以下模板
    Template App Apache Web Server zapache

    相关文章

      网友评论

        本文标题:linux运维学习笔记:zabbix系列之:03 zabbix

        本文链接:https://www.haomeiwen.com/subject/iitgaxtx.html