????

Your IP : 3.15.25.34


Current Path : /usr/lib64/nagios/plugins/
Upload File :
Current File : //usr/lib64/nagios/plugins/check_mailq

#!/bin/bash
#Plugin de verificacion de queues
#
#by LeoCapurro @ NUTHOST

#!/bin/bash

mostrar_uso() {
    echo "Uso: $0 -w <valor_warning> -c <valor_critical>"
    echo "  -w <valor_warning>: Valor de advertencia"
    echo "  -c <valor_critical>: Valor crítico"
    exit 1
}

if [ $# -ne 4 ]; then
    mostrar_uso
fi

warning=""
critical=""

while getopts "w:c:" opcion; do
    case $opcion in
        w)
            warning=$OPTARG
            ;;
        c)
            critical=$OPTARG
            ;;
        \?)
            mostrar_uso
            ;;
    esac
done

if [ -z "$warning" ] || [ -z "$critical" ]; then
    mostrar_uso
fi


if [ "$warning" -gt "$critical" ]; then
    echo "ERROR: El valor de advertencia no puede ser mayor que el valor crítico."
    exit 2
fi


ro=`/usr/sbin/exim -bpc`
REP=`cat /proc/mounts | grep -v virtfs | grep -v cage | grep -v remount | grep -v cgroup | grep "ro," | awk '{print $2}'`
if [ $ro -gt $warning ]
 then
 if [ $ro -gt $critical ]
  then
    echo "CRITICAL - $ro Emails en el queue "
    exit 2
  else
    echo "WARNING - $ro Emails en el queue "
    exit 1
  fi
else
 echo "OK - =D"
 exit 0
fi