Date: Fri, 8 Mar 2019 13:42:29 -0500 From: Dan Langille <dvl@FreeBSD.org> To: Pierre Guinoiseau <pierre@guinoiseau.nz> Cc: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: Re: svn commit: r493266 - in head/net-mgmt/nagios-check_smartmon: . files Message-ID: <758AABED-4D5F-421C-9EB4-C5AFE8E1197D@FreeBSD.org> In-Reply-To: <98AC5D57-E207-47EE-A06E-560CB3724C13@FreeBSD.org> References: <201902181508.x1IF8lhS049907@repo.freebsd.org> <7563B519-9277-4AEC-A1C1-FED1B469C3D7@guinoiseau.nz> <98AC5D57-E207-47EE-A06E-560CB3724C13@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Pierre, Will you have some time to test this patch and verify it is good for = you? I've been running it on a few servers. --=20 Dan Langille - BSDCan / PGCon dan@langille.org > On Mar 4, 2019, at 3:12 PM, Dan Langille <dvl@freebsd.org> wrote: >=20 > Hello, >=20 > I was searching for this a few days ago. =20 >=20 > Please see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D236227 = <https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D236227> >=20 > --=20 > Dan Langille - BSDCan / PGCon > dan@langille.org <mailto:dan@langille.org> >=20 >=20 >> On Feb 21, 2019, at 4:33 PM, Pierre Guinoiseau <pierre@guinoiseau.nz = <mailto:pierre@guinoiseau.nz>> wrote: >>=20 >> Hi, >>=20 >> I=E2=80=99m getting this error now after this change: >>=20 >> Info: Traceback (most recent call last): >> File "/usr/local/libexec/nagios/check_smartmon", line 309, in = <module> >> (healthStatus, temperature) =3D parseOutput(healthStatusOutput, = temperatureOutput, devtype) >> File "/usr/local/libexec/nagios/check_smartmon", line 220, in = parseOutput >> vprint(3, "Temperature: %d" %temperature) >> UnboundLocalError: local variable 'temperature' referenced before = assignment >>=20 >> Cheers, >> Pierre >>=20 >>> On 19/02/2019, at 04:08, Dan Langille <dvl@FreeBSD.org = <mailto:dvl@FreeBSD.org>> wrote: >>>=20 >>> Author: dvl >>> Date: Mon Feb 18 15:08:46 2019 >>> New Revision: 493266 >>> URL: https://svnweb.freebsd.org/changeset/ports/493266 = <https://svnweb.freebsd.org/changeset/ports/493266> >>>=20 >>> Log: >>> Patch check_smartmon to cater for changed smartctl output >>>=20 >>> We previously patched the code to look for: >>>=20 >>> SMART STATUS RETURN: incomplete response, ATA output registers = missing >>>=20 >>> That line is now: >>>=20 >>> SMART Status not supported: Incomplete response, ATA output = registers missing >>>=20 >>> It also seems like the temperature has moved from part 190 to 194. >>>=20 >>> PR: 235475 >>> Approved by: Krzysztof (maintainer) >>> MFH: 2019Q1 >>>=20 >>> Modified: >>> head/net-mgmt/nagios-check_smartmon/Makefile >>> head/net-mgmt/nagios-check_smartmon/files/patch-check_smartmon >>>=20 >>> Modified: head/net-mgmt/nagios-check_smartmon/Makefile >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/net-mgmt/nagios-check_smartmon/Makefile Mon Feb 18 = 15:01:50 2019 (r493265) >>> +++ head/net-mgmt/nagios-check_smartmon/Makefile Mon Feb 18 = 15:08:46 2019 (r493266) >>> @@ -3,7 +3,7 @@ >>>=20 >>> PORTNAME=3D check_smartmon >>> PORTVERSION=3D 20100318 >>> -PORTREVISION=3D 2 >>> +PORTREVISION=3D 3 >>> CATEGORIES=3D net-mgmt >>> MASTER_SITES=3D = http://ftp.bsdserwis.com/pub/FreeBSD/ports/distfiles/ = <http://ftp.bsdserwis.com/pub/FreeBSD/ports/distfiles/> >>> PKGNAMEPREFIX=3D nagios- >>>=20 >>> Modified: = head/net-mgmt/nagios-check_smartmon/files/patch-check_smartmon >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/net-mgmt/nagios-check_smartmon/files/patch-check_smartmon = Mon Feb 18 15:01:50 2019 (r493265) >>> +++ head/net-mgmt/nagios-check_smartmon/files/patch-check_smartmon = Mon Feb 18 15:08:46 2019 (r493266) >>> @@ -1,26 +1,42 @@ >>> ---- check_smartmon.orig 2015-07-22 17:32:58 UTC >>> -+++ check_smartmon >>> -@@ -59,7 +59,7 @@ def parseCmdLine(args): >>> - metavar=3D"LEVEL", help=3D"set verbosity = level to LEVEL; defaults to 0 (quiet), \ >>> - possible values go up to = 3") >>> - parser.add_option("-t", "--type", action=3D"store", = dest=3D"devtype", default=3D"ata", metavar=3D"DEVTYPE", >>> -- help=3D"type of device (ATA|SCSI)") >>> -+ help=3D"type of device (ata|scsi)") >>> - parser.add_option("-w", "--warning-threshold", = metavar=3D"TEMP", action=3D"store", >>> - type=3D"int", dest=3D"warningThreshold", = default=3D55, >>> - help=3D"set temperature warning threshold = to given temperature (defaults to 55)") >>> -@@ -291,10 +291,10 @@ if __name__ =3D=3D "__main__": >>> +--- check_smartmon.orig 2019-02-01 04:28:13.000000000 +0000 >>> ++++ check_smartmon 2019-02-04 22:27:35.297345000 +0000 >>> +@@ -161,9 +161,12 @@=20 >>> + lines =3D healthMessage.split("\n") >>> + getNext =3D 0 >>> + for line in lines: >>> ++ vprint(3, "parseOutput: line is: '%s'" % = line) >>> + if getNext: >>> +- statusLine =3D line >>> +- break >>> ++ if line <> "SMART STATUS RETURN: = incomplete response, ATA output registers missing" and \ >>> ++ line <> "SMART Status not = supported: Incomplete response, ATA output registers missing" : >>> ++ statusLine =3D line >>> ++ break >>> + elif line =3D=3D "=3D=3D=3D START OF READ = SMART DATA SECTION =3D=3D=3D": >>> + getNext =3D 1 >>> + # fi >>> +@@ -181,7 +184,7 @@=20 >>> + parts =3D line.split() >>> + if len(parts): >>> + # 194 is the temperature value id >>> +- if parts[0] =3D=3D "194": >>> ++ if parts[0] =3D=3D "194" or = parts[0] =3D=3D "190": >>> + temperature =3D = int(parts[9]) >>> + break >>> + # fi >>> +@@ -225,6 +228,7 @@=20 >>> +=20 >>> + # this is absolutely critical! >>> + if healthStatus not in [ "PASSED", "OK" ]: >>> ++ vprint(2, "Health status: %s" % healthStatus) >>> + return (2, "CRITICAL: device does not pass health = status") >>> + # fi >>> +=20 >>> +@@ -287,6 +291,7 @@=20 >>> + # check device type, ATA is default >>> vprint(2, "Get device type") >>> devtype =3D options.devtype >>> ++ vprint(2, "command line supplied device type is: %s" % = devtype) >>> if not devtype: >>> -- devtype =3D "ATA" >>> -- >>> -- if device_re.search( device ): >>> -- devtype =3D "scsi" >>> -+ if device_re.search( device ): >>> -+ devtype =3D "scsi" >>> -+ else: >>> -+ devtype =3D "ata" >>> -=20 >>> - vprint(1, "Device type: %s" % devtype) >>> -=20 >>> + if device_re.search( device ): >>> + devtype =3D "scsi" >>> _______________________________________________ >>> svn-ports-all@freebsd.org mailing list >>> https://lists.freebsd.org/mailman/listinfo/svn-ports-all >>> To unsubscribe, send any mail to = "svn-ports-all-unsubscribe@freebsd.org" >>=20 >> =E2=80=94 >> Pierre Guinoiseau <pierre@guinoiseau.nz = <mailto:pierre@guinoiseau.nz>> >>=20 >=20
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?758AABED-4D5F-421C-9EB4-C5AFE8E1197D>