# vim: ft=sh function disk_space () { local level=(warning severe danger) local min=80 local inodes=1 local taille=2 local type= df=($(df --sync --output=target,ipcent,pcent /dev/sda* | sed 1d)) for ((i=0; i<${#df[@]}; i+=3)); do test ${df[i]} == '/usr' -o ${df[i]} == '/' -o ${df[i]} == '/dev' && continue for type in inodes taille; do test ${df[i+${!type}]/%%} -gt $min \ && l=$(( (${df[i+${!type}]/%%} - $min) / ((100 - $min) / ${#level[@]}) )) \ && l=${l/${#level[@]}/$((${#level[@]}-1))} \ && echo "${level[l]}: ${df[i]} plein à ${df[i+${!type}]} ($type)" done done } function upgrades () { # surcharge upgrades de common-tests # les mises à jour de cette machine sont surveillées manuellement return }