本篇內(nèi)容介紹了“如何利用zabbix監(jiān)控php環(huán)境”的有關(guān)知識(shí),在實(shí)際案例的操作過(guò)程中,不少人都會(huì)遇到這樣的困境,接下來(lái)就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!
成都創(chuàng)新互聯(lián)專(zhuān)注于企業(yè)成都全網(wǎng)營(yíng)銷(xiāo)、網(wǎng)站重做改版、紫云網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、HTML5、成都做商城網(wǎng)站、集團(tuán)公司官網(wǎng)建設(shè)、外貿(mào)營(yíng)銷(xiāo)網(wǎng)站建設(shè)、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁(yè)設(shè)計(jì)等建站業(yè)務(wù),價(jià)格優(yōu)惠性?xún)r(jià)比高,為紫云等各大城市提供網(wǎng)站開(kāi)發(fā)制作服務(wù)。
vim /usr/local/php/etc/php-fpm.conf 添加 pm.status_path = /phpfpmstatus vim /usr/local/nginx/conf/nginx.conf 添加 server { listen 80; server_name localhost; location ~ ^/(phpfpmstatus)$ { include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; } } vim /usr/local/zabbix/etc/zabbix_agentd.conf UnsafeUserParameters=1 UserParameter=phpfpm.status.pool,/usr/local/zabbix/etc/scripts/monitor_phpfpm_status pool UserParameter=phpfpm.status.process.manager,/usr/local/zabbix/etc/scripts/monitor_phpfpm_status process_manager UserParameter=phpfpm.status.start.since,/usr/local/zabbix/etc/scripts/monitor_phpfpm_status start_since UserParameter=phpfpm.status.accepted.conn,/usr/local/zabbix/etc/scripts/monitor_phpfpm_status accepted_conn UserParameter=phpfpm.status.listen.queue,/usr/local/zabbix/etc/scripts/monitor_phpfpm_status listen_queue UserParameter=phpfpm.status.max.listen.queue,/usr/local/zabbix/etc/scripts/monitor_phpfpm_status max_listen_queue UserParameter=phpfpm.status.listen.queue.len,/usr/local/zabbix/etc/scripts/monitor_phpfpm_status listen_queue_len UserParameter=phpfpm.status.idle.processes,/usr/local/zabbix/etc/scripts/monitor_phpfpm_status idle_processes UserParameter=phpfpm.status.active.processes,/usr/local/zabbix/etc/scripts/monitor_phpfpm_status active_processes UserParameter=phpfpm.status.total.processes,/usr/local/zabbix/etc/scripts/monitor_phpfpm_status total_processes UserParameter=phpfpm.status.max.active.processes,/usr/local/zabbix/etc/scripts/monitor_phpfpm_status max_active_processes UserParameter=phpfpm.status.max.children.reached,/usr/local/zabbix/etc/scripts/monitor_phpfpm_status max_children_reached vim /usr/local/zabbix/etc/scripts/monitor_phpfpm_status #!/bin/bash source /etc/bashrc >/dev/null 2>&1 source /etc/profile >/dev/null 2>&1 LOG_FILE=/tmp/phpfpmstatus.log curl http://127.0.0.1/phpfpmstatus >${LOG_FILE} pool(){ awk '/pool/ {print $NF}' ${LOG_FILE} } process_manager() { awk '/process manager/ {print $NF}' ${LOG_FILE} } start_since(){ awk '/start since:/ {print $NF}' ${LOG_FILE} } accepted_conn(){ awk '/accepted conn:/ {print $NF}' ${LOG_FILE} } listen_queue(){ awk '/listen queue:/ {print $NF}' ${LOG_FILE} } max_listen_queue(){ awk '/max listen queue:/ {print $NF}' ${LOG_FILE} } listen_queue_len(){ awk '/listen queue len:/ {print $NF}' ${LOG_FILE} } idle_processes(){ awk '/idle processes:/ {print $NF}' ${LOG_FILE} } active_processes(){ awk '/active processes:/ {print $NF}' ${LOG_FILE} } total_processes(){ awk '/total processes:/ {print $NF}' ${LOG_FILE} } max_active_processes(){ awk '/max active processes:/ {print $NF}' ${LOG_FILE} } max_children_reached(){ awk '/max children reached:/ {print $NF}' ${LOG_FILE} } case "$1" in pool) pool ;; process_manager) process_manager ;; start_since) start_since ;; accepted_conn) accepted_conn ;; listen_queue) listen_queue ;; max_listen_queue) max_listen_queue ;; listen_queue_len) listen_queue_len ;; idle_processes) idle_processes ;; active_processes) active_processes ;; total_processes) total_processes ;; max_active_processes) max_active_processes ;; max_children_reached) max_children_reached ;; *) echo "Usage: $0 {pool|process_manager|start_since|accepted_conn|listen_queue|max_listen_queue|listen_queue_len|idle_processes|active _processes|total_processes|max_active_processes|max_children_reached}" esac chmod 755 /usr/local/zabbix/etc/scripts/monitor_phpfpm_status 最后重啟nginx php-fpm 然后導(dǎo)入php-fpm模塊,關(guān)聯(lián)到相應(yīng)主機(jī)
“如何利用zabbix監(jiān)控php環(huán)境”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!