Hello community, here is the log from the commit of package monitoring-plugins-sar-perf for openSUSE:Factory checked in at 2017-05-02 08:54:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/monitoring-plugins-sar-perf (Old) and /work/SRC/openSUSE:Factory/.monitoring-plugins-sar-perf.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "monitoring-plugins-sar-perf" Tue May 2 08:54:58 2017 rev:2 rq:492303 version:0.1 Changes: -------- --- /work/SRC/openSUSE:Factory/monitoring-plugins-sar-perf/monitoring-plugins-sar-perf.changes 2016-02-11 12:37:12.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.monitoring-plugins-sar-perf.new/monitoring-plugins-sar-perf.changes 2017-05-02 08:54:59.653464773 +0200 @@ -1,0 +2,5 @@ +Mon Apr 24 12:33:08 CEST 2017 - ro@suse.de + +- use -x for iostat and add utilization monitoring + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ monitoring-plugins-sar-perf.spec ++++++ --- /var/tmp/diff_new_pack.ORwkju/_old 2017-05-02 08:55:00.485347471 +0200 +++ /var/tmp/diff_new_pack.ORwkju/_new 2017-05-02 08:55:00.485347471 +0200 @@ -1,8 +1,7 @@ # # spec file for package monitoring-plugins-sar-perf # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,11 +18,11 @@ Name: monitoring-plugins-sar-perf Summary: Get performance data from sar -Version: 0.1 -Release: 100 -Url: https://github.com/nickanderson/check-sar-perf License: BSD-2-Clause Group: System/Monitoring +Version: 0.1 +Release: 0 +Url: https://github.com/nickanderson/check-sar-perf Source0: nickanderson-check-sar-perf-4878d0c.tar.gz Source1: check_iostat Source2: usr.lib.nagios.plugins.check_iostat @@ -35,7 +34,8 @@ %endif Provides: nagios-plugins-sar-perf = %{version}-%{release} Obsoletes: nagios-plugins-sar-perf < %{version}-%{release} -Requires: python sysstat +Requires: python +Requires: sysstat BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ check_iostat ++++++ --- /var/tmp/diff_new_pack.ORwkju/_old 2017-05-02 08:55:00.525341831 +0200 +++ /var/tmp/diff_new_pack.ORwkju/_new 2017-05-02 08:55:00.529341268 +0200 @@ -40,6 +40,8 @@ print "\t-w <tps>,<read>,<wrtn>\tSets the WARNING level for tps, KB_read/s and KB_written/s, respectively\n"; print "\t-C <percent>\t Sets the CRITICAL level for iowait\n"; print "\t-W <percent>\t Sets the WARNING level for iowait\n"; + print "\t-X <percent>\t Sets the CRITICAL level for utilization\n"; + print "\t-Y <percent>\t Sets the WARNING level for utilization\n"; print "\t\t\t(if no level is set for iowait, no warning is set for this value)\n"; exit 1; } @@ -51,13 +53,15 @@ # Getting parameters: my %opts; -getopts('d:w:c:W:C:hv', \%opts); +getopts('d:w:c:W:C:X:Y:hv', \%opts); my $disk = $opts{'d'}; my $warning = $opts{'w'}; my $critical = $opts{'c'}; my $warning_iowait = $opts{'W'}; my $critical_iowait = $opts{'C'}; +my $warning_util = $opts{'X'}; +my $critical_util = $opts{'Y'}; VERSION_MESSAGE() if $opts{'v'}; HELP_MESSAGE() if $opts{'h'}; @@ -89,16 +93,21 @@ } if ($warning_iowait && $critical_iowait && $warning_iowait > $critical_iowait) { - warn "ERROR: critical iowait level must be higher that warning level\n"; + warn "ERROR: critical iowait level must be higher than warning level\n"; HELP_MESSAGE(); } -my ($tps,$kbread,$kbwritten,$iowait); +if ($warning_util && $critical_util && $warning_util > $critical_util) { + warn "ERROR: critical utilization level must be higher than warning level\n"; + HELP_MESSAGE(); +} + +my ($tps,$rps,$wps,$kbread,$kbwritten,$iowait,$util); my $seen_usage = 0; my $seen_disk = 0; # Doing the actual check: -open (IOSTAT,"-|","$iostat -k $disk 5 2"); +open (IOSTAT,"-|","$iostat -kx $disk 5 2"); while (<IOSTAT>) { chomp(); if (/^[0-9\.\ \t]+$/) { @@ -112,7 +121,8 @@ $seen_disk++; next if $seen_disk < 2; my (@stats) = split ('\s+', $_); - ($tps,$kbread,$kbwritten) = @stats[1,2,3]; + ($rps,$wps,$kbread,$kbwritten,$util) = @stats[1,2,5,6,13]; + $tps = $rps + $wps; last; } } @@ -132,6 +142,11 @@ $status = 1; } +if ($warning_util && $util >= $warning_util) { + $msg = "WARNING"; + $status = 1; +} + if ($tps >= $crit_tps || $kbread >= $crit_read || $kbwritten >= $crit_written) { $msg = "CRITICAL"; $status = 2; @@ -142,9 +157,13 @@ $status = 2; } +if ($critical_util && $iowait >= $critical_util) { + $msg = "CRITICAL"; + $status = 2; +} # Printing the results: -print "$msg - I/O stats tps=$tps KB_read/s=$kbread KB_written/s=$kbwritten iowait=$iowait | 'tps'=$tps; 'KB_read/s'=$kbread; 'KB_written/s'=$kbwritten; 'iowait'=$iowait\n"; +print "$msg - I/O stats tps=$tps KB_read/s=$kbread KB_written/s=$kbwritten iowait=$iowait util=$util | 'tps'=$tps; 'KB_read/s'=$kbread; 'KB_written/s'=$kbwritten; 'iowait'=$iowait; 'util'=$util\n"; # Bye! exit $status;