diff options
author | paulfantom <paulfantom@gmail.com> | 2016-06-16 00:35:25 +0200 |
---|---|---|
committer | paulfantom <paulfantom@gmail.com> | 2016-06-16 00:35:25 +0200 |
commit | 7b69abedb8631a7342fcff65993aa8b8e089659b (patch) | |
tree | 2a7a0dc190d8a613181990e0a610bc324f1cad7f /charts.d/phpfpm.chart.sh | |
parent | 1100bc5820afeda0bff95af77c31d67692e025ae (diff) |
add compatibility with PHP 5.3
Diffstat (limited to 'charts.d/phpfpm.chart.sh')
-rwxr-xr-x | charts.d/phpfpm.chart.sh | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/charts.d/phpfpm.chart.sh b/charts.d/phpfpm.chart.sh index 55510169b4..4adb69694e 100755 --- a/charts.d/phpfpm.chart.sh +++ b/charts.d/phpfpm.chart.sh @@ -44,7 +44,6 @@ phpfpm_get() { || "${phpfpm_response[26]}" != "idle" \ || "${phpfpm_response[29]}" != "active" \ || "${phpfpm_response[32]}" != "total" \ - || "${phpfpm_response[43]}" != "slow" \ ]] then echo >&2 "phpfpm: invalid response from phpfpm status server: ${phpfpm_response[*]}" @@ -63,7 +62,12 @@ phpfpm_get() { phpfpm_total_processes="${phpfpm_response[34]}" phpfpm_max_active_processes="${phpfpm_response[38]}" phpfpm_max_children_reached="${phpfpm_response[42]}" - phpfpm_slow_requests="${phpfpm_response[45]}" + if [[ "${phpfpm_response[43]}" == "slow" ]] + then + phpfpm_slow_requests="${phpfpm_response[45]}" + else + phpfpm_slow_requests="-1" + fi if [[ -z "${phpfpm_pool}" \ || -z "${phpfpm_start_time}" \ @@ -77,7 +81,6 @@ phpfpm_get() { || -z "${phpfpm_total_processes}" \ || -z "${phpfpm_max_active_processes}" \ || -z "${phpfpm_max_children_reached}" \ - || -z "${phpfpm_slow_requests}" \ ]] then echo >&2 "phpfpm: empty values got from phpfpm status server: ${phpfpm_response[*]}" @@ -124,7 +127,7 @@ phpfpm_create() { cat <<EOF 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 +DDIMENSION 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 @@ -132,8 +135,13 @@ DIMENSION requests '' incremental 1 1 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 +EOF + if [[ ${phpfpm_slow_requests} != "-1" ]] + then + cat <<EOF DIMENSION slow 'slow requests' absolute 1 1 EOF + fi done return 0 @@ -168,9 +176,14 @@ SET requests = $((phpfpm_accepted_conn)) END BEGIN phpfpm_$m.performance $1 SET reached = $((phpfpm_max_children_reached)) +EOF + if [[ ${phpfpm_slow_requests} != "-1" ]] + then + cat << EOF SET slow = $((phpfpm_slow_requests)) -END EOF + fi + echo "END" done return 0 |