Hello community,
here is the log from the commit of package monitoring-plugins-contentage for
openSUSE:Factory checked in at 2020-01-12 23:25:41
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/monitoring-plugins-contentage (Old)
and /work/SRC/openSUSE:Factory/.monitoring-plugins-contentage.new.6675
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "monitoring-plugins-contentage"
Sun Jan 12 23:25:41 2020 rev:4 rq:763391 version:0.7
Changes:
--------
---
/work/SRC/openSUSE:Factory/monitoring-plugins-contentage/monitoring-plugins-contentage.changes
2014-08-13 17:08:08.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.monitoring-plugins-contentage.new.6675/monitoring-plugins-contentage.changes
2020-01-12 23:26:35.238865017 +0100
@@ -1,0 +2,8 @@
+Sat Jan 4 22:18:08 UTC 2020 - Lars Vogdt <[email protected]>
+
+- update to 0.7:
+ + add debug output option
+ + add option to ignore specific files
+ + updated copyright notice
+
+-------------------------------------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ monitoring-plugins-contentage.spec ++++++
--- /var/tmp/diff_new_pack.z3fDp4/_old 2020-01-12 23:26:35.630865162 +0100
+++ /var/tmp/diff_new_pack.z3fDp4/_new 2020-01-12 23:26:35.634865164 +0100
@@ -1,7 +1,7 @@
#
# spec file for package monitoring-plugins-contentage
#
-# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 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
@@ -12,18 +12,17 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
-
Name: monitoring-plugins-contentage
-Version: 0.6
-Release: 1
-License: BSD-3-Clause
+Version: 0.7
+Release: 0
Summary: Check age of files in a directory
-Url: http://en.opensuse.org/Monitoring-plugins-contentage
+License: BSD-3-Clause
Group: System/Monitoring
+Url: http://en.opensuse.org/Monitoring-plugins-contentage
Source0: check_contentage
BuildRequires: nagios-rpm-macros
Provides: nagios-plugins-contentage = %{version}-%{release}
@@ -42,12 +41,15 @@
Note: the plugin checks the mtime of files, not the ctime.
-Usage: check_dircontent.pl -w 24 -c 48 -p /tmp
+Usage: check_dircontent.pl -w 24 -c 48 -p /tmp,/var/tmp -i foo,bar
Options:
-w|--warning : time for warnings (minutes)
-c|--critical : time for critical warnings (minutes)
-p|--pathnames : absolute path to the folders, split mutliple pathnames
with commata
-t|--timeout : timeout (default: 15)
+ -i|--ignore : ignore filenames (comma separated)
+ -d|--debug : print debug output
+
%prep
#
++++++ check_contentage ++++++
--- /var/tmp/diff_new_pack.z3fDp4/_old 2020-01-12 23:26:35.650865169 +0100
+++ /var/tmp/diff_new_pack.z3fDp4/_new 2020-01-12 23:26:35.650865169 +0100
@@ -4,6 +4,7 @@
# check_contentage - nagios plugin
#
# Copyright (C) 2012, SUSE Linux Products GmbH
+# Copyright (C) 2020, SUSE LCC
# Author: Lars Vogdt
#
# All rights reserved.
@@ -34,8 +35,6 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
-# $Id$
-#
use lib "/usr/lib/nagios/plugins";
use utils qw{$TIMEOUT %ERRORS print_revision};
@@ -47,11 +46,12 @@
use File::stat;
use POSIX qw(strftime);
-our $version="0.4";
+our $version="0.7";
our $time_warn=1440;
our $time_crit=4880;
our @pathnames=qw();
our $help=0;
+our @ignores=qw();
our $rev=0;
our $recursive=0;
our $errorstr="";
@@ -74,20 +74,22 @@
sub print_usage {
print "This plugin checks one or more directory for files older than a
specified age.\n";
print "You can define the age of files for warning and critical
states.\n\n";
- print "Usage: ".basename($0)." -w $time_warn -c $time_crit -p /tmp\n";
+ print "Usage: ".basename($0)." -w $time_warn -c $time_crit -p
/tmp,/var/tmp -i /tmp/foo,/tmp/bar\n";
print "Options:\n";
print " -w|--warning : time for warnings (minutes)\n";
print " -c|--critical : time for critical warnings (minutes)\n";
print " -p|--pathnames : absolute path to the folders, split
mutliple pathnames with commata\n";
# print " -r|--recursive : dive into subfolders\n";
print " -t|--timeout : timeout (default: $TIMEOUT)\n";
+ print " -i|--ignore : ignore filenames (comma separated)\n";
+ print " -d|--debug : print debug output\n";
}
sub print_help {
my $exitcode=shift || 1;
- print "Copyright (c) 2009, Novell, Inc.\n\n";
+ print "Copyright (c) 2020, SUSE LCC\n\n";
print_usage();
- print "\n";
+ print "\n";
exit $exitcode;
}
@@ -98,10 +100,11 @@
exit $ERRORS{'UNKNOWN'};
}
-sub check_dir($$$){
+sub check_dir($$$$){
my $dir = shift;
my $secwarn = shift;
my $seccrit = shift;
+ my $ignores_ref = shift;
my %res;
my $count=0;
my $futurecount=0;
@@ -111,26 +114,30 @@
$res{'errorstr'}="";
if (opendir(DIR,"$dir")){
print "Working in $dir\n" if ($DEBUG);
- for (readdir(DIR)) {
+ for my $file (readdir(DIR)) {
# if ($recursive){
-# &check_dir("$dir/$_",$secwarn,$seccrit) if (-d
"$dir/$_");
+# &check_dir("$dir/$file",$secwarn,$seccrit) if (-d
"$dir/$file");
# }
$count++;
- next if (! -f "$dir/$_");
- my $mtime=stat("$dir/$_")->mtime;
+ next if (! -f "$dir/$file");
+ if (grep(/\Q$dir\/$file\E/, @$ignores_ref)){
+ print "$dir/$file is in ignores\n" if ($DEBUG);
+ next;
+ }
+ my $mtime=stat("$dir/$file")->mtime;
my $age = time() - $mtime;
my $time=strftime("%a %b %e %H:%M:%S %Y",localtime($mtime));
- print "$_ : $mtime : $age sec\n" if ($DEBUG);
+ print "$dir/$file : $mtime : $age sec\n" if ($DEBUG);
if ( $age < 0 ){
- $res{'errorstr'}.="$dir/$_ was modified in the
future!\n";
+ $res{'errorstr'}.="$dir/$file was modified in the
future!\n";
$res{'level'}=$ERRORS{'CRITICAL'};
$futurecount++;
} elsif ( $age >= $seccrit ){
- $res{'errorstr'}.="$dir/$_ was last modified on
$time\n";
+ $res{'errorstr'}.="$dir/$file was last modified on
$time\n";
$res{'level'}=$ERRORS{'CRITICAL'};
$oldcount++;
} elsif ( $age >= $secwarn ){
- $res{'errorstr'}.="$dir/$_ was last modified on
$time\n";
+ $res{'errorstr'}.="$dir/$file was last modified on
$time\n";
$res{'level'}=$ERRORS{'WARNING'} if ($res{'level'} <
$ERRORS{'WARNING'});
$warncount++;
}
@@ -149,6 +156,8 @@
Getopt::Long::Configure('bundling');
if(!GetOptions( 'w|warning=i' => \$time_warn,
'c|critical=i' => \$time_crit,
+ 'd|debug' => \$DEBUG,
+ 'i|ignore=s' => \@ignores,
'p|pathname=s' => \@pathnames,
'r|recursive' => \$recursive,
't|timeout=i' => \$TIMEOUT,
@@ -168,12 +177,13 @@
print_error("critical ($time_crit) must be greater than warning ($time_warn)")
if ($time_crit <= $time_warn);
print_error("Please provide at least one pathname") if
(!defined($pathnames[0]) || ( $pathnames[0] eq "" ));
@pathnames=split(/,/,join(',',@pathnames));
+@ignores=split(/,/,join(',',@ignores));
our $secwarn = $time_warn * 60;
our $seccrit = $time_crit * 60;
-print STDERR "TIMEOUT: $TIMEOUT\nWARN: $time_warn\nCRIT:
$time_crit\nPATHNAMES: ".join(" ",@pathnames)."\n" if ($DEBUG);
+print STDERR "TIMEOUT: $TIMEOUT\nWARN: $time_warn\nCRIT:
$time_crit\nPATHNAMES: ".join(" ",@pathnames)."\nIGNORES: ".join("
",@ignores)."\n" if ($DEBUG);
foreach my $path (@pathnames){
- $status{"$path"}=check_dir("$path",$secwarn, $seccrit);
+ $status{"$path"}=check_dir("$path",$secwarn, $seccrit, \@ignores);
}
our $exitcode=0;