1e10801db8
I've added an improved quota plugin that sets the warning and critical thresholds from the configured soft and hard quotas. :-) OBS-URL: https://build.opensuse.org/request/show/159212 OBS-URL: https://build.opensuse.org/package/show/server:monitoring/munin?expand=0&rev=5
60 lines
1.7 KiB
Diff
60 lines
1.7 KiB
Diff
--- plugins/node.d.linux/quota_usage_.in.orig 2013-03-13 19:39:31.000000000 +0100
|
|
+++ plugins/node.d.linux/quota_usage_.in 2013-03-13 19:41:16.000000000 +0100
|
|
@@ -6,6 +6,11 @@
|
|
# ln -s), for example quota-usage_hda3. Use underscores instead of slashes, for
|
|
# example to monitor /dev/mapper/vol-foo, name this quota-usage_mapper_vol-foo
|
|
#
|
|
+# This plugin uses the soft and hard quota data for warning and critical
|
|
+# levels respectively.
|
|
+#
|
|
+# Source: https://svn.koumbit.net/koumbit/trunk/munin-plugins/quota-usage
|
|
+#
|
|
# Parameters understood:
|
|
#
|
|
# config (required)
|
|
@@ -28,7 +33,14 @@
|
|
chomp;
|
|
if (/^-+$/../^$/) {
|
|
my @data = split(/ +/);
|
|
- $users{$data[0]} = $data[2] if (@data > 2 && $data[2] > 0);
|
|
+
|
|
+ next if !$data[0] || $data[0] =~ /^#/;
|
|
+
|
|
+ if ( @data > 2 && $data[2] > 0 ) {
|
|
+ $users{$data[0]}[0] = $data[2]; # current usage
|
|
+ $users{$data[0]}[1] = $data[3]; # Soft quota
|
|
+ $users{$data[0]}[2] = $data[4]; # Hard quota
|
|
+ }
|
|
}
|
|
}
|
|
close REP;
|
|
@@ -45,15 +57,26 @@
|
|
$name = $user if (length($name) < length($user));
|
|
$user = clean_fieldname($user);
|
|
$name = (split(/,/, $name))[0];
|
|
+
|
|
printf "%s.label %s\n", $user, $name;
|
|
printf "%s.cdef %s,1024,*\n", $user, $user;
|
|
- printf "%s.graph no\n", $user if ($uid < 1000);
|
|
+
|
|
+ if ($users{$user}[1] && $users{$user}[1] > 0) {
|
|
+ printf "%s.warning %s\n", $user, $users{$user}[1];
|
|
+ }
|
|
+ if ($users{$user}[2] && $users{$user}[2] > 0) {
|
|
+ printf "%s.critical %s\n", $user, $users{$user}[2];
|
|
+ }
|
|
+
|
|
+ if ($uid < 200) {
|
|
+ printf "%s.graph no\n", $user
|
|
+ }
|
|
}
|
|
} else {
|
|
for my $user (@users_by_usage) {
|
|
my $esc = $user;
|
|
$esc = clean_fieldname($esc);
|
|
- printf "%s.value %s\n", $esc, $users{$user};
|
|
+ printf "%s.value %s\n", $esc, $users{$user}[0];
|
|
}
|
|
}
|
|
|