1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Update quota2percent_ to V17.0214

Following some idea of "Sumpfralle!
This commit is contained in:
JoHartmann 2017-02-14 14:57:46 +01:00 committed by GitHub
parent b430482f68
commit e0b47d579e

View file

@ -19,7 +19,7 @@ The following is the default configuration
[quota2percent_*]
user root
You could define two alert levels and the graph language
You could define two alert levels, the graph language, min. human UID and dealing with system users
[quota2percent_*]
env.warning [value] (default: 90)
@ -52,33 +52,31 @@ I<<< ln -s /<path to file>/quota2percent_ quota2percent_sdb1 >>>
=head1 VERSION
17.0213
17.0214
=head1 HISTORY
V17.0213
V17.0214
fix hard reading logic operation for skipping by Low_UID=never
fix some slips
fix some nitpicking details
add env.low_uid
V17.0210
add env.humanid
add env.language
add check if device exist
add if no limitations administered via 'quota' for the device the total line is shown only
fix some nitpicking details
add some comments
V17.0131
add a few comments
add POD documentation
add env.language
add example graph for Munin Plugin Gallery
remove setting a PATH
remove German comments
V17.0124
first version, not munin rules conform
not pubish, first version
=head1 AUTHOR
@ -123,9 +121,6 @@ GPLv2 (L<http://www.gnu.org/licenses/gpl-2.0.html>)
Min_UID=${humanuid:-1000}
Low_UID=${low_uid:-never}
# Ensure that the 'root' path is valid
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Checking if repquota installed and on the path
if ! repquota -V &> /dev/null ; then
echo "The script 'repquota' is not installed or on the path" >&2
@ -151,8 +146,12 @@ GPLv2 (L<http://www.gnu.org/licenses/gpl-2.0.html>)
readarray Quotas < <( repquota "/dev/$Id" | grep " -- " )
else
echo "No limitations administered via 'quota' for $Id" >&2
# If no limitatitons administered: create a dummy
# If no limitatitons administered: create a dummy for regarding
# the avoidance of a divide-by-zero error
Quotas[0]="root -- 1 1 1 1 1 1"
# no rrd file need
Low_UID="never"
fi
@ -173,16 +172,16 @@ GPLv2 (L<http://www.gnu.org/licenses/gpl-2.0.html>)
de)
echo "graph_title Quota-Hard-Limit von $Id"
echo "graph_vlabel Nutzung in % Hardlimit"
echo "graph_info Die Grafik zeigt die Belegung des durch Quota reglementierten Speicherplatzes für alle regulären Nutzer (UID >= $Min_UID) in Prozent des Hardlimits."
echo "graph_info Die Grafik zeigt die Belegung des durch Quota reglementierten Speicherplatzes für alle regulären Nutzer (UID >= $Min_UID) in Prozent des Hardlimits."
Total_txt="Su. aller Nutzer"
Total_info="Inklusive Systemnutzer (UID < $Min_UID)"
;;
es)
echo "graph_title Cuota de límite absoluto de $Id"
echo "graph_vlabel el % de uso del límite duro"
echo "graph_info El gráfico muestra la disponibilidad de espacio regulado por cuotas para todos los usuarios regulares (UID >= $Min_UID) como porcentaje de límites duros."
echo "graph_title Cuota de límite absoluto de $Id"
echo "graph_vlabel el % de uso del límite duro"
echo "graph_info El gráfico muestra la disponibilidad de espacio regulado por cuotas para todos los usuarios regulares (UID >= $Min_UID) como porcentaje de límites duros."
Total_txt="Suma de todos los usuarios "
Total_info="La inclusión de usuario del sistema (UID < $Min_UID) "
Total_info="La inclusión de usuario del sistema (UID < $Min_UID) "
;;
*)
echo "graph_title quota hard limit of $Id"
@ -210,17 +209,16 @@ GPLv2 (L<http://www.gnu.org/licenses/gpl-2.0.html>)
Cur_UID="$(id -u "$User")"
# skip if actual user a system user und low_uid ist set to never
if [ ! "$Low_UID" == "never" ] || [ ! "$Cur_UID" -lt "$Min_UID" ]; then
[ "$Cur_UID" -lt "$Min_UID" ] && [ "$Low_UID" = "never" ] && continue
# No graph for none human uid if low_uid ist set to no
[ "$Cur_UID" -lt "$Min_UID" ] && echo "$Fieldname.graph $Low_UID"
# configure the user lines
echo "$Fieldname.label $User"
echo "$Fieldname.warning $Warning"
echo "$Fieldname.critical $Critical"
fi
# No graph for none human uid if low_uid ist set to no
[ "$Cur_UID" -lt "$Min_UID" ] && echo "$Fieldname.graph $Low_UID"
# configure the user lines
echo "$Fieldname.label $User"
echo "$Fieldname.warning $Warning"
echo "$Fieldname.critical $Critical"
done
# configure the total line and send exit code NO ERROR happens
@ -241,9 +239,10 @@ GPLv2 (L<http://www.gnu.org/licenses/gpl-2.0.html>)
Fieldname="$(clean_fieldname "${Quota[0]}")"
# skip if actual user a system user und low_uid ist set to never
if [ ! "$Low_UID" == "never" ] || [ ! "$(id -u "${Quota[0]}")" -lt "$Min_UID" ]; then
echo "${Quota[2]} ${Quota[4]} $Fieldname.value" | awk '{printf "%s %f\n",$3,$1*100/$2}'
fi
[ "$Cur_UID" -lt "$Min_UID" ] && [ "$Low_UID" = "never" ] && continue
# write the result zu munin
echo "${Quota[2]} ${Quota[4]} $Fieldname.value" | awk '{printf "%s %f\n",$3,$1*100/$2}'
done