2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Plugin virtualbox_*: fix shellcheck issues

This commit is contained in:
Lars Kruse 2018-08-01 23:27:30 +02:00
parent 1ed78789c1
commit 0987cf33a2
3 changed files with 18 additions and 20 deletions

View File

@ -37,8 +37,8 @@ if [ "$1" = "config" ]; then
echo 'graph_info This graph shows the percentage of processor time spent in kernel mode by the every single VM process.' echo 'graph_info This graph shows the percentage of processor time spent in kernel mode by the every single VM process.'
echo 'graph_category Virtualization' echo 'graph_category Virtualization'
echo 'graph_period second' echo 'graph_period second'
vboxmanage list vms | sed -r 's/^\"(.*)\" \{.*\}$/\1/' | while read VM_NAME; do vboxmanage list vms | sed -r 's/^\"(.*)\" \{.*\}$/\1/' | while read -r VM_NAME; do
VM_NAME_PRINT=`echo -e "${VM_NAME}" | sed 's/[^A-Za-z0-9_]/_/g'` VM_NAME_PRINT=$(echo -e "${VM_NAME}" | sed 's/[^A-Za-z0-9_]/_/g')
echo "${VM_NAME_PRINT}_kernel.label ${VM_NAME}" echo "${VM_NAME_PRINT}_kernel.label ${VM_NAME}"
done done
exit 0 exit 0
@ -47,8 +47,7 @@ fi
vboxmanage metrics setup --period 5 --samples 3 vboxmanage metrics setup --period 5 --samples 3
sleep 5 sleep 5
vboxmanage list vms | sed -r 's/^\"(.*)\" \{.*\}$/\1/' | while read VM_NAME; do vboxmanage list vms | sed -r 's/^\"(.*)\" \{.*\}$/\1/' | while read -r VM_NAME; do
VM_NAME_PRINT=`echo -e "${VM_NAME}" | sed 's/[^A-Za-z0-9_]/_/g'` VM_NAME_PRINT=$(echo -e "${VM_NAME}" | sed 's/[^A-Za-z0-9_]/_/g')
vboxmanage metrics query "${VM_NAME}" CPU/Load/Kernel | grep -E "^${VM_NAME}" | sed -r 's/^.*([0-9]+\.[0-9]+)%/'''${VM_NAME_PRINT}'''_kernel.value \1/' vboxmanage metrics query "${VM_NAME}" CPU/Load/Kernel | grep -E "^${VM_NAME}" | sed -r 's/^.*([0-9]+\.[0-9]+)%/'"${VM_NAME_PRINT}"'_kernel.value \1/'
done done

View File

@ -37,8 +37,8 @@ if [ "$1" = "config" ]; then
echo 'graph_info This graph shows the percentage of processor time spent in user mode by the every single VM process.' echo 'graph_info This graph shows the percentage of processor time spent in user mode by the every single VM process.'
echo 'graph_category Virtualization' echo 'graph_category Virtualization'
echo 'graph_period second' echo 'graph_period second'
vboxmanage list vms | sed -r 's/^\"(.*)\" \{.*\}$/\1/' | while read VM_NAME; do vboxmanage list vms | sed -r 's/^\"(.*)\" \{.*\}$/\1/' | while read -r VM_NAME; do
VM_NAME_PRINT=`echo -e "${VM_NAME}" | sed 's/[^A-Za-z0-9_]/_/g'` VM_NAME_PRINT=$(echo -e "${VM_NAME}" | sed 's/[^A-Za-z0-9_]/_/g')
echo "${VM_NAME_PRINT}_user.label ${VM_NAME}" echo "${VM_NAME_PRINT}_user.label ${VM_NAME}"
done done
exit 0 exit 0
@ -47,8 +47,7 @@ fi
vboxmanage metrics setup --period 5 --samples 3 vboxmanage metrics setup --period 5 --samples 3
sleep 5 sleep 5
vboxmanage list vms | sed -r 's/^\"(.*)\" \{.*\}$/\1/' | while read VM_NAME; do vboxmanage list vms | sed -r 's/^\"(.*)\" \{.*\}$/\1/' | while read -r VM_NAME; do
VM_NAME_PRINT=`echo -e "${VM_NAME}" | sed 's/[^A-Za-z0-9_]/_/g'` VM_NAME_PRINT=$(echo -e "${VM_NAME}" | sed 's/[^A-Za-z0-9_]/_/g')
vboxmanage metrics query "${VM_NAME}" CPU/Load/User | grep -E "^${VM_NAME}" | sed -r 's/^.*([0-9]+\.[0-9]+)%/'''${VM_NAME_PRINT}'''_user.value \1/' vboxmanage metrics query "${VM_NAME}" CPU/Load/User | grep -E "^${VM_NAME}" | sed -r 's/^.*([0-9]+\.[0-9]+)%/'"${VM_NAME_PRINT}"'_user.value \1/'
done done

View File

@ -34,7 +34,7 @@ if [ "$1" = "autoconf" ]; then
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
RAMTOT=`free -b | grep Mem | awk '{print $2}'` RAMTOT=$(free -b | grep Mem | awk '{print $2}')
echo 'graph_title Memory usage of virtual machines' echo 'graph_title Memory usage of virtual machines'
echo "graph_args --base 1024 -r --lower-limit 0 --upper-limit $RAMTOT --units-exponent 9" echo "graph_args --base 1024 -r --lower-limit 0 --upper-limit $RAMTOT --units-exponent 9"
echo 'graph_vlabel GB' echo 'graph_vlabel GB'
@ -42,11 +42,11 @@ RAMTOT=`free -b | grep Mem | awk '{print $2}'`
echo 'graph_category Virtualization' echo 'graph_category Virtualization'
echo 'graph_period second' echo 'graph_period second'
I=0 I=0
vboxmanage list vms | sed -r 's/^\"(.*)\" \{.*\}$/\1/' | while read VM_NAME; do vboxmanage list vms | sed -r 's/^\"(.*)\" \{.*\}$/\1/' | while read -r VM_NAME; do
VM_NAME_PRINT=`echo -e "${VM_NAME}" | sed 's/[^A-Za-z0-9_]/_/g'` VM_NAME_PRINT=$(echo -e "${VM_NAME}" | sed 's/[^A-Za-z0-9_]/_/g')
echo "${VM_NAME_PRINT}.label ${VM_NAME}" echo "${VM_NAME_PRINT}.label ${VM_NAME}"
echo "${VM_NAME_PRINT}.cdef ${VM_NAME_PRINT},1024,*" echo "${VM_NAME_PRINT}.cdef ${VM_NAME_PRINT},1024,*"
if [ ${I} -eq 0 ]; then if [ "$I" -eq 0 ]; then
echo "${VM_NAME_PRINT}.draw AREA" echo "${VM_NAME_PRINT}.draw AREA"
else else
echo "${VM_NAME_PRINT}.draw STACK" echo "${VM_NAME_PRINT}.draw STACK"
@ -59,8 +59,8 @@ fi
vboxmanage metrics setup --period 5 --samples 3 vboxmanage metrics setup --period 5 --samples 3
sleep 5 sleep 5
vboxmanage list vms | sed -r 's/^\"(.*)\" \{.*\}$/\1/' | while read VM_NAME; do vboxmanage list vms | sed -r 's/^\"(.*)\" \{.*\}$/\1/' | while read -r VM_NAME; do
VM_NAME_PRINT=`echo -e "${VM_NAME}" | sed 's/[^A-Za-z0-9_]/_/g'` # s/[.]/_/g;s/[ ]/_/g;s/[-]/_/g VM_NAME_PRINT=$(echo -e "${VM_NAME}" | sed 's/[^A-Za-z0-9_]/_/g') # s/[.]/_/g;s/[ ]/_/g;s/[-]/_/g
vboxmanage metrics query "${VM_NAME}" RAM/Usage/Used | grep -E "^${VM_NAME}" | sed -r 's/^.* ([0-9]+) kB$/'''${VM_NAME_PRINT}'''.value \1/' vboxmanage metrics query "${VM_NAME}" RAM/Usage/Used | grep -E "^${VM_NAME}" | sed -r 's/^.* ([0-9]+) kB$/'"${VM_NAME_PRINT}"'.value \1/'
done done