nagios: netapp ontap 8 control de tamaño por agregado


/ Published in: Bash
Save to your folder(s)



Copy this code and paste it in your HTML
  1. #!/bin/bash
  2. #####################################
  3. #
  4. # Script para monitorizar el tamano de los agregados
  5. # 04/05/2011 Jose Ramon Lambea
  6. # -v para verbose.
  7. #
  8. #####################################
  9.  
  10. stat=0
  11. strServer=$1
  12. maxperuAggr=$2
  13. verbose=$3
  14. binSSH='/usr/bin/ssh'
  15. cmdAggr='aggr status'
  16. cmdAggrSpc='aggr show_space'
  17. lstAggr=`${binSSH} root@${strServer} "${cmdAggr}" | grep aggr | sed 's/^ *//g' | cut -d" " -f1`
  18.  
  19. for var in `echo ${lstAggr}`
  20. do
  21. uAggr=`${binSSH} root@${strServer} "${cmdAggrSpc} ${var}" | tail -5 | head -1 | sed 's/ */ /g' | sed 's/KB//g' | cut -d" " -f3`
  22. aAggr=`${binSSH} root@${strServer} "${cmdAggrSpc} ${var}" | tail -5 | head -1 | sed 's/ */ /g' | sed 's/KB//g' | cut -d" " -f5`
  23. uAggrGB=`echo "scale=2;${uAggr}/1073741824" | bc`
  24. aAggrGB=`echo "scale=2;${aAggr}/1073741824" | bc`
  25. tAggrGB=`echo "scale=2;${uAggrGB}+${aAggrGB}" | bc`
  26. peruAggr=`echo "scale=2;${uAggrGB}/${tAggrGB}*100" | bc | cut -d"." -f1`
  27.  
  28. if [ "${verbose}" == "-v" ]; then
  29. echo "Espacio usado en " ${var} ": " ${uAggrGB} "GB"
  30. echo "Espacio libre en " ${var} ": " ${aAggrGB} "GB"
  31. echo "Espacio total en " ${var} ": " ${tAggrGB} "GB"
  32. echo "Porcentaje usado : " ${peruAggr} "%"
  33. fi
  34.  
  35. if (( $peruAggr>$maxperuAggr )); then
  36. echo ${var} " tiene mas de " ${maxperuAggr} "% ocupado: " ${peruAggr} "%. "
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.