From d5849f29a5c587bde18316f61347d3353308d958 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch>
Date: Fri, 8 Jul 2022 10:00:42 +0200
Subject: [PATCH] fpm: eliminate division by 0

---
 check_php-fpm-status | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/check_php-fpm-status b/check_php-fpm-status
index 7d23bb5..93032b8 100755
--- a/check_php-fpm-status
+++ b/check_php-fpm-status
@@ -12,6 +12,7 @@
 # 2022-02-11  v0.5  <axel.hahn@iml.unibe.ch>  show running workers in 1st line
 # 2022-04-01  v0.6  <axel.hahn@iml.unibe.ch>  use wget default params; shell fixes
 # 2022-05-09  v0.7  <axel.hahn@iml.unibe.ch>  use wget default params
+# 2022-07-08  v0.8  <axel.hahn@iml.unibe.ch>  eliminate division by 0
 # ======================================================================
 
 . $(dirname $0)/inc_pluginfunctions
@@ -166,7 +167,8 @@ typeset -i iSlowTotal=$( _getvalue "slow requests")
 typeset -i iSlow=$(      ph.perfdeltaspeed "fpm-slow" $iSlowTotal $sDeltaunit )
 typeset -i iMaxChilds=$( _getvalue "max children reached")
 
-typeset -i iSlowPercent=$iSlow*100/$iSpeed
+typeset -i iSlowPercent=0
+test $iSpeed -gt 0 && iSlowPercent=$iSlow*100/$iSpeed
 
 
 typeset -i iWorkerRunning=$( _getWorkerOfState "Running"         | wc -l )
-- 
GitLab