Chinaunix首页 | 论坛 | 博客
  • 博客访问: 184940
  • 博文数量: 26
  • 博客积分: 215
  • 博客等级: 入伍新兵
  • 技术积分: 346
  • 用 户 组: 普通用户
  • 注册时间: 2009-09-21 15:00
文章分类

全部博文(26)

文章存档

2017年(10)

2016年(1)

2015年(2)

2014年(1)

2013年(7)

2012年(5)

我的朋友

分类: 系统运维

2017-10-13 15:12:02

还是在原192.168.1.240监控apache状态

一.打开apache的server-status:
# vi /etc/httpd/conf/httpd.conf

添加如下内容,注意细节:

ExtendedStatus On


   SetHandler server-status

   Order Allow,Deny

   Allow from localhost


重启apache使其生效:

# service  httpd restart
在本机访问server-status测试下(仅允许本机访问状态页):
# curl


Apache Status

Apache Server Status for 127.0.0.1



Server Version: Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3
Server Built: Feb  9 2016 17:28:49


Current Time: Friday, 13-Oct-2017 15:07:50 CST
Restart Time: Friday, 13-Oct-2017 15:07:47 CST
Parent Server Generation: 0
Server uptime:  3 seconds
Total accesses: 0 - Total Traffic: 0 kB
CPU Usage: u0 s0 cu0 cs0 0 requests/sec - 0 B/second -
2 requests currently being processed, 6 idle workers
WW______........................................................

................................................................

................................................................

................................................................


Scoreboard Key:

"_" Waiting for Connection,
"S" Starting up,
"R" Reading Request,

"W" Sending Reply,
"K" Keepalive (read),
"D" DNS Lookup,

"C" Closing connection,
"L" Logging,
"G" Gracefully finishing,

"I" Idle cleanup of worker,
"." Open slot with no current process











Srv PID Acc M CPU
SS Req Conn Child Slot Client VHost Request
0-0 5528 0/0/0 W
0.00 3 0 0.0 0.00 0.00
192.168.43.11 log.cbex.com.cn GET /server-status HTTP/1.1
1-0 5529 0/0/0 W
0.00 0 0 0.0 0.00 0.00
127.0.0.1 log.cbex.com.cn GET /server-status HTTP/1.1



 
 
 
 


 
 
 
 
 
Srv Child Server number - generation
PID OS process ID
Acc Number of accesses this connection / this child / this slot
M Mode of operation
CPU CPU usage, number of seconds
SS Seconds since beginning of most recent request
Req Milliseconds required to process most recent request
Conn Kilobytes transferred this connection
Child Megabytes transferred this child
Slot Total megabytes transferred this slot



Apache/2.2.15 (CentOS) Server at 127.0.0.1 Port 80


二、zabbix-agent配置:
下载zapache
# cd /usr/local/src/
# wget /archive/master.zip
# yum install -y zip unzip
# 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
备注:

     httpd-server-status.conf.sample 是用于配置server-status的上个步骤已经配置过了

     userparameter_zapache.conf.sample 、zapache 关键的文件
     zapache-template-active.xml  zapache-template.xml模板

将解压出来的几个重要文件放到相应目录
1、配置文件 userparameter_zapache.conf
# cp -fr zapache-master/userparameter_zapache.conf.sample /etc/zabbix/zabbix_agentd.d/userparameter_zapache.conf
# vim /etc/zabbix/zabbix_agentd.d/userparameter_zapache.conf
UserParameter=zapache[*],/etc/zabbix/zapache \$1

2、监控脚本 zapache
# cp zapache-master/zapache /etc/zabbix/
# chmod +x /etc/zabbix/zapache
3、修改zabbix-agent配置
# vim /etc/zabbix/zabbix_agentd.conf
Include=/etc/zabbix/zabbix_agentd.d/*.conf         //确认此配置生效

三、页面设置
1、导入xml模板
2、主机添加模板



阅读(1359) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~