Révision 17f78427
Whitespace cleanup
- remove trailing whitespace
- remove empty lines at the end of files
| plugins/disk/quota2percent_ | ||
|---|---|---|
| 28 | 28 |
env.humanuid [value] (default: 1000, only need if there is an other value define for UID_MIN in /etc/login.defs) |
| 29 | 29 |
env.low_uid [never|no|yes] (default: never) |
| 30 | 30 |
set to no for producing rrd files for system user, but don't show those graphs (e.g. for later analyses) |
| 31 |
if set to yes system user graphs are drawn
|
|
| 31 |
if set to yes system user graphs are drawn |
|
| 32 | 32 |
|
| 33 | 33 |
=head1 DESCRIPTION |
| 34 | 34 |
|
| 35 |
Wild card Plugin for monitoring the utilization of devices with quota rules.
|
|
| 36 |
A graph is drawn for each user, which shows the usage as a percentage of his hard limit. System accounts (UID <1000) are suppressed.
|
|
| 37 |
In addition, a graph is displayed which indicates the ratio device size to device coverage.
|
|
| 38 |
The script repqutoa, usually part of the package quota, is needed.
|
|
| 35 |
Wild card Plugin for monitoring the utilization of devices with quota rules. |
|
| 36 |
A graph is drawn for each user, which shows the usage as a percentage of his hard limit. System accounts (UID <1000) are suppressed. |
|
| 37 |
In addition, a graph is displayed which indicates the ratio device size to device coverage. |
|
| 38 |
The script repqutoa, usually part of the package quota, is needed. |
|
| 39 | 39 |
The plugin itself can be stored in any directory. For example, the device sdb1 shell be monitored, a symbolic link must be created |
| 40 |
in the /etc/munin/plugins/ directory as follows:
|
|
| 40 |
in the /etc/munin/plugins/ directory as follows: |
|
| 41 | 41 |
|
| 42 |
=over
|
|
| 42 |
=over |
|
| 43 | 43 |
|
| 44 | 44 |
I<<< ln -s /<path to file>/quota2percent_ quota2percent_sdb1 >>> |
| 45 | 45 |
|
| ... | ... | |
| 72 | 72 |
add example graph for Munin Plugin Gallery |
| 73 | 73 |
|
| 74 | 74 |
remove setting a PATH |
| 75 |
remove German comments
|
|
| 75 |
remove German comments |
|
| 76 | 76 |
|
| 77 | 77 |
V17.0124 |
| 78 | 78 |
|
| ... | ... | |
| 83 | 83 |
Jo Hartmann |
| 84 | 84 |
|
| 85 | 85 |
=head1 LICENSE |
| 86 |
|
|
| 86 |
|
|
| 87 | 87 |
GPLv2 (L<http://www.gnu.org/licenses/gpl-2.0.html>) |
| 88 | 88 |
|
| 89 | 89 |
=cut |
| ... | ... | |
| 142 | 142 |
################################################### |
| 143 | 143 |
|
| 144 | 144 |
# Reading the quotes for the selected device, using repquota |
| 145 |
if repquota "/dev/$Id" &> /dev/null; then
|
|
| 145 |
if repquota "/dev/$Id" &> /dev/null; then |
|
| 146 | 146 |
readarray Quotas < <( repquota "/dev/$Id" | grep " -- " ) |
| 147 | 147 |
else |
| 148 | 148 |
echo "No limitations administered via 'quota' for $Id" >&2 |
| ... | ... | |
| 151 | 151 |
# the avoidance of a divide-by-zero error |
| 152 | 152 |
Quotas[0]="root -- 1 1 1 1 1 1" |
| 153 | 153 |
|
| 154 |
# no rrd file need
|
|
| 154 |
# no rrd file need |
|
| 155 | 155 |
Low_UID="never" |
| 156 | 156 |
fi |
| 157 | 157 |
|
| 158 | 158 |
readarray Totals < <( df "/dev/$Id" ) |
| 159 | 159 |
|
| 160 |
# Get the count of Users
|
|
| 160 |
# Get the count of Users |
|
| 161 | 161 |
Users=${#Quotas[@]}
|
| 162 | 162 |
|
| 163 | 163 |
|
| ... | ... | |
| 167 | 167 |
|
| 168 | 168 |
if [ "$1" = "config" ]; then |
| 169 | 169 |
|
| 170 |
# Localisation of the graphic texts
|
|
| 170 |
# Localisation of the graphic texts |
|
| 171 | 171 |
case $Language in |
| 172 | 172 |
de) |
| 173 | 173 |
echo "graph_title Quota-Hard-Limit von $Id" |
| ... | ... | |
| 176 | 176 |
Total_txt="Su. aller Nutzer" |
| 177 | 177 |
Total_info="Inklusive Systemnutzer (UID < $Min_UID)" |
| 178 | 178 |
;; |
| 179 |
es)
|
|
| 180 |
echo "graph_title Cuota de límite absoluto de $Id"
|
|
| 181 |
echo "graph_vlabel el % de uso del límite duro"
|
|
| 179 |
es) |
|
| 180 |
echo "graph_title Cuota de límite absoluto de $Id" |
|
| 181 |
echo "graph_vlabel el % de uso del límite duro" |
|
| 182 | 182 |
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." |
| 183 | 183 |
Total_txt="Suma de todos los usuarios " |
| 184 | 184 |
Total_info="La inclusión de usuario del sistema (UID < $Min_UID) " |
| ... | ... | |
| 188 | 188 |
echo "graph_vlabel Usage in %" |
| 189 | 189 |
echo "graph_info The graphic shows the allocation of the quota-regulated storage space for all regular users (UID >= $Min_UID) as a percentage of the hard limit ." |
| 190 | 190 |
Total_txt="all users" |
| 191 |
Total_info="system users (UID < $Min_UID) included"
|
|
| 191 |
Total_info="system users (UID < $Min_UID) included" |
|
| 192 | 192 |
;; |
| 193 | 193 |
esac |
| 194 | 194 |
|
| 195 |
# Defaults configuration
|
|
| 195 |
# Defaults configuration |
|
| 196 | 196 |
echo "graph_category disk" |
| 197 | 197 |
echo "graph_args --lower-limit 0 --upper-limit 100" |
| 198 | 198 |
echo "graph_printf %5.2lf %%" |
| ... | ... | |
| 208 | 208 |
# Determine the currently processing UID |
| 209 | 209 |
Cur_UID="$(id -u "$User")" |
| 210 | 210 |
|
| 211 |
# skip if actual user a system user und low_uid ist set to never
|
|
| 211 |
# skip if actual user a system user und low_uid ist set to never |
|
| 212 | 212 |
[ "$Cur_UID" -lt "$Min_UID" ] && [ "$Low_UID" = "never" ] && continue |
| 213 |
|
|
| 213 |
|
|
| 214 | 214 |
# No graph for none human uid if low_uid ist set to no |
| 215 | 215 |
[ "$Cur_UID" -lt "$Min_UID" ] && echo "$Fieldname.graph $Low_UID" |
| 216 | 216 |
|
| ... | ... | |
| 218 | 218 |
echo "$Fieldname.label $User" |
| 219 | 219 |
echo "$Fieldname.warning $Warning" |
| 220 | 220 |
echo "$Fieldname.critical $Critical" |
| 221 |
|
|
| 221 |
|
|
| 222 | 222 |
done |
| 223 | 223 |
|
| 224 | 224 |
# configure the total line and send exit code NO ERROR happens |
| ... | ... | |
| 238 | 238 |
Quota=( ${Quotas[$i]} )
|
| 239 | 239 |
Fieldname="$(clean_fieldname "${Quota[0]}")"
|
| 240 | 240 |
|
| 241 |
# skip if actual user a system user und low_uid ist set to never
|
|
| 241 |
# skip if actual user a system user und low_uid ist set to never |
|
| 242 | 242 |
[ "$Cur_UID" -lt "$Min_UID" ] && [ "$Low_UID" = "never" ] && continue |
| 243 | 243 |
|
| 244 |
# write the result zu munin
|
|
| 244 |
# write the result zu munin |
|
| 245 | 245 |
echo "${Quota[2]} ${Quota[4]} $Fieldname.value" | awk '{printf "%s %f\n",$3,$1*100/$2}'
|
| 246 | 246 |
|
| 247 | 247 |
done |
| 248 | 248 |
|
| 249 |
# the value for the total line
|
|
| 249 |
# the value for the total line |
|
| 250 | 250 |
Total=( ${Totals[1]} )
|
| 251 | 251 |
echo "${Total[2]} ${Total[1]} total.value" | awk '{printf "%s %f\n",$3,$1*100/$2}'
|
| 252 | 252 |
|
Formats disponibles : Unified diff