Return to Snippet

Revision: 45791
at May 8, 2011 08:02 by crackiron


Initial Code
#!/bin/bash
#####################################
#
# Script para monitorizar el tamano de los volumenes de los agregados
# 05/05/2011 Jose Ramon Lambea
# -v para verbose.
#
#####################################

stat=0
strServer=$1
maxperuVol=$2
verbose=$3
binSSH='/usr/bin/ssh'
cmdVol='df -h'
lstVol=`${binSSH} root@${strServer} "${cmdVol}" | grep "^/vol/" | grep -v "snapshot" | cut -d" " -f1`

for var in `echo ${lstVol}`
do

        strDummy=`${binSSH} root@${strServer} "${cmdVol} ${var}" | grep ${var} | grep -v "snapshot" | sed 's/  */ /g'`
        peruVol=`echo ${strDummy} | cut -d" " -f5 | sed 's/%//'`

        if [ "${verbose}" == "-v" ]; then
                uVolGB=`echo ${strDummy} | cut -d" " -f3`
                aVolGB=`echo ${strDummy} | cut -d" " -f4`
                tVolGB=`echo ${strDummy} | cut -d" " -f2`

                echo "Espacio usado en " ${var} ": " ${uVolGB} "GB"
                echo "Espacio libre en " ${var} ": " ${aVolGB} "GB"
                echo "Espacio total en " ${var} ": " ${tVolGB} "GB"
                echo "Porcentaje usado : " ${peruVol} "%"
        fi

        if (( $peruVol>$maxperuVol )); then
                echo ${var} " tiene mas de " ${maxperuVol} "% ocupado: " ${peruVol} "%. "
                stat=2
        fi

done

if (( $stat==0 )); then
        echo "Control finalizado sin incidencias"
fi

exit ${stat}

Initial URL

                                

Initial Description

                                

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

Initial Tags
Bash

Initial Language
Bash