From owner-svn-ports-all@freebsd.org Thu Feb 21 22:30:47 2019 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F28614F3DB5; Thu, 21 Feb 2019 22:30:47 +0000 (UTC) (envelope-from pierre@guinoiseau.nz) Received: from mail-01.yggdrasil.nz (asgard.yggdrasil.nz [136.243.154.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C82F76A870; Thu, 21 Feb 2019 22:30:45 +0000 (UTC) (envelope-from pierre@guinoiseau.nz) Received: from [10.22.50.32] (unknown [203.83.196.110]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail-01.yggdrasil.nz (Postfix) with ESMTPSA id 72C0DEC2B; Fri, 22 Feb 2019 11:30:40 +1300 (NZDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=guinoiseau.nz; s=mail; t=1550788242; bh=h+DgxWzhzheexcOQsQX1vGcBmuSZK/6M+UGWUQAssck=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=GyiuSJR1B5SGEeeHnure4mxcOpKZ7kMsaXD2/fEXBnzKW/NVSx43ho27/EJM4lzCD FEEGdGNxyVVjqMJWZhGvX1L7mWlJdOziJBCPvoW6AWbgl/OzvKk59XTNahTD3wruJJ 4ScAfzIBvd/tdN6gZkcHNSeam/K9NYE+YZzYr6bk= Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: Re: svn commit: r493266 - in head/net-mgmt/nagios-check_smartmon: . files From: Pierre Guinoiseau In-Reply-To: Date: Fri, 22 Feb 2019 11:30:36 +1300 Cc: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201902181508.x1IF8lhS049907@repo.freebsd.org> <7563B519-9277-4AEC-A1C1-FED1B469C3D7@guinoiseau.nz> To: Dan Langille X-Mailer: Apple Mail (2.3445.102.3) X-Rspamd-Queue-Id: C82F76A870 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.97 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 22:30:47 -0000 Same thing: $ sudo python2.7 /usr/local/libexec/nagios/check_smartmon -w 45 -c 60 -d = /dev/da0 Traceback (most recent call last): File "/usr/local/libexec/nagios/check_smartmon", line 309, in (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 Note that this is on a virtual machine where there is no actual SMART = data available, smartctl returns only this: =3D=3D=3D START OF READ SMART DATA SECTION =3D=3D=3D Current Drive Temperature: 0 C Drive Trip Temperature: 0 C While it doesn=E2=80=99t make much sense to have this check in the case = of a virtual machine (and I should probably disable it), it didn=E2=80=99t= error out before and was returning "OK: device is functional and stable = (temperature: 0)=E2=80=9D. > On 22/02/2019, at 10:53, Dan Langille wrote: >=20 >> On Feb 21, 2019, at 4:33 PM, Pierre Guinoiseau = 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 = >> (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 > Sorry. >=20 > When you invoke this from the command line, can you paste the command = and the output please? >=20 >>=20 >> Cheers, >> Pierre >>=20 >>> On 19/02/2019, at 04:08, Dan Langille wrote: >>>=20 >>> Author: dvl >>> Date: Mon Feb 18 15:08:46 2019 >>> New Revision: 493266 >>> URL: 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/ >>> 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 >>=20 >=20 =E2=80=94 Pierre Guinoiseau