Bug 162975

Summary: net-mgmt/nagios-check_smartmon causes error when run
Product: Ports & Packages Reporter: tom
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description tom 2011-11-30 19:40:11 UTC
	The check script provided by net-mgmt/nagios-check_smartmon produces an error when run. I just installed this port today, along with sysutils/smartmontools.

	I receive the following output when run against a SATA disk in a USB enclosure:

-> /usr/local/libexec/nagios/check_smartmon -d /dev/da0 -v 3
Get device name
Device: /dev/da0
Check device
Check if /dev/da0 does exist and can be read
Check if /usr/local/sbin/smartctl does exist and can be read
Path to smartctl: /usr/local/sbin/smartctl
Get device type
Device type: scsi
Call smartctl
Get device health status: /usr/local/sbin/smartctl -H /dev/da0
Get device temperature: /usr/local/sbin/smartctl -A /dev/da0
Parse smartctl output
parseOutput: Device type is scsi
Traceback (most recent call last):
  File "/usr/local/libexec/nagios/check_smartmon", line 307, in <module>
    (healthStatus, temperature) = parseOutput(healthStatusOutput, temperatureOutput, devtype)
  File "/usr/local/libexec/nagios/check_smartmon", line 216, in parseOutput
    vprint(3, "Health status: %s" % healthStatus)
UnboundLocalError: local variable 'healthStatus' referenced before assignment

Fix: 

Nagios Exchange has an updated version of this script that appears to work fine.

http://exchange.nagios.org/directory/Plugins/Uncategorized/Operating-Systems/Linux/check_smartmon/details
How-To-Repeat: 
Repeatable when run in the manner described in the description. My relevant port versions are as follows:

python27-2.7.2_3
nagios-check_smartmon-20100318_1
smartmontools-5.42_1
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2011-11-30 19:40:20 UTC
Maintainer of net-mgmt/nagios-check_smartmon,

Please note that PR ports/162975 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/162975

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2011-11-30 19:40:22 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 3 Krzysztof 2011-12-01 14:54:50 UTC
Hello,

On Wed, Nov 30, 2011 at 07:40:20PM +0000, Edwin Groothuis wrote:
> Maintainer of net-mgmt/nagios-check_smartmon,
> 
> Please note that PR ports/162975 has just been submitted.
> 
> If it contains a patch for an upgrade, an enhancement or a bug fix
> you agree on, reply to this email stating that you approve the patch
> and a committer will take care of it.
> 
> The full text of the PR can be found at:
>     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/162975
> 
I'm not able to repeat this error. I have some RELENG_7 and RELENG_8
servers with SATA drives, python27 and this script works correctly.

Today I will try run this script on USB pendrive. I think that's the
problem.

Greetings,
-- 
Krzysztof Stryjek
UNIX administrator/Juniper Networks Specialist
email: wtp (at) bsdserwis (dot) com
http://www.linkedin.com/in/KrzysztofStryjek
GPG fingerprint: 8BD7 40CE 8994 0BBE CE6C  91CD 1292 8959 DC61 0E76

In theory, there is no difference between theory and practice.
In practice, there is.
Comment 4 Krzysztof 2011-12-12 08:23:23 UTC
Hello,

On Wed, Nov 30, 2011 at 07:40:20PM +0000, Edwin Groothuis wrote:
> Maintainer of net-mgmt/nagios-check_smartmon,
> 
> Please note that PR ports/162975 has just been submitted.
> 
> If it contains a patch for an upgrade, an enhancement or a bug fix
> you agree on, reply to this email stating that you approve the patch
> and a committer will take care of it.
> 
> The full text of the PR can be found at:
>     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/162975
> 
I've checked this issue. Problem is when you "call" smartctl on device
like USB stick. smrtctl return "Device is busy" and nagios plugin
returns "Traceback (most recent call last)".

I suggest to close this PR, because script is not use correctly :) I
think that adding patches to prevent these errors will make script
unreadable.

Greetings,
-- 
Krzysztof Stryjek
UNIX administrator/Juniper Networks Specialist
Comment 5 Eitan Adler freebsd_committer freebsd_triage 2011-12-25 17:07:08 UTC
State Changed
From-To: feedback->closed

closed per maintainer