forked from pool/monitoring-plugins-rsync
Accepting request 1039359 from home:oertel:branches:server:monitoring
- add patch monitoring-plugins-rsync-option_binary.patch allow to specify path to rsync via option -b or -binary to be able to use the /usr/bin/rsync-ssl wrapper (leave PATH variable alone to not break the wrapper) OBS-URL: https://build.opensuse.org/request/show/1039359 OBS-URL: https://build.opensuse.org/package/show/server:monitoring/monitoring-plugins-rsync?expand=0&rev=5
This commit is contained in:
parent
34c3711dbe
commit
5ead10251d
66
monitoring-plugins-rsync-option_binary.patch
Normal file
66
monitoring-plugins-rsync-option_binary.patch
Normal file
@ -0,0 +1,66 @@
|
||||
--- ./check_rsync 2022/12/01 15:42:58 1.1
|
||||
+++ ./check_rsync 2022/12/01 15:51:40
|
||||
@@ -24,7 +24,7 @@
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
|
||||
-use vars qw($opt_H $opt_p $opt_m);
|
||||
+use vars qw($opt_H $opt_p $opt_b $opt_m);
|
||||
use vars qw($PROGNAME %RSYNCMSG $cpid);
|
||||
use lib "/usr/local/nagios/libexec";
|
||||
use utils qw($TIMEOUT %ERRORS);
|
||||
@@ -30,7 +30,7 @@
|
||||
use utils qw($TIMEOUT %ERRORS);
|
||||
|
||||
$PROGNAME = "check_rsync";
|
||||
-$ENV{'PATH'}='';
|
||||
+# $ENV{'PATH'}='';
|
||||
$ENV{'BASH_ENV'}='';
|
||||
$ENV{'ENV'}='';
|
||||
%RSYNCMSG = (
|
||||
@@ -60,15 +60,17 @@
|
||||
GetOptions (
|
||||
"H=s" => \$opt_H, "hostname=s" => \$opt_H,
|
||||
"p=s" => \$opt_p, "port=s" => \$opt_p,
|
||||
- "m=s@" => \$opt_m, "module=s@" => \$opt_m );
|
||||
+ "b=s" => \$opt_b, "binary=s" => \$opt_b,
|
||||
+ "m=s@" => \$opt_m, "module=s@" => \$opt_m);
|
||||
|
||||
unless (defined($opt_H)){
|
||||
- print "Usage: $PROGNAME -H <host> [-p <port>] [-m <module>[,<user>,<password>] [-m <module>[,<user>,<password>]...]]\n";
|
||||
+ print "Usage: $PROGNAME -H <host> [-p <port>] [ -b <path_to_rsync> ] [-m <module>[,<user>,<password>] [-m <module>[,<user>,<password>]...]]\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
my $host = $opt_H;
|
||||
my $port = defined($opt_p) ? $opt_p : 873;
|
||||
+my $binary = defined($opt_b) ? $opt_b : '/usr/bin/rsync';
|
||||
my $verbose = 0; # Not implemented as argument yet
|
||||
|
||||
# Create an array for each -m arguments and store them in @modules
|
||||
@@ -100,8 +102,15 @@
|
||||
|
||||
alarm($TIMEOUT);
|
||||
|
||||
+my $option_cont = "--contimeout=$TIMEOUT";
|
||||
+my $option_port = "--port=$port";
|
||||
+if ($binary =~ /rsync-ssl/) {
|
||||
+ $option_cont = '';
|
||||
+ $option_port = '' if $port eq 873;
|
||||
+}
|
||||
+
|
||||
# Get a list of modules to see if rsync is up
|
||||
-my $command = "/usr/bin/rsync --timeout=$TIMEOUT --contimeout=$TIMEOUT --port=$port $source";
|
||||
+my $command = "$binary --timeout=$TIMEOUT $option_cont $option_port $source";
|
||||
|
||||
# Workaround to kill stale rsync processes
|
||||
$cpid = open(RSYNC, "$command|") or report_error("Unable to execute rsync: $!");
|
||||
@@ -142,7 +151,7 @@
|
||||
undef $error_code;
|
||||
undef $result;
|
||||
# Get a file listing of the root of the module
|
||||
- $command = "/usr/bin/rsync --port=$port $source";
|
||||
+ $command = "$binary $option_port $source";
|
||||
|
||||
# Workaround to kill stale rsync processes
|
||||
$cpid = open(RSYNC, "$command|") or report_error("Unable to execute rsync: $!");
|
@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Dec 1 17:28:14 CET 2022 - ro@suse.de
|
||||
|
||||
- add patch monitoring-plugins-rsync-option_binary.patch
|
||||
allow to specify path to rsync via option -b or -binary
|
||||
to be able to use the /usr/bin/rsync-ssl wrapper
|
||||
(leave PATH variable alone to not break the wrapper)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jul 30 10:16:18 UTC 2014 - lars@linux-schulserver.de
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package monitoring-plugins-rsync
|
||||
#
|
||||
# Copyright (c) 2012-2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2022 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -12,25 +12,26 @@
|
||||
# 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-rsync
|
||||
Summary: Check rsync servers availability
|
||||
License: GPL-2.0+
|
||||
License: GPL-2.0-or-later
|
||||
Group: System/Monitoring
|
||||
Version: 1.02
|
||||
Release: 0
|
||||
Url: https://www.monitoringexchange.org/inventory/Check-Plugins/Network/check_rsync
|
||||
URL: https://www.monitoringexchange.org/inventory/Check-Plugins/Network/check_rsync
|
||||
Source0: check_rsync
|
||||
Source1: COPYING
|
||||
Patch1: monitoring-plugins-rsync-timeout.patch
|
||||
Patch2: monitoring-plugins-rsync-hidden_modules.patch
|
||||
Patch3: monitoring-plugins-rsync-option_binary.patch
|
||||
BuildRequires: nagios-rpm-macros
|
||||
%if 0%{?suse_version} > 1010
|
||||
# nagios can execute the script with embedded perl
|
||||
Recommends: perl
|
||||
Recommends: perl
|
||||
%endif
|
||||
Requires: rsync
|
||||
Requires: perl(Getopt::Long)
|
||||
@ -53,6 +54,7 @@ list modules on the Rsync server.
|
||||
install -m644 %{SOURCE0} .
|
||||
%patch1 -p0
|
||||
%patch2 -p0
|
||||
%patch3 -p0
|
||||
|
||||
%build
|
||||
|
||||
@ -64,7 +66,7 @@ chmod +x %buildroot/%{nagios_plugindir}/check_rsync
|
||||
%clean
|
||||
rm -rf %buildroot
|
||||
|
||||
%files
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
# avoid build dependecy of nagios - own the dirs
|
||||
%dir %{nagios_libdir}
|
||||
|
Loading…
Reference in New Issue
Block a user