Accepting request 159212 from home:vjt:ifad

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
This commit is contained in:
Wolfgang Rosenauer 2013-03-13 21:24:12 +00:00 committed by Git OBS Bridge
parent bbb95028c9
commit 1e10801db8
3 changed files with 74 additions and 1 deletions

View File

@ -0,0 +1,59 @@
--- 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];
}
}

View File

@ -1,6 +1,16 @@
-------------------------------------------------------------------
Wed Mar 13 18:46:16 UTC 2013 - vjt@openssl.it
- Include an improved quota usage plugin that gets warning and
critical values from the configured soft and hard quotas.
Found in the wild on
https://svn.koumbit.net/koumbit/trunk/munin-plugins/quota-usage
tested and adapted.
-------------------------------------------------------------------
Thu Mar 7 11:06:49 UTC 2013 - vjt@openssl.it
- Update to 2.0.11.1
- Add nginx plugins from http://github.com/ifad/nginx-munin
-------------------------------------------------------------------

View File

@ -29,6 +29,8 @@ Source9: munin-node.service
%endif
# https://github.com/ifad/nginx-munin/archive/master.zip
Source10: nginx-munin.zip
# https://svn.koumbit.net/koumbit/trunk/munin-plugins/quota-usage
Patch: munin-plugin-quota_usage_warnings.patch
BuildRequires: perl-HTML-Template perl-Log-Log4perl perl-Net-Server perl-Net-SNMP
BuildRequires: perl-Net-SSLeay
BuildRequires: html2text
@ -101,6 +103,7 @@ RRDtool. To see a real example of Munin in action, take a peek at
%setup -q
cp %{SOURCE1} .
unzip %{SOURCE10}
%patch
%build
@ -214,7 +217,7 @@ fi
%files
%defattr(-, root, root)
%doc ChangeLog COPYING README UPGRADING README.nginx
%doc ChangeLog COPYING README UPGRADING
%{_bindir}/munin-check
%{_bindir}/munin-cron
%{_bindir}/munindoc
@ -285,6 +288,7 @@ fi
%files node
%defattr(-, root, root)
%doc README.nginx
%{_sbindir}/munin-run
%{_sbindir}/munin-sched
%{_sbindir}/munin-node