Warren Postma (2014-05-12 16:53):
We have configured Jenkins to at least put nodes OFFLINE when their disk space is low, but manually checking these nodes seems a silly think when Jenkins should be emailing out.

I guess because disk space is a plugin I should ask the maintainers of the disk usage plugin about this, or is this a core Jenkins feature?

Assuming nodes are on lLinux you can use below:

##
# Check availble space in $1 directory and exit if $2 MiB is not availble
function checkAvailableSpace()
{
    dirToCheck=$1
    minMiB=$2

    available=$(($(stat -f --format="%a*%S" $dirToCheck)))
    available=$((available/1024/1024))
    if [ "$available" -lt "$minMiB" ]; then
echo "[ERROR] Not enough space available in $dirToCheck (free: $available MiB)!"
        exit 1
    else
echo "There seem to be enough space available in '$dirToCheck' (free: $available MiB)."
    fi
}


# usage - check for ~10 GiB free space
checkAvailableSpace /some/path/to/check 10240

--
You received this message because you are subscribed to the Google Groups "Jenkins 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to