Posted By

crackiron on 05/08/11


Tagged

Bash nagios netapp ontap


Versions (?)

nagios: netapp ontap 8 control de tamaño por volúmen


 / Published in: Bash
 

  1. #!/bin/bash
  2. #####################################
  3. #
  4. # Script para monitorizar el tamano de los volumenes de los agregados
  5. # 05/05/2011 Jose Ramon Lambea
  6. # -v para verbose.
  7. #
  8. #####################################
  9.  
  10. stat=0
  11. strServer=$1
  12. maxperuVol=$2
  13. verbose=$3
  14. binSSH='/usr/bin/ssh'
  15. cmdVol='df -h'
  16. lstVol=`${binSSH} root@${strServer} "${cmdVol}" | grep "^/vol/" | grep -v "snapshot" | cut -d" " -f1`
  17.  
  18. for var in `echo ${lstVol}`
  19. do
  20.  
  21. strDummy=`${binSSH} root@${strServer} "${cmdVol} ${var}" | grep ${var} | grep -v "snapshot" | sed 's/ */ /g'`
  22. peruVol=`echo ${strDummy} | cut -d" " -f5 | sed 's/%//'`
  23.  
  24. if [ "${verbose}" == "-v" ]; then
  25. uVolGB=`echo ${strDummy} | cut -d" " -f3`
  26. aVolGB=`echo ${strDummy} | cut -d" " -f4`
  27. tVolGB=`echo ${strDummy} | cut -d" " -f2`
  28.  
  29. echo "Espacio usado en " ${var} ": " ${uVolGB} "GB"
  30. echo "Espacio libre en " ${var} ": " ${aVolGB} "GB"
  31. echo "Espacio total en " ${var} ": " ${tVolGB} "GB"
  32. echo "Porcentaje usado : " ${peruVol} "%"
  33. fi
  34.  
  35. if (( $peruVol>$maxperuVol )); then
  36. echo ${var} " tiene mas de " ${maxperuVol} "% ocupado: " ${peruVol} "%. "
  37. stat=2
  38. fi
  39.  
  40. done
  41.  
  42. if (( $stat==0 )); then
  43. echo "Control finalizado sin incidencias"
  44. fi
  45.  
  46. exit ${stat}

Report this snippet  

You need to login to post a comment.