Hello Dear all, I encountered a problem specifically the parameter "GPU utilization" does not show, I tried three templates, all as one show the temperature aand how much GPU memory is used and free. All these three options of templates and scripts, including the one below, work perfectly on Ubuntu and show all the parameters


I have Zabbix 7 Version
System from which I take readings
Debian 12 (6.1.0-28-amd64)
Zabfix agent2
config (for include)
script get_gpus_info.sh
I have Zabbix 7 Version
System from which I take readings
Debian 12 (6.1.0-28-amd64)
Zabfix agent2
config (for include)
HTML Code:
UserParameter=gpu.number,/usr/bin/nvidia-smi -L | /usr/bin/wc -l UserParameter=gpu.discovery,/etc/zabbix/scripts/get_gpus_info.sh UserParameter=gpu.fanspeed[*],nvidia-smi --query-gpu=fan.speed --format=csv,noheader,nounits -i $1 | tr -d "\n" UserParameter=gpu.power[*],nvidia-smi --query-gpu=power.draw --format=csv,noheader,nounits -i $1 | tr -d "\n" UserParameter=gpu.temp[*],nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader,nounits -i $1 | tr -d "\n" UserParameter=gpu.utilization[*],nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits -i $1 | tr -d "\n" UserParameter=gpu.memfree[*],nvidia-smi --query-gpu=memory.free --format=csv,noheader,nounits -i $1 | tr -d "\n" UserParameter=gpu.memused[*],nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits -i $1 | tr -d "\n" UserParameter=gpu.memtotal[*],nvidia-smi --query-gpu=memory.total --format=csv,noheader,nounits -i $1 | tr -d "\n" UserParameter=gpu.utilization.dec.min[*],nvidia-smi -q -d UTILIZATION -i $1 | grep -A 5 DEC | grep Min | tr -s ' ' | cut -d ' ' -f 4 UserParameter=gpu.utilization.dec.max[*],nvidia-smi -q -d UTILIZATION -i $1 | grep -A 5 DEC | grep Max | tr -s ' ' | cut -d ' ' -f 4 UserParameter=gpu.utilization.enc.min[*],nvidia-smi -q -d UTILIZATION -i $1 | grep -A 5 ENC | grep Min | tr -s ' ' | cut -d ' ' -f 4 UserParameter=gpu.utilization.enc.max[*],nvidia-smi -q -d UTILIZATION -i $1 | grep -A 5 ENC | grep Max | tr -s ' ' | cut -d ' ' -f 4
HTML Code:
#!/bin/bash
result=$(/usr/bin/nvidia-smi -L)
first=1
echo "{"
echo ""data":["
while IFS= read -r line
do
if (( "$first" != "1" ))
then
echo ,
fi
index=$(echo -n $line | cut -d ":" -f 1 | cut -d " " -f 2)
gpuuuid=$(echo -n $line | cut -d ":" -f 3 | tr -d ")" | tr -d " ")
echo -n {""{#GPUINDEX}"":"$index"", "{#GPUUUID}"":"$gpuuuid"}
if (( "$first" == "1" ))
then
# echo ,
first=0
fi
done < <(printf '%s\n' "$result")
echo
echo "]"
echo "}"
Comment