From 3a7435cea74396f9b36bf0d90153dcfa0132ff01 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch> Date: Fri, 1 Oct 2021 14:42:59 +0200 Subject: [PATCH] update php-fpm check - speed values based on a unit var --- check_php-fpm-status | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/check_php-fpm-status b/check_php-fpm-status index bfa9053..1341413 100755 --- a/check_php-fpm-status +++ b/check_php-fpm-status @@ -15,6 +15,8 @@ tmpfile=/tmp/check_fpm_processes_1 defaulturl=localhost/status +sDeltaunit="s" + # ---------------------------------------------------------------------- # functions # ---------------------------------------------------------------------- @@ -82,8 +84,8 @@ For performance data it echos: php-fpm-reading count of workers in state "Reading headers" php-fpm-queue count of items in the queue php-fpm-maxqueue max listen queue - php-fpm-slow slow requests per minute (since last execution of this check) - php-fpm-speed requests per minute (since last execution of this check) + php-fpm-slow slow requests per $sDeltaunit (since last execution of this check) + php-fpm-speed requests per $sDeltaunit (since last execution of this check) SYNTAX: `basename $0` [-u URL] @@ -143,7 +145,7 @@ fi # --- handled requests per sec typeset -i iConn=$( _getvalue "accepted conn") -typeset -i iSpeed=$( ph.perfdeltaspeed "fpm-accepted" $iConn "min") +typeset -i iSpeed=$( ph.perfdeltaspeed "fpm-accepted" $iConn $sDeltaunit ) # --- count slots typeset -i iActive=$( _getvalue "active processes" ) @@ -154,7 +156,7 @@ typeset -i iIdle=$( _getvalue "idle processes") typeset -i iQueue=$( _getvalue "listen queue len") typeset -i iMaxQueue=$( _getvalue "max listen queue") typeset -i iSlowTotal=$( _getvalue "slow requests") -typeset -i iSlow=$( ph.perfdeltaspeed "fpm-slow" $iSlowTotal "min" ) +typeset -i iSlow=$( ph.perfdeltaspeed "fpm-slow" $iSlowTotal $sDeltaunit ) typeset -i iMaxChilds=$( _getvalue "max children reached") @@ -186,7 +188,7 @@ fi # ---------------------------------------------------------------------- # output # ---------------------------------------------------------------------- -ph.status "PHP-FPM: active: $iActive (max: $iMaxActive) .. idle workers: $iIdle .. queue: $iQueue (max: $iMaxQueue) .. speed: $iSpeed req per min ... slow: $iSlow req per min (total: $iSlowTotal)" +ph.status "PHP-FPM: active: $iActive (max: $iMaxActive) .. idle workers: $iIdle .. queue: $iQueue (max: $iMaxQueue) .. speed: $iSpeed req per $sDeltaunit ... slow: $iSlow req per $sDeltaunit (total: $iSlowTotal)" echo Worker states: Running: $iWorkerRunning .. Reading headers: $iWorkerReading .. Idle: $iWorkerIdle echo hint="!! IMPORTANT !! Any non-OK status is still experimmental." @@ -216,7 +218,7 @@ if [ $iQueue -gt 0 ]; then fi if [ $iSlow -gt 0 ]; then echo $hint - echo "WARNING: $iSlow slow requests were found... $iSlowTotal since restart of fpm service." + echo "WARNING: $iSlow slow requests were found per $sDeltaunit ... $iSlowTotal since restart of fpm service." echo fi -- GitLab