diff --git a/check_onevm b/check_onevm index c41dd05ba6f4e7b8f5426dfddccb843c92bf1d7d..720959ed036724972c6b5366ae97e386d859aca0 100755 --- a/check_onevm +++ b/check_onevm @@ -33,13 +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 # ====================================================================== . $(dirname $0)/inc_pluginfunctions self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] ) -self_APPVERSION=1.0 +self_APPVERSION=1.1 # new line NL=" @@ -115,10 +116,10 @@ csvdata=$( echo "$cmdout" | sed -n '2,$p' ) # --- get result out="" -typeset -i iTotal; iTotal=$( echo "$csvdata" | wc -l ) -typeset -i iRunning; iRunning=$( echo "$csvdata" | grep -c ",runn," ) -typeset -i iFail; iFail=$( echo "$csvdata" | grep -c ",fail," ) -typeset -i iUnknown; iUnknown=$( echo "$csvdata" | grep -c ",unkn," ) +typeset -i iTotal; iTotal=$( grep -c . <<< "$csvdata" ) +typeset -i iRunning; iRunning=$( grep -c ",runn," <<< "$csvdata" ) +typeset -i iFail; iFail=$( grep -c ",fail," <<< "$csvdata" ) +typeset -i iUnknown; iUnknown=$( grep -c ",unkn," <<< "$csvdata" ) typeset -i iOther; iOther=$iTotal-$iRunning-$iFail-$iUnknown ph.perfadd "total" "${iTotal}"