From ba964f31cbb2983c58dc26216b24bca6969becb2 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Wed, 23 Aug 2023 16:16:40 +0200
Subject: [PATCH] onevm: update help; show help without requirements

---
 check_onevm | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/check_onevm b/check_onevm
index 14e4e2b..d250324 100755
--- a/check_onevm
+++ b/check_onevm
@@ -33,14 +33,14 @@
 # STAT:done:Done:The VM is done. VMs in this state won’t be shown with onevm list but are kept in the database for accounting purposes. You can still get their information with the onevm show command.
 # ----------------------------------------------------------------------
 # 2023-06-12  v1.0  <axel.hahn@unibe.ch>  initial version
-# 2023-06-15  v1.0  <axel.hahn@unibe.ch>  fix output if no vm is running
+# 2023-06-15  v1.1  <axel.hahn@unibe.ch>  fix output if no vm is running
+# 2023-08-23  v1.2  <axel.hahn@unibe.ch>  update help; show help without requirements
 # ======================================================================
 
 
 . $(dirname $0)/inc_pluginfunctions
 
-self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] )
-self_APPVERSION=1.1
+self_APPVERSION=1.2
 
 # new line
 NL="
@@ -53,21 +53,14 @@ showData=0
 # ----------------------------------------------------------------------
 
 function showHelp(){
+    local _self; _self=$(basename $0)
 cat <<EOF
-______________________________________________________________________
-
-$self_APPNAME 
-v$self_APPVERSION
-
-(c) Institute for Medical Education - University of Bern
-Licence: GNU GPL 3
-______________________________________________________________________
+$( ph.showImlHelpHeader )
 
 Show count of vms in OpenNebula - listed by state and by host.
 It will go to warning if a non running state was found.
 It will go to critical if a vm is on failure.
 
-
 SYNTAX:
 $(basename $0)
 
@@ -88,9 +81,6 @@ function _add(){
 # MAIN
 # ----------------------------------------------------------------------
 
-# --- check required tools
-ph.require onehost
-
 # --- check param -h
 case "$1" in
     "--help"|"-h")
@@ -100,6 +90,9 @@ case "$1" in
     *)
 esac
 
+# --- check required tools
+ph.require onehost
+
 # --- get data
 cmdout=$( sudo onevm list --csv 2>&1 )
 
-- 
GitLab