Révision 0987cf33
Plugin virtualbox_*: fix shellcheck issues
| plugins/virtualbox/virtualbox_ram_usage | ||
|---|---|---|
| 34 | 34 |
fi |
| 35 | 35 |
|
| 36 | 36 |
if [ "$1" = "config" ]; then |
| 37 |
RAMTOT=`free -b | grep Mem | awk '{print $2}'`
|
|
| 37 |
RAMTOT=$(free -b | grep Mem | awk '{print $2}')
|
|
| 38 | 38 |
echo 'graph_title Memory usage of virtual machines' |
| 39 | 39 |
echo "graph_args --base 1024 -r --lower-limit 0 --upper-limit $RAMTOT --units-exponent 9" |
| 40 | 40 |
echo 'graph_vlabel GB' |
| ... | ... | |
| 42 | 42 |
echo 'graph_category Virtualization' |
| 43 | 43 |
echo 'graph_period second' |
| 44 | 44 |
I=0 |
| 45 |
vboxmanage list vms | sed -r 's/^\"(.*)\" \{.*\}$/\1/' | while read VM_NAME; do
|
|
| 46 |
VM_NAME_PRINT=`echo -e "${VM_NAME}" | sed 's/[^A-Za-z0-9_]/_/g'`
|
|
| 45 |
vboxmanage list vms | sed -r 's/^\"(.*)\" \{.*\}$/\1/' | while read -r VM_NAME; do
|
|
| 46 |
VM_NAME_PRINT=$(echo -e "${VM_NAME}" | sed 's/[^A-Za-z0-9_]/_/g')
|
|
| 47 | 47 |
echo "${VM_NAME_PRINT}.label ${VM_NAME}"
|
| 48 |
echo "${VM_NAME_PRINT}.cdef ${VM_NAME_PRINT},1024,*"
|
|
| 49 |
if [ ${I} -eq 0 ]; then
|
|
| 48 |
echo "${VM_NAME_PRINT}.cdef ${VM_NAME_PRINT},1024,*"
|
|
| 49 |
if [ "$I" -eq 0 ]; then
|
|
| 50 | 50 |
echo "${VM_NAME_PRINT}.draw AREA"
|
| 51 | 51 |
else |
| 52 | 52 |
echo "${VM_NAME_PRINT}.draw STACK"
|
| ... | ... | |
| 59 | 59 |
vboxmanage metrics setup --period 5 --samples 3 |
| 60 | 60 |
sleep 5 |
| 61 | 61 |
|
| 62 |
vboxmanage list vms | sed -r 's/^\"(.*)\" \{.*\}$/\1/' | while read VM_NAME; do
|
|
| 63 |
VM_NAME_PRINT=`echo -e "${VM_NAME}" | sed 's/[^A-Za-z0-9_]/_/g'` # s/[.]/_/g;s/[ ]/_/g;s/[-]/_/g
|
|
| 64 |
vboxmanage metrics query "${VM_NAME}" RAM/Usage/Used | grep -E "^${VM_NAME}" | sed -r 's/^.* ([0-9]+) kB$/'''${VM_NAME_PRINT}'''.value \1/'
|
|
| 62 |
vboxmanage list vms | sed -r 's/^\"(.*)\" \{.*\}$/\1/' | while read -r VM_NAME; do
|
|
| 63 |
VM_NAME_PRINT=$(echo -e "${VM_NAME}" | sed 's/[^A-Za-z0-9_]/_/g') # s/[.]/_/g;s/[ ]/_/g;s/[-]/_/g
|
|
| 64 |
vboxmanage metrics query "${VM_NAME}" RAM/Usage/Used | grep -E "^${VM_NAME}" | sed -r 's/^.* ([0-9]+) kB$/'"${VM_NAME_PRINT}"'.value \1/'
|
|
| 65 | 65 |
done |
| 66 | 66 |
|
Formats disponibles : Unified diff