FreeBSD Bugzilla – Attachment 228485 Details for
Bug 258965
net-mgmt/nagios-check_smartmon: fix temperature recognition for some devices
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch-check_smartmon2
patch-check_smartmon2 (text/plain), 3.53 KB, created by
Denis Shaposhnikov
on 2021-10-06 19:10:43 UTC
(
hide
)
Description:
patch-check_smartmon2
Filename:
MIME Type:
Creator:
Denis Shaposhnikov
Created:
2021-10-06 19:10:43 UTC
Size:
3.53 KB
patch
obsolete
>--- check_smartmon >+++ check_smartmon >@@ -59,7 +59,7 @@ def parseCmdLine(args): > metavar="LEVEL", help="set verbosity level to LEVEL; defaults to 0 (quiet), \ > possible values go up to 3") > parser.add_option("-t", "--type", action="store", dest="devtype", default="ata", metavar="DEVTYPE", >- help="type of device (ATA|SCSI)") >+ help="type of device (ata|scsi)") > parser.add_option("-w", "--warning-threshold", metavar="TEMP", action="store", > type="int", dest="warningThreshold", default=55, > help="set temperature warning threshold to given temperature (defaults to 55)") >@@ -231,22 +231,25 @@ def parseOutput(healthMessage, temperatureMessage, devType): > return (healthStatus, temperature) > # end > >-def createReturnInfo(healthStatus, temperature, warningThreshold, >+def createReturnInfo(device, healthStatus, temperature, warningThreshold, > criticalThreshold): > """Create return information according to given thresholds.""" > > # 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") >+ return (2, "CRITICAL: device (%s) does not pass health status" %device) > # fi > > if temperature > criticalThreshold: >- return (2, "CRITICAL: device temperature (%d) exceeds critical temperature threshold (%s)" % (temperature, criticalThreshold)) >+ return (2, "CRITICAL: device (%s) temperature (%d) exceeds critical temperature threshold (%s)|TEMP=%d;%d;%d;" >+ % (device, temperature, criticalThreshold, temperature, warningThreshold, criticalThreshold)) > elif temperature > warningThreshold: >- return (1, "WARNING: device temperature (%d) exceeds warning temperature threshold (%s)" % (temperature, warningThreshold)) >+ return (1, "WARNING: device (%s) temperature (%d) exceeds warning temperature threshold (%s)|TEMP=%d;%d;%d;" >+ % (device, temperature, warningThreshold, temperature, warningThreshold, criticalThreshold)) > else: >- return (0, "OK: device is functional and stable (temperature: %d)" % temperature) >+ return (0, "OK: device (%s) is functional and stable (temperature: %d)|TEMP=%d;%d;%d;" >+ % (device, temperature, temperature, warningThreshold, criticalThreshold)) > # fi > # end > >@@ -302,10 +305,10 @@ if __name__ == "__main__": > devtype = options.devtype > vprint(2, "command line supplied device type is: %s" % devtype) > if not devtype: >- devtype = "ATA" >- >- if device_re.search( device ): >- devtype = "scsi" >+ if device_re.search( device ): >+ devtype = "scsi" >+ else: >+ devtype= "ata" > > vprint(1, "Device type: %s" % devtype) > >@@ -317,7 +320,7 @@ if __name__ == "__main__": > vprint(2, "Parse smartctl output") > (healthStatus, temperature) = parseOutput(healthStatusOutput, temperatureOutput, devtype) > vprint(2, "Generate return information") >- (value, message) = createReturnInfo(healthStatus, temperature, >+ (value, message) = createReturnInfo(device, healthStatus, temperature, > options.warningThreshold, options.criticalThreshold) > > # exit program
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 258965
:
228485
|
228519