summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xnagios-checks/nagios-check-libs5
-rwxr-xr-xnagios-checks/nagios-check-rdiff-backup12
2 files changed, 11 insertions, 6 deletions
diff --git a/nagios-checks/nagios-check-libs b/nagios-checks/nagios-check-libs
index 89d7f3a..77b3780 100755
--- a/nagios-checks/nagios-check-libs
+++ b/nagios-checks/nagios-check-libs
@@ -53,6 +53,7 @@ if (!GetOptions (
'--version' => \$params->{'version'},
'--quiet' => \$params->{'quiet'},
'--verbose' => \$params->{'verbose'},
+ '-v' => \$params->{'verbose'},
'--config=s' => \$params->{'config'},
)) {
dief ("$PROGRAM_NAME: Usage: $PROGRAM_NAME [--help|--version] [--verbose] [--quiet] [--config=<CONFIGFILE>]\n");
@@ -170,6 +171,10 @@ LINE: for my $line (@lsof) {
my $inode = $fields{i};
my $path = $fields{n};
if ($path =~ m/\.dpkg-/ || $path =~ m/\(deleted\)/ || $path =~ /path inode=/ || $path =~ m#/\.nfs# || $fd eq 'DEL') {
+ my $deleted_in_path = ($path =~ m/\(deleted\)/ || $path =~ m/\.nfs/);
+ next if ($deleted_in_path && $fd =~ /^[0-9]*$/); # Ignore deleted files that are open via normal file handles.
+ next if ($deleted_in_path && $fd eq 'cwd'); # Ignore deleted directories that we happen to be in.
+
$path =~ s/^\(deleted\)//; # in some cases "(deleted)" is at the beginning of the string
for my $i (@{$config->{'ignorelist'}}) {
my $ignore = eval($i);
diff --git a/nagios-checks/nagios-check-rdiff-backup b/nagios-checks/nagios-check-rdiff-backup
index 1f8b30b..03dc782 100755
--- a/nagios-checks/nagios-check-rdiff-backup
+++ b/nagios-checks/nagios-check-rdiff-backup
@@ -1,6 +1,6 @@
-#!/usr/bin/python
+#!/usr/bin/python3
-# Copyright 2010, 2011 Peter Palfrader
+# Copyright 2010, 2011, 2021 Peter Palfrader
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -53,7 +53,7 @@ def code_to_prefix(code):
elif code == 2: return 'CRITICAL: '
elif code == 1: return 'WARNING: '
elif code == 0: return 'OK: '
- else: raise ValueError
+ else: raise ValueError("Unknown code %s"%(str(code),))
def convert_time(s, default_unit='h'):
m = re.match('([0-9]+)([smhdw])?$', s)
@@ -143,12 +143,12 @@ def record(code, base, msg):
backup_per_code[code].append(base)
report = []
-keys = backup_per_code.keys()
+keys = list(backup_per_code.keys())
keys.sort(reverse=True)
for code in keys:
prefix = code_to_prefix(code)
report.append( prefix + ', '.join(backup_per_code[code]) )
if not options.quiet:
- print '; '.join(report)
- for l in log: print l
+ print('; '.join(report))
+ for l in log: print(l)
sys.exit(exitcode)