# you can see, https://easyengine.io/tutorials/php/fpm-status-page/
declare -A phpfpm_urls=()
+declare -A phpfpm_curl_opts=()
# _update_every is a special variable - it holds the number of seconds
# between the calls of the _update() function
phpfpm_max_children_reached=0
phpfpm_slow_requests=0
phpfpm_get() {
- url=$1
- phpfpm_response=($(curl -s "${url}"))
+ local opts="${1}" url="${2}"
+
+ phpfpm_response=($(curl -Ss ${opts} "${url}"))
[ $? -ne 0 -o "${#phpfpm_response[@]}" -eq 0 ] && return 1
if [[ "${phpfpm_response[0]}" != "pool:" \
local m
for m in "${!phpfpm_urls[@]}"
do
- phpfpm_get "${phpfpm_urls[$m]}"
+ phpfpm_get "${phpfpm_curl_opts[$m]}" "${phpfpm_urls[$m]}"
if [ $? -ne 0 ]; then
echo >&2 "phpfpm: cannot find status on URL '${phpfpm_url[$m]}'. Please set phpfpm_urls[$m]='http://localhost/status' in $confd/phpfpm.conf"
unset phpfpm_urls[$m]
for m in "${!phpfpm_urls[@]}"
do
cat <<EOF
-CHART phpfpm_$m.connections '' "PHP-FPM Active Connections" "connections" phpfpm phpfpm.connections line $[phpfpm_priority + 1] $phpfpm_update_every
+CHART phpfpm_$m.connections '' "PHP-FPM Active Connections" "connections" phpfpm phpfpm.connections line $((phpfpm_priority + 1)) $phpfpm_update_every
DIMENSION active '' absolute 1 1
DIMENSION maxActive 'max active' absolute 1 1
DIMENSION idle '' absolute 1 1
-CHART phpfpm_$m.requests '' "PHP-FPM Requests" "requests/s" phpfpm phpfpm.requests line $[phpfpm_priority + 2] $phpfpm_update_every
+CHART phpfpm_$m.requests '' "PHP-FPM Requests" "requests/s" phpfpm phpfpm.requests line $((phpfpm_priority + 2)) $phpfpm_update_every
DIMENSION requests '' incremental 1 1
-CHART phpfpm_$m.performance '' "PHP-FPM Performance" "status" phpfpm phpfpm.performance line $[phpfpm_priority + 3] $phpfpm_update_every
+CHART phpfpm_$m.performance '' "PHP-FPM Performance" "status" phpfpm phpfpm.performance line $((phpfpm_priority + 3)) $phpfpm_update_every
DIMENSION reached 'max children reached' absolute 1 1
DIMENSION slow 'slow requests' absolute 1 1
EOF
local m
for m in "${!phpfpm_urls[@]}"
do
- phpfpm_get "${phpfpm_urls[$m]}"
+ phpfpm_get "${phpfpm_curl_opts[$m]}" "${phpfpm_urls[$m]}"
if [ $? -ne 0 ]; then
continue
fi
# write the result of the work.
cat <<EOF
BEGIN phpfpm_$m.connections $1
-SET active = $[phpfpm_active_processes]
-SET maxActive = $[phpfpm_max_active_processes]
-SET idle = $[phpfpm_idle_processes]
+SET active = $((phpfpm_active_processes))
+SET maxActive = $((phpfpm_max_active_processes))
+SET idle = $((phpfpm_idle_processes))
END
BEGIN phpfpm_$m.requests $1
-SET requests = $[phpfpm_accepted_conn]
+SET requests = $((phpfpm_accepted_conn))
END
BEGIN phpfpm_$m.performance $1
-SET reached = $[phpfpm_max_children_reached]
-SET slow = $[phpfpm_slow_requests]
+SET reached = $((phpfpm_max_children_reached))
+SET slow = $((phpfpm_slow_requests))
END
EOF
done