原理:通過(guò)nginx的代理功能,把php-fpm的狀態(tài)轉(zhuǎn)發(fā)出來(lái)。再用command在zabbix上添加監(jiān)控。
為光山等地區(qū)用戶(hù)提供了全套網(wǎng)頁(yè)設(shè)計(jì)制作服務(wù),及光山網(wǎng)站建設(shè)行業(yè)解決方案。主營(yíng)業(yè)務(wù)為網(wǎng)站設(shè)計(jì)制作、成都網(wǎng)站制作、光山網(wǎng)站設(shè)計(jì),以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專(zhuān)業(yè)、用心的態(tài)度為用戶(hù)提供真誠(chéng)的服務(wù)。我們深信只要達(dá)到每一位用戶(hù)的要求,就會(huì)得到認(rèn)可,從而選擇與我們長(zhǎng)期合作。這樣,我們也可以走得更遠(yuǎn)!步驟
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)腳本。
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線(xiàn),公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性?xún)r(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專(zhuān)為企業(yè)上云打造定制,能夠滿(mǎn)足用戶(hù)豐富、多元化的應(yīng)用場(chǎng)景需求。
新聞名稱(chēng):Zabbix監(jiān)控php-fpm-創(chuàng)新互聯(lián)
網(wǎng)站地址:http://chinadenli.net/article40/coggeo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)建站、網(wǎng)站建設(shè)、電子商務(wù)、企業(yè)網(wǎng)站制作、網(wǎng)頁(yè)設(shè)計(jì)公司、網(wǎng)站設(shè)計(jì)公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容