[Zabbix] Apache 监控

一、配置 apache

# yum -y install httpd

# vi/etc/httpd/conf/httpd.conf        #红色字体为修改/添加部分

ServerRoot "/etc/httpd"

Listen 8081

Include conf.modules.d/*.conf

User apache

Group apache

ServerAdmin root@localhost

    AllowOverride none

    Require all denied

DocumentRoot "/var/www/html"

    AllowOverride None

    Require all granted

    Options Indexes FollowSymLinks

    AllowOverride None

    Require all granted

    DirectoryIndex index.html

    Require all denied

ErrorLog "logs/error_log"

LogLevel warn

    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

    LogFormat "%h %l %u %t \"%r\" %>s %b" common

   

      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

   

    CustomLog "logs/access_log" combined

    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

    AllowOverride None

    Options None

    Require all granted

    TypesConfig /etc/mime.types

    AddType application/x-compress .Z

    AddType application/x-gzip .gz .tgz

    AddType text/html .shtml

    AddOutputFilter INCLUDES .shtml

AddDefaultCharset UTF-8

    MIMEMagicFile conf/magic

EnableSendfile on

 

   SetHandler server-status 

   Order allow,deny 

   Allow from localhost 

   Allow from 192.168.1.

IncludeOptional conf.d/*.conf

 

# systemctl enable httpd && systemctl restart httpd       #重启apache并测试配置生效

#浏览器输入http://192.168.1.208:8081/server-status?auto    测试

[Zabbix] Apache 监控_第1张图片


二、下载 zapache

#wget https://github.com/lorf/zapache/archive/master.zip

# unzip master.zip

#ll zapache-master/

总用量 124

-rw-r--r-- 1 root root   676 4  22 2016 httpd-server-status.conf.sample             # http status 配置模板文件

-rw-r--r-- 1 root root  1780 4  22 2016 README.md

-rw-r--r-- 1 root root   224 4  22 2016 userparameter_zapache.conf.sample     # zabbix 配置模板文件

-rwxr-xr-x 1 root root  6110 4  22 2016 zapache           #监控脚本

-rw-r--r-- 1 root root 52258 4  22 2016 zapache-template-active.xml      # zabbix 模板

-rw-r--r-- 1 root root 52024 4  22 2016 zapache-template.xml

 

#cp -a /usr/local/src/tarbag/zapache/zapache-master/zapache/etc/zabbix/shell/zapache.sh

#chown zabbix/etc/zabbix/shell/zapache.sh

#chmod +x/etc/zabbix/shell/zapache.sh

#vi/etc/zabbix/shell/zapache.sh

STATUS_URL="http://localhost:8081/server-status?auto"

 

#cp -a/usr/local/src/tarbag/zapache/zapache-master/userparameter_zapache.conf.sample/etc/zabbix/zabbix_agentd.d/userparameter_zapache.conf

 

#vi/etc/zabbix/zabbix_agentd.d/userparameter_zapache.conf

UserParameter=zapache[*],/etc/zabbix/shell/zapache.sh \$1

 

# agent端配置

#vi/etc/zabbix/zabbix_agentd.conf

PidFile=/var/run/zabbix/zabbix_agentd.pid

LogFile=/var/log/zabbix/zabbix_agentd.log

LogFileSize=0

Server=192.168.1.208

Hostname=192.168.1.208

Include=/etc/zabbix/zabbix_agentd.d/*.conf

UnsafeUserParameters=1

 

#systemctl restart zabbix-agent

 

 

三、WEB端配置

#上传 zabbix模板




[Zabbix] Apache 监控_第2张图片


监测中-最新数据


[Zabbix] Apache 监控_第3张图片



你可能感兴趣的:(【监控平台】,----,Zabbix)