Monitoring unmounted partition

Tntteam tntteam at free.fr
Tue Feb 8 14:28:33 CET 2011


Here is my script that you can rewrite to fit ur needs

#!/bin/bash

disk=/dev/sdb

STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
STATETEXT=( "OK" "WARNING" "CRITICAL" "UNKNOWN" )
seuil_warn=$1
seuil_crit=$2


STATE=$STATE_UNKNOWN
RETURN="UKNOWN STATE"

declare -a result

IFS=$'\n'
result=( `df` )


if [[ `df` = *$disk* ]]
then
        taille=${#result[*]}
        for ((i=0;i<$taille;i++))
        do
                if [[ ${result[$i]} = *$disk* ]]
                then
                        disque_usage=`echo "${result[$i]}"|awk -F" "
'{print $5}'|awk -F"%" '{print $1}'`
                        if (( $disque_usage >= $seuil_crit ))
                        then
                                STATE=$STATE_CRITICAL
                        else
                                if (( $disque_usage >= $seuil_warn ))
                                then
                                        STATE=$STATE_WARNING
                                else
                                        STATE=$STATE_OK;
                                fi
                        fi
                RETURN="Disque $disk monte,
utilisation=$disque_usage%|$disk=$disque_usage%;$seuil_warn;$seuil_crit;0"
                fi
        done

else
        echo "Disque $disk NON monte"
        STATE=$STATE_CRITICAL;
fi

unset IFS

echo ${STATETEXT[$STATE]} : $RETURN
exit $STATE;


>>
>> Thanks in advance.
>>
>> Sorry for my english. I write it also in spanish, if u use a translator
>> maybe u understand me better.
>>
>> Estoy teniendo un problema con check_nrpe. Estoy monitorizando la partición
>> /mnt/XXXX2 por ejemplo. Si no tengo esta partición montada, me devuelve la
>> información de "/" y no da ningún error.
>>
>> ¿Como puedo hacer para que salte alerta cuando no esta montada?.
>>
>>
>> Gracias
>>
>> ------------------------------------------------------------------------------
>> The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
>> Pinpoint memory and threading errors before they happen.
>> Find and fix more than 250 security defects in the development cycle.
>> Locate bottlenecks in serial and parallel code that limit performance.
>> http://p.sf.net/sfu/intel-dev2devfeb
>> _______________________________________________
>> Nagios-users mailing list
>> Nagios-users at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/nagios-users
>> ::: Please include Nagios version, plugin version (-v) and OS when reporting
>> any issue.
>> ::: Messages without supporting info will risk being sent to /dev/null
>>
>
> ------------------------------------------------------------------------------
> The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
> Pinpoint memory and threading errors before they happen.
> Find and fix more than 250 security defects in the development cycle.
> Locate bottlenecks in serial and parallel code that limit performance.
> http://p.sf.net/sfu/intel-dev2devfeb
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null
>

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list