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_*] [quota2percent_*]
user root 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_*] [quota2percent_*]
env.warning [value] (default: 90) env.warning [value] (default: 90)
@ -52,33 +52,31 @@ I<<< ln -s /<path to file>/quota2percent_ quota2percent_sdb1 >>>
=head1 VERSION =head1 VERSION
17.0213 17.0214
=head1 HISTORY =head1 HISTORY
V17.0213 V17.0214
fix hard reading logic operation for skipping by Low_UID=never
fix some slips fix some slips
fix some nitpicking details
add env.low_uid add env.low_uid
V17.0210
add env.humanid add env.humanid
add env.language
add check if device exist add check if device exist
add if no limitations administered via 'quota' for the device the total line is shown only add if no limitations administered via 'quota' for the device the total line is shown only
fix some nitpicking details add a few comments
add some comments
V17.0131
add POD documentation add POD documentation
add env.language
add example graph for Munin Plugin Gallery add example graph for Munin Plugin Gallery
remove setting a PATH
remove German comments remove German comments
V17.0124 V17.0124
first version, not munin rules conform not pubish, first version
=head1 AUTHOR =head1 AUTHOR
@ -123,9 +121,6 @@ GPLv2 (L<http://www.gnu.org/licenses/gpl-2.0.html>)
Min_UID=${humanuid:-1000} Min_UID=${humanuid:-1000}
Low_UID=${low_uid:-never} 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 # Checking if repquota installed and on the path
if ! repquota -V &> /dev/null ; then if ! repquota -V &> /dev/null ; then
echo "The script 'repquota' is not installed or on the path" >&2 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 " -- " ) readarray Quotas < <( repquota "/dev/$Id" | grep " -- " )
else else
echo "No limitations administered via 'quota' for $Id" >&2 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" Quotas[0]="root -- 1 1 1 1 1 1"
# no rrd file need
Low_UID="never" Low_UID="never"
fi fi
@ -173,16 +172,16 @@ GPLv2 (L<http://www.gnu.org/licenses/gpl-2.0.html>)
de) de)
echo "graph_title Quota-Hard-Limit von $Id" echo "graph_title Quota-Hard-Limit von $Id"
echo "graph_vlabel Nutzung in % Hardlimit" 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_txt="Su. aller Nutzer"
Total_info="Inklusive Systemnutzer (UID < $Min_UID)" Total_info="Inklusive Systemnutzer (UID < $Min_UID)"
;; ;;
es) es)
echo "graph_title Cuota de límite absoluto de $Id" echo "graph_title Cuota de límite absoluto de $Id"
echo "graph_vlabel el % de uso del límite duro" 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_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_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" 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")" Cur_UID="$(id -u "$User")"
# skip if actual user a system user und low_uid ist set to never # 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 # No graph for none human uid if low_uid ist set to no
[ "$Cur_UID" -lt "$Min_UID" ] && echo "$Fieldname.graph $Low_UID" [ "$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
# configure the user lines
echo "$Fieldname.label $User"
echo "$Fieldname.warning $Warning"
echo "$Fieldname.critical $Critical"
done done
# configure the total line and send exit code NO ERROR happens # 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]}")" Fieldname="$(clean_fieldname "${Quota[0]}")"
# skip if actual user a system user und low_uid ist set to never # 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 [ "$Cur_UID" -lt "$Min_UID" ] && [ "$Low_UID" = "never" ] && continue
echo "${Quota[2]} ${Quota[4]} $Fieldname.value" | awk '{printf "%s %f\n",$3,$1*100/$2}'
fi # write the result zu munin
echo "${Quota[2]} ${Quota[4]} $Fieldname.value" | awk '{printf "%s %f\n",$3,$1*100/$2}'
done done