Skip to content
Snippets Groups Projects

onevm: fix output if no vm is running

Merged Hahn Axel (hahn) requested to merge 6435-check-onehost into master
1 file
+ 6
5
Compare changes
  • Side-by-side
  • Inline
+ 6
5
@@ -33,13 +33,14 @@
@@ -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.
# 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-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
. $(dirname $0)/inc_pluginfunctions
self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] )
self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] )
self_APPVERSION=1.0
self_APPVERSION=1.1
# new line
# new line
NL="
NL="
@@ -115,10 +116,10 @@ csvdata=$( echo "$cmdout" | sed -n '2,$p' )
@@ -115,10 +116,10 @@ csvdata=$( echo "$cmdout" | sed -n '2,$p' )
# --- get result
# --- get result
out=""
out=""
typeset -i iTotal; iTotal=$( echo "$csvdata" | wc -l )
typeset -i iTotal; iTotal=$( grep -c . <<< "$csvdata" )
typeset -i iRunning; iRunning=$( echo "$csvdata" | grep -c ",runn," )
typeset -i iRunning; iRunning=$( grep -c ",runn," <<< "$csvdata" )
typeset -i iFail; iFail=$( echo "$csvdata" | grep -c ",fail," )
typeset -i iFail; iFail=$( grep -c ",fail," <<< "$csvdata" )
typeset -i iUnknown; iUnknown=$( echo "$csvdata" | grep -c ",unkn," )
typeset -i iUnknown; iUnknown=$( grep -c ",unkn," <<< "$csvdata" )
typeset -i iOther; iOther=$iTotal-$iRunning-$iFail-$iUnknown
typeset -i iOther; iOther=$iTotal-$iRunning-$iFail-$iUnknown
ph.perfadd "total" "${iTotal}"
ph.perfadd "total" "${iTotal}"
Loading