mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
remove $ on regular variables in arithmetic contexts
https://github.com/koalaman/shellcheck/wiki/SC2004
This commit is contained in:
parent
2a84478fea
commit
15125852e8
@ -119,11 +119,11 @@ if [ "$1" = "config" ]; then
|
||||
nGpusCounter=0
|
||||
while [ $nGpusCounter -lt $nGpus ]
|
||||
do
|
||||
gpuName=$(echo "$nGpusOutput" | sed -n $(( $nGpusCounter + 1 ))p | cut -d \( -f 1)
|
||||
gpuName=$(echo "$nGpusOutput" | sed -n $((nGpusCounter+1))p | cut -d \( -f 1)
|
||||
echo "temp${nGpusCounter}.warning ${warning:-75}"
|
||||
echo "temp${nGpusCounter}.critical ${critical:-95}"
|
||||
echo "temp${nGpusCounter}.info Temperature information for $gpuName"
|
||||
: $(( nGpusCounter = $nGpusCounter + 1 ))
|
||||
: $((nGpusCounter=nGpusCounter+1))
|
||||
done
|
||||
;;
|
||||
mem)
|
||||
@ -133,11 +133,11 @@ if [ "$1" = "config" ]; then
|
||||
nGpusCounter=0
|
||||
while [ $nGpusCounter -lt $nGpus ]
|
||||
do
|
||||
gpuName=$(echo "$nGpusOutput" | sed -n $(( $nGpusCounter + 1 ))p | cut -d \( -f 1)
|
||||
gpuName=$(echo "$nGpusOutput" | sed -n $((nGpusCounter+1))p | cut -d \( -f 1)
|
||||
echo "mem${nGpusCounter}.info Memory information for $gpuName"
|
||||
gpuMem=$(echo "$gpusTotalMemOutput"| sed -n $(( $nGpusCounter + 1 ))p)
|
||||
gpuMem=$(echo "$gpusTotalMemOutput"| sed -n $((nGpusCounter+1))p)
|
||||
gpusTotalMem="${gpusTotalMem}${gpuMem} for GPU ${nGpusCounter}"
|
||||
: $(( nGpusCounter = $nGpusCounter + 1 ))
|
||||
: $((nGpusCounter=nGpusCounter+1))
|
||||
if [ $nGpusCounter -lt $nGpus ]; then
|
||||
gpusTotalMem="${gpusTotalMem}, "
|
||||
fi
|
||||
@ -158,9 +158,9 @@ if [ "$1" = "config" ]; then
|
||||
nGpusCounter=0
|
||||
while [ $nGpusCounter -lt $nGpus ]
|
||||
do
|
||||
gpuName=$(echo "$nGpusOutput" | sed -n $(( $nGpusCounter + 1 ))p | cut -d \( -f 1)
|
||||
gpuName=$(echo "$nGpusOutput" | sed -n $((nGpusCounter+1))p | cut -d \( -f 1)
|
||||
echo "fan${nGpusCounter}.info Fan information for $gpuName"
|
||||
: $(( nGpusCounter = $nGpusCounter + 1 ))
|
||||
: $((nGpusCounter=nGpusCounter+1))
|
||||
done
|
||||
;;
|
||||
power)
|
||||
@ -171,9 +171,9 @@ if [ "$1" = "config" ]; then
|
||||
nGpusCounter=0
|
||||
while [ $nGpusCounter -lt $nGpus ]
|
||||
do
|
||||
gpuName=$(echo "$nGpusOutput" | sed -n $(( $nGpusCounter + 1 ))p | cut -d \( -f 1)
|
||||
gpuName=$(echo "$nGpusOutput" | sed -n $((nGpusCounter+1))p | cut -d \( -f 1)
|
||||
echo "power${nGpusCounter}.info power consumption of $gpuName"
|
||||
: $(( nGpusCounter = $nGpusCounter + 1 ))
|
||||
: $((nGpusCounter=nGpusCounter+1))
|
||||
done
|
||||
;;
|
||||
*)
|
||||
@ -187,9 +187,9 @@ if [ "$1" = "config" ]; then
|
||||
nGpusCounter=0
|
||||
while [ $nGpusCounter -lt $nGpus ]
|
||||
do
|
||||
gpuName=$(echo "$nGpusOutput" | sed -n $(( $nGpusCounter + 1 ))p | cut -d \( -f 1)
|
||||
gpuName=$(echo "$nGpusOutput" | sed -n $((nGpusCounter+1))p | cut -d \( -f 1)
|
||||
echo "${name}${nGpusCounter}.label $gpuName"
|
||||
: $(( nGpusCounter = $nGpusCounter + 1 ))
|
||||
: $((nGpusCounter=nGpusCounter+1))
|
||||
#print_warning $name
|
||||
#print_critical $name
|
||||
done
|
||||
@ -209,11 +209,11 @@ case $name in
|
||||
nGpusCounter=0
|
||||
while [ $nGpusCounter -lt $nGpus ]
|
||||
do
|
||||
totalMemGpu=$(echo "$totalMemGpus" | sed -n $(( $nGpusCounter + 1 ))p)
|
||||
usedMemGpu=$(echo "$usedMemGpus" | sed -n $(( $nGpusCounter + 1 ))p)
|
||||
percentMemUsed=$(( $usedMemGpu * 100 / $totalMemGpu ))
|
||||
totalMemGpu=$(echo "$totalMemGpus" | sed -n $((nGpusCounter+1))p)
|
||||
usedMemGpu=$(echo "$usedMemGpus" | sed -n $((nGpusCounter+1))p)
|
||||
percentMemUsed=$((usedMemGpu*100/totalMemGpu))
|
||||
valueGpus="${valueGpus}${percentMemUsed}"$'\n'
|
||||
: $(( nGpusCounter = $nGpusCounter + 1 ))
|
||||
: $((nGpusCounter=nGpusCounter+1))
|
||||
done
|
||||
;;
|
||||
fan)
|
||||
@ -234,9 +234,9 @@ case $name in
|
||||
nGpusCounter=0
|
||||
while [ $nGpusCounter -lt $nGpus ]
|
||||
do
|
||||
value=$(echo "$valueGpus" | sed -n $(( $nGpusCounter + 1 ))p)
|
||||
value=$(echo "$valueGpus" | sed -n $((nGpusCounter+1))p)
|
||||
echo "${name}${nGpusCounter}.value $value"
|
||||
: $(( nGpusCounter = $nGpusCounter + 1 ))
|
||||
: $((nGpusCounter=nGpusCounter+1))
|
||||
done
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user