From 60a209360586675b3cafb5b3e93c7ef0850a26ce Mon Sep 17 00:00:00 2001 From: Nils Date: Thu, 22 Feb 2018 13:14:19 +0100 Subject: [PATCH] use variable names also in the configuration --- plugins/gpu/nvidia_gpu_ | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/plugins/gpu/nvidia_gpu_ b/plugins/gpu/nvidia_gpu_ index 679cabdd..b1308680 100755 --- a/plugins/gpu/nvidia_gpu_ +++ b/plugins/gpu/nvidia_gpu_ @@ -120,11 +120,11 @@ if [ "$1" = "config" ]; then while [ "$nGpusCounter" -lt "$nGpus" ] do 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" + echo "${name}${nGpusCounter}.warning ${warning:-75}" + echo "${name}${nGpusCounter}.critical ${critical:-95}" + echo "${name}${nGpusCounter}.info Temperature information for $gpuName" : $((nGpusCounter=nGpusCounter+1)) - done + done ;; mem) # First determine total memory of each GPU... @@ -134,7 +134,7 @@ if [ "$1" = "config" ]; then while [ "$nGpusCounter" -lt "$nGpus" ] do gpuName=$(echo "$nGpusOutput" | sed -n $((nGpusCounter+1))p | cut -d \( -f 1) - echo "mem${nGpusCounter}.info Memory information for $gpuName" + echo "${name}${nGpusCounter}.info Memory information for $gpuName" gpuMem=$(echo "$gpusTotalMemOutput"| sed -n $((nGpusCounter+1))p) gpusTotalMem="${gpusTotalMem}${gpuMem} for GPU ${nGpusCounter}" : $((nGpusCounter=nGpusCounter+1)) @@ -159,9 +159,9 @@ if [ "$1" = "config" ]; then while [ "$nGpusCounter" -lt "$nGpus" ] do gpuName=$(echo "$nGpusOutput" | sed -n $((nGpusCounter+1))p | cut -d \( -f 1) - echo "fan${nGpusCounter}.info Fan information for $gpuName" + echo "${name}${nGpusCounter}.info Fan information for $gpuName" : $((nGpusCounter=nGpusCounter+1)) - done + done ;; power) echo 'graph_title GPU power consumption' @@ -172,7 +172,7 @@ if [ "$1" = "config" ]; then while [ "$nGpusCounter" -lt "$nGpus" ] do gpuName=$(echo "$nGpusOutput" | sed -n $((nGpusCounter+1))p | cut -d \( -f 1) - echo "power${nGpusCounter}.info power consumption of $gpuName" + echo "${name}${nGpusCounter}.info power consumption of $gpuName" : $((nGpusCounter=nGpusCounter+1)) done ;; @@ -186,7 +186,7 @@ if [ "$1" = "config" ]; then while [ "$nGpusCounter" -lt "$nGpus" ] do gpuName=$(echo "$nGpusOutput" | sed -n $((nGpusCounter+1))p | cut -d \( -f 1) - echo "utilization${nGpusCounter}.info GPU utilization information for $gpuName" + echo "${name}${nGpusCounter}.info GPU utilization information for $gpuName" : $((nGpusCounter=nGpusCounter+1)) done ;; @@ -255,6 +255,3 @@ do echo "${name}${nGpusCounter}.value $value" : $((nGpusCounter=nGpusCounter+1)) done - - -