git: c45c42db6b0e - main - net-mgmt/check_nwc_health: Patch to adjust snmp timeout and retries

From: Craig Leres <leres_at_FreeBSD.org>
Date: Sat, 20 Aug 2022 00:23:40 UTC
The branch main has been updated by leres:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c45c42db6b0e42c14360830ea6cdd96231bbdf05

commit c45c42db6b0e42c14360830ea6cdd96231bbdf05
Author:     Craig Leres <leres@FreeBSD.org>
AuthorDate: 2022-08-20 00:23:05 +0000
Commit:     Craig Leres <leres@FreeBSD.org>
CommitDate: 2022-08-20 00:23:05 +0000

    net-mgmt/check_nwc_health: Patch to adjust snmp timeout and retries
    
    .. as described in this github issue:
    
        https://github.com/lausser/check_nwc_health/issues/221
    
    Minor portlint while we're here.
    
    Reported by:    Case Larsen
---
 net-mgmt/check_nwc_health/Makefile                       |  9 +++++----
 .../files/patch-GLPlugin_lib_Monitoring_GLPlugin_SNMP.pm | 16 ++++++++++++++++
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/net-mgmt/check_nwc_health/Makefile b/net-mgmt/check_nwc_health/Makefile
index 19ff04a347a2..f63fd47ac685 100644
--- a/net-mgmt/check_nwc_health/Makefile
+++ b/net-mgmt/check_nwc_health/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	check_nwc_health
 PORTVERSION=	10.3
+PORTREVISION=	1
 CATEGORIES=	net-mgmt
 MASTER_SITES=	https://labs.consol.de/assets/downloads/nagios/
 
@@ -9,6 +10,10 @@ COMMENT=	Nagios plugin to monitor network equipment via SNMP
 LICENSE=	GPLv2
 LICENSE_FILE=	${WRKSRC}/COPYING
 
+RUN_DEPENDS=	p5-File-Slurp>=0:devel/p5-File-Slurp \
+		p5-JSON-XS>=4.0:converters/p5-JSON-XS \
+		p5-JSON>=4.0:converters/p5-JSON
+
 USES=	perl5
 
 GNU_CONFIGURE=	yes
@@ -22,10 +27,6 @@ NAGIOSGROUP?=	nagios
 USERS=		${NAGIOSUSER}
 GROUPS=		${NAGIOSGROUP}
 
-RUN_DEPENDS=	p5-File-Slurp>=0:devel/p5-File-Slurp \
-		p5-JSON-XS>=4.0:converters/p5-JSON-XS \
-		p5-JSON>=4.0:converters/p5-JSON
-
 PLIST_FILES=	libexec/check_nwc_health
 
 post-patch:
diff --git a/net-mgmt/check_nwc_health/files/patch-GLPlugin_lib_Monitoring_GLPlugin_SNMP.pm b/net-mgmt/check_nwc_health/files/patch-GLPlugin_lib_Monitoring_GLPlugin_SNMP.pm
new file mode 100644
index 000000000000..d2fafb3e7dd1
--- /dev/null
+++ b/net-mgmt/check_nwc_health/files/patch-GLPlugin_lib_Monitoring_GLPlugin_SNMP.pm
@@ -0,0 +1,16 @@
+--- GLPlugin/lib/Monitoring/GLPlugin/SNMP.pm.orig	2022-08-19 23:52:28 UTC
++++ GLPlugin/lib/Monitoring/GLPlugin/SNMP.pm
+@@ -1173,8 +1173,11 @@ sub establish_snmp_session {
+     # removing this at all may cause strange epn errors. As if only
+     # certain oids were returned as undef, others not.
+     # next try: 50
+-    $params{'-timeout'} = $self->opts->timeout() >= 60 ?
+-        50 : $self->opts->timeout() - 2;
++    ##$params{'-timeout'} = $self->opts->timeout() >= 60 ?
++    ##    50 : $self->opts->timeout() - 2;
++    # LBL: we don't use WLC, and if this is WLC specific, we should limit to just WLC
++    $params{'-timeout'} = 5;
++    $params{'-retries'} = 3;
+     my $stderrvar = "";
+     *SAVEERR = *STDERR;
+     open ERR ,'>',\$stderrvar;