mirror of
https://github.com/librenms/librenms-agent.git
synced 2024-05-09 09:54:52 +00:00
add Nvidia SNMP extend poller (#94)
* add Nvidia SNMP extend * update the extend path * now support more than 4 GPUs this will now support how ever many GPUs are installed on a system... Just double checked and it appears nvidia-smi dmon only reports up to 4 GPUs at a time... so if we have more than 4, begin checking they exist and if so print them
This commit is contained in:
39
snmp/nvidia
Normal file
39
snmp/nvidia
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Add this to snmpd.conf as below.
|
||||
# extend nvidia /etc/snmps/nvidia
|
||||
|
||||
# Please verify the following paths are correct
|
||||
nvidiasmi='/usr/bin/env nvidia-smi'
|
||||
grep='/usr/bin/env grep'
|
||||
sed='/usr/bin/env sed'
|
||||
|
||||
##
|
||||
## Nothing below here should need touched.
|
||||
##
|
||||
|
||||
## gpu pwr temp sm mem enc dec mclk pclk pviol tviol fb bar1 sbecc dbecc pci rxpci txpci
|
||||
## Idx W C % % % % MHz MHz % bool MB MB errs errs errs MB/s MB/s
|
||||
# 0 1 43 3 2 0 0 2700 862 0 0 462 4 - - 0 26 3
|
||||
$nvidiasmi dmon -c 1 -s pucvmet | $grep -v ^# | $sed 's/^ *//' | $sed 's/ */,/g' | $sed 's/-/0/g'
|
||||
|
||||
lines=`$nvidiasmi dmon -c 1 -s pucvmet | $grep -v ^# | $sed 's/^ *//' | $sed 's/ */,/g' | $sed 's/-/0/g' | wc -l`
|
||||
|
||||
# if we are less than 5 then all GPUs were printed
|
||||
if [ $lines -lt 5 ]; then
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
gpu=5
|
||||
loop=1
|
||||
while [ $loop -eq 1 ]
|
||||
do
|
||||
$nvidiasmi dmon -c 1 -i $gpu > /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
$nvidiasmi dmon -c 1 -s pucvmet -i $gpu | $grep -v ^# | $sed 's/^ *//' | $sed 's/ */,/g' | $sed 's/-/0/g'
|
||||
else
|
||||
loop=0
|
||||
fi
|
||||
|
||||
gpu=`expr $gpu + 1`
|
||||
done
|
Reference in New Issue
Block a user