From 82079d039b4dccc58cf2d2173610905fa248c6ed Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Fri, 7 Jun 2024 11:22:48 +0200
Subject: [PATCH] proc_zombie: add iml help and doc link

---
 check_proc_ressources |  2 +-
 check_proc_zombie     | 56 +++++++++++++++++++++++++++++++++----------
 2 files changed, 44 insertions(+), 14 deletions(-)

diff --git a/check_proc_ressources b/check_proc_ressources
index 02521b8..ba3e481 100755
--- a/check_proc_ressources
+++ b/check_proc_ressources
@@ -49,7 +49,7 @@ SYNTAX:
 
   check_proc_ressources -m METHOD [-w WARNLIMIT] [-c CRITICALLIMIT]
   
-EXAMPLE:
+OPTIONS:
 
   -h, --help
       show help
diff --git a/check_proc_zombie b/check_proc_zombie
index 31d98ef..8a3c44d 100755
--- a/check_proc_zombie
+++ b/check_proc_zombie
@@ -9,34 +9,64 @@
 # ----------------------------------------------------------------------
 # 2020-03-10  v1.0  <axel.hahn@iml.unibe.ch>
 # 2020-07-08  v1.1  <axel.hahn@iml.unibe.ch> FIX: set "ph." instead "ps."
+# 2024-06-07  v1.2  <axel.hahn@unibe.ch>     update help and add docs link
 # ======================================================================
 
-
 . `dirname $0`/inc_pluginfunctions
 tmpfile=/tmp/check_proc_zombie_$$
 
+export self_APPVERSION=1.2
+
+# show help
+function showHelp(){
+    cat <<EOH
+$( ph.showImlHelpHeader )
+
+SYNTAX:
+
+  check_proc_zombie [-h] [-w WARNLIMIT] [-c CRITICALLIMIT]
+
+    -h  this help
+    -w  Warning level
+    -c  Critical level
+
+OPTIONS:
+
+  -h, --help
+      show help
+
+  -c, --critical VALUE
+      critical value; default: $iCriticalLimit 
+
+  -w. --warning VALUE
+      warning limit value; default: $iWarnLimit 
+
+EXAMPLE:
+
+  check_proc_zombie -w 3 -c 15
+      Show count of zombie processes mark as critical when there are 15 or
+      more zombie processes and warn on 3 or more.
+
+EOH
+}
+
 # ----------------------------------------------------------------------
 # MAIN
 # ----------------------------------------------------------------------
 
-# --- check required tools
-ph.require top
+# set default / override from command line params
+typeset -i iWarnLimit=`     ph.getValueWithParam 1  w "$@"`
+typeset -i iCriticalLimit=` ph.getValueWithParam 10 c "$@"`
 
 # --- check param -h
 if [ "$1" = "-h" ]; then
-    echo "
-    usage: $0 [ -w value -c value -h ]
-
-        -w  Warning level
-        -c  Critical level
-        -h  this help
-    "
+    showHelp
     exit 0
 fi
 
-# set default / override from command line params
-typeset -i iWarnLimit=`     ph.getValueWithParam 1  w "$@"`
-typeset -i iCriticalLimit=` ph.getValueWithParam 10 c "$@"`
+# --- check required tools
+ph.require ps
+ph.require top
 
 # get cpu status i.e.
 # %Cpu(s): 33.3 us,  9.5 sy,  0.0 ni, 57.1 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
-- 
GitLab