Accepting request 1240516 from server:monitoring

- Fix version number, we don't want to downgrade this package.

- Conversion to _service pulled source from upstream
- Add no-python2.patch to make script python3 compatible (forwarded request 1240508 from mcepl)

OBS-URL: https://build.opensuse.org/request/show/1240516
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/monitoring-plugins-sar-perf?expand=0&rev=15
This commit is contained in:
Ana Guerrero 2025-01-27 19:56:21 +00:00 committed by Git OBS Bridge
commit 06db1f855b
10 changed files with 109 additions and 22 deletions

15
_service Normal file
View File

@ -0,0 +1,15 @@
<services>
<service name="obs_scm" mode="manual">
<param name="scm">git</param>
<param name="url">https://github.com/nickanderson/check-sar-perf.git</param>
<param name="versionprefix">0.1+git</param>
<param name="changesgenerate">enable</param>
<param name="changesauthor">mcepl@cepl.eu</param>
</service>
<service name="tar" mode="buildtime"/>
<service name="recompress" mode="buildtime">
<param name="file">*.tar</param>
<param name="compression">xz</param>
</service>
<service name="set_version" mode="manual"/>
</services>

4
_servicedata Normal file
View File

@ -0,0 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/nickanderson/check-sar-perf.git</param>
<param name="changesrevision">4878d0cc66e928bd10757a0b234730e03310871e</param></service></servicedata>

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2dd4f9e9bcb1f4f48993fbf3ba664495fc94abee13d1bf2eb928ac7b03259376
size 8202

4
check-sar-perf.obsinfo Normal file
View File

@ -0,0 +1,4 @@
name: check-sar-perf
version: 0.1+git.1272298931.4878d0c
mtime: 1272298931
commit: 4878d0cc66e928bd10757a0b234730e03310871e

View File

@ -1,14 +1,28 @@
Index: check_sar_perf.py
===================================================================
--- check_sar_perf.py.orig
+++ check_sar_perf.py
@@ -99,7 +99,8 @@ class SarNRPE:
---
check_sar_perf.py | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
--- a/check_sar_perf.py
+++ b/check_sar_perf.py
@@ -99,13 +99,14 @@ class SarNRPE:
# Create dictionary
for i in range(len(columns)):
# Remove first column if data contains only letters
- if i != 0 or not search.match(data[i]):
- # Remove characters that cause issues (%/)
- badchars=['%','/']
- columns[i] = ''.join(j for j in columns[i] if j not in badchars)
- string = "%s=%s" %(columns[i].strip('%/'), data[i].strip())
- self.stats.append(string)
- #print "Appended data: ", data[i]
+ #if i != 0 or not search.match(data[i]):
+ if (i != 0 or not search.match(data[i])) and (columns[i] != "DEV"):
# Remove characters that cause issues (%/)
badchars=['%','/']
columns[i] = ''.join(j for j in columns[i] if j not in badchars)
+ if (i != 0 or not search.match(data[i])) and (columns[i] != "DEV"):
+ # Remove characters that cause issues (%/)
+ badchars=['%','/']
+ columns[i] = ''.join(j for j in columns[i] if j not in badchars)
+ string = "%s=%s" %(columns[i].strip('%/'), data[i].strip())
+ self.stats.append(string)
+ #print "Appended data: ", data[i]
def CheckBin(program):
'''Ensure the program exists in the PATH'''

View File

@ -1,19 +1,21 @@
Index: check_sar_perf.py
===================================================================
--- check_sar_perf.py.orig
+++ check_sar_perf.py
---
check_sar_perf.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- a/check_sar_perf.py
+++ b/check_sar_perf.py
@@ -153,11 +153,12 @@ def Main(args):
else:
sar = SarNRPE(myOpts[args[1]])
else:
- print 'ERROR: option not defined'
+ print 'ERROR: option ',args[1],' not defined'
+ print('ERROR: option ',args[1],' not defined')
sys.exit(ERR_UNKN)
# Output in NRPE format
- print 'sar OK|', ' '.join(sar.stats)
+ args[0]=''
+ print 'sar OK: ',' '.join(args),'|', ' '.join(sar.stats)
+ print('sar OK: ',' '.join(args),'|', ' '.join(sar.stats))
if __name__ == '__main__':
Main(sys.argv)

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Mon Jan 27 09:28:18 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
- Fix version number, we don't want to downgrade this package.
-------------------------------------------------------------------
Fri Jan 24 09:58:04 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
- Conversion to _service pulled source from upstream
- Add no-python2.patch to make script python3 compatible
-------------------------------------------------------------------
Wed Jul 24 12:24:59 CEST 2024 - ro@suse.de

View File

@ -1,7 +1,7 @@
#
# spec file for package monitoring-plugins-sar-perf
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -20,14 +20,17 @@ Name: monitoring-plugins-sar-perf
Summary: Get performance data from sar
License: BSD-2-Clause
Group: System/Monitoring
Version: 0.1
Version: 0.1+git.1272298931.4878d0c
Release: 0
URL: https://github.com/nickanderson/check-sar-perf
Source0: nickanderson-check-sar-perf-4878d0c.tar.gz
Source0: check-sar-perf-%{version}.tar.xz
Source1: check_iostat
Source2: usr.lib.nagios.plugins.check_iostat
Patch0: monitoring-plugins-sar-perf-output.patch
Patch1: monitoring-plugins-sar-perf-stdout.patch
# PATCH-FIX-UPSTREAM no-python2.patch gh#nickanderson/check-sar-perf!3 mcepl@suse.com
# make the script Python 3 compatible
Patch2: no-python2.patch
BuildRequires: nagios-rpm-macros
%if 0%{?suse_version}
Recommends: apparmor-profiles
@ -54,7 +57,7 @@ sar OK| DEV=sda tps=0.00 rd_sec/s=0.00 wr_sec/s=0.00 avgrq-sz=0.00
avgqu-sz=0.00 await=0.00 svctm=0.00 util=0.00
%prep
%autosetup -p0 -n nickanderson-check-sar-perf-4878d0c
%autosetup -p1 -n check-sar-perf-%{version}
%build

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4c76642e2dfc208fe0e699f6fdc55231d9839f2bfd55cb6371c63cf5ad8be5ed
size 3308

34
no-python2.patch Normal file
View File

@ -0,0 +1,34 @@
---
check_sar_perf.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/check_sar_perf.py
+++ b/check_sar_perf.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Copyright (c) 2010, Nick Anderson <nick@cmdln.org>
# All rights reserved.
@@ -121,10 +121,10 @@ def CheckBin(program):
def Main(args):
# Ensure a profile (aka myOpts) is selected
if not len(args) > 1:
- print 'ERROR: no profile selected'
+ print('ERROR: no profile selected')
sys.exit(ERR_UNKN)
if not CheckBin('sar'):
- print 'ERROR: sar not found on PATH (%s), install sysstat' %os.environ['PATH']
+ print('ERROR: sar not found on PATH (%s), install sysstat' %os.environ['PATH'])
sys.exit(ERR_CRIT)
# Profiles may need to be modified for different versions of the sysstat package
@@ -148,7 +148,7 @@ def Main(args):
if len(args) > 2:
sar = SarNRPE(myOpts[args[1]],args[2])
else:
- print 'ERROR: no device specified'
+ print('ERROR: no device specified')
sys.exit(ERR_UNKN)
else:
sar = SarNRPE(myOpts[args[1]])