一、配置 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 <Directory /> AllowOverride none Require all denied </Directory> DocumentRoot "/var/www/html" <Directory "/var/www"> AllowOverride None Require all granted </Directory> <Directory "/var/www/html"> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> <IfModule dir_module> DirectoryIndex index.html </IfModule> <Files ".ht*"> Require all denied </Files> ErrorLog "logs/error_log" LogLevel warn <IfModule log_config_module> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %b" common <IfModule logio_module> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio </IfModule> CustomLog "logs/access_log" combined </IfModule> <IfModule alias_module> ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" </IfModule> <Directory "/var/www/cgi-bin"> AllowOverride None Options None Require all granted </Directory> <IfModule mime_module> TypesConfig /etc/mime.types AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddType text/html .shtml AddOutputFilter INCLUDES .shtml </IfModule> AddDefaultCharset UTF-8 <IfModule mime_magic_module> MIMEMagicFile conf/magic </IfModule> EnableSendfile on <location /server-status> SetHandler server-status Order allow,deny Allow from localhost Allow from 192.168.1. </location> IncludeOptional conf.d/*.conf |
# systemctl enable httpd && systemctl restart httpd #重启apache并测试配置生效
#浏览器输入http://192.168.1.208:8081/server-status?auto 测试
二、下载 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模板
监测中-最新数据