Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #%# family=gpu
  4. #%# capabilities=autoconf
  5.  
  6. # this munin plugin monitors the cooling fans through mbmon
  7. # dependencies on external programs:
  8. # mbmon
  9.  
  10.  
  11. # yyyy/mm/dd v author changelog:
  12. # 2008/01/16 v0.01 Lothar Schmidt initial version, email: l.make.a.noise.here@scarydevilmonastery.net
  13.  
  14.  
  15.  
  16.  
  17.  
  18. # ----------------------------------------------------------------------------------
  19. #
  20. # CONFIGURATION DEPARTMENT
  21. #
  22. # ----------------------------------------------------------------------------------
  23.  
  24.  
  25. STYLE=LINE2 # graph style for number of listeners
  26. GRAPH="GPU fan speeds" # graph name, labels
  27. SECTION="GPU" # graph section
  28. #FANS=($(DISPLAY=:0 aticonfig --pplib-cmd "get fanspeed 0" | awk '/Result/ {print $4}' | cut -d "%" -f1))
  29.  
  30.  
  31.  
  32. # -------------------------------------------------------------------------------------
  33.  
  34. COUNT_DEVICE='./getatinumber.py'
  35. NFANS=$($COUNT_DEVICE)
  36.  
  37.  
  38. # --- check whether sensors returned data ---
  39. run_autoconf() {
  40. if (( NFANS )) ; then echo yes ; exit 0 ; fi
  41.  
  42. echo U ; exit 1 ; }
  43.  
  44.  
  45.  
  46.  
  47. run_config() { cat << EOF
  48. graph_title GPU Fan revolution rates
  49. graph_category ${SECTION}
  50. graph_args --base 1000 -l 0
  51. graph_vlabel RPM
  52. EOF
  53. for (( I=0 ; I<NFANS ; I++ )) ; do
  54. (( FANS[I] )) && cat << EOF
  55. fan${I}.label fan $I
  56. fan${I}.draw $STYLE
  57. EOF
  58. done
  59. }
  60.  
  61.  
  62.  
  63. run_() {
  64. for (( I=0 ; I<NFANS ; I++ )) ; do
  65. echo -n "gpu$(echo $I).value "; DISPLAY=:0.$I aticonfig --pplib-cmd "get fanspeed 0" | awk '/Result/ {print $4}' | cut -d "%" -f1
  66. done
  67. }
  68.  
  69. run_$1
  70. exit 0
  71.  
  72.  
  73.  
  74. user@linuxcoin:/etc/munin/plugins# munin-run gpu_fanspeed2
  75. gpu0.value 80
  76. gpu1.value 100
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement