原理:通過(guò)nginx的代理功能,把php-fpm的狀態(tài)轉(zhuǎn)發(fā)出來(lái)。再用command在zabbix上添加監(jiān)控。
武鄉(xiāng)網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián)建站,武鄉(xiāng)網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為武鄉(xiāng)成百上千提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的武鄉(xiāng)做網(wǎng)站的公司定做!
步驟
1、開(kāi)啟Php-fpm狀態(tài)功能。
PHP5.3.3以后就集成了php-fpm模塊,不需要額外裝包。
2、Nginx配置。
3、重啟nginx/php-fpm服務(wù)。
4、打開(kāi)status頁(yè)面。(測(cè)試到這初步成功)
5、在zabbix agent腳本目錄下創(chuàng)建腳本(/usr/local/zabbix/etc/monitor_scripts/)
[root@master~]# cat php-fpm_status.sh -----可直接復(fù)制粘貼----
#########################################################################
# File Name:php-fpm_status.sh
# Author: Ifeng
# Created Time:2014年06月12日 星期四
#########################################################################
#!/bin/bash
idle(){
wget --quiet -O -http://127.0.0.1/status |grep "idle processes" |awk '{print$3}'
}
total(){
wget --quiet -O - http://127.0.0.1/status|grep "total processes" |awk '{print$3}'
}
active(){
wget --quiet -O -http://127.0.0.1/status |grep "active" |awk '{print$3}'|grep -v"process"
}
mactive(){
wget --quiet -O -http://127.0.0.1/status |grep "max active processes:" |awk'{print$4}'
}
listenqueuelen(){
wget --quiet -O -http://127.0.0.1/status |grep "listen queue len" |awk '{print$4}'
}
listenqueue(){
wget --quiet -O -http://127.0.0.1/status |grep "listen queue:"|grep -vE"len|max"|awk '{print$3}'
}
since(){
wget --quiet -O -http://127.0.0.1/status |grep "start since: " |awk '{print$3}'
}
conn(){
wget --quiet -O -http://127.0.0.1/status |grep "accepted conn" |awk '{print$3}'
}
$1
6、更改zabbix.agentd.conf的配置文件如下:
UnsafeUserParameters=1
注意路徑與腳本所在路徑一致
UserParameter=idle.processe,/usr/local/zabbix/etc/monitor_scriptsphp-fpm_status.shidle
UserParameter=total.processes,/usr/local/zabbix/etc/monitor_scripts/php-fpm_status.shtotal
UserParameter=active.processes,/usr/local/zabbix/etc/monitor_scripts/php-fpm_status.shactive
UserParameter=max.active.processes,/usr/local/zabbix/etc/monitor_scripts/php-fpm_status.shmactive
UserParameter=listen.queue.len,/usr/local/zabbix/etc/monitor_scripts/php-fpm_status.shlistenqueuelen
UserParameter=listen.queue,/usr/local/zabbix/etc/monitor_scripts/php-fpm_status.shlistenqueue
UserParameter=start.since,/usr/local/zabbix/etc/monitor_scripts/php-fpm_status.shsince
UserParameter=accepted.conn,/usr/local/zabbix/etc/monitor_scripts/php-fpm_status.shconn
7、Zabbix上添加監(jiān)控。
Zabbix WEB面面中,通過(guò)以上定義好的key 進(jìn)行操作。
注:PHP-fpm的狀態(tài)參數(shù)有很多,可用curl 127.0.0.1/status?full查看
如有需求,可自行改動(dòng)腳本。
本文題目:Zabbix監(jiān)控php-fpm
分享路徑:http://aaarwkj.com/article14/ihhoge.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設(shè)計(jì)、手機(jī)網(wǎng)站建設(shè)、電子商務(wù)、小程序開(kāi)發(fā)、網(wǎng)頁(yè)設(shè)計(jì)公司、外貿(mào)網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)