fix(inputs.smart): Improve regexp to support flags with a plus (#14996)

This commit is contained in:
Akito0723 2024-03-16 00:30:59 +08:00 committed by GitHub
parent a2ec0121d9
commit 19ac5e8081
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 1 deletions

View File

@ -56,7 +56,12 @@ var (
// 1 Raw_Read_Error_Rate -O-RC- 200 200 000 - 0
// 5 Reallocated_Sector_Ct PO--CK 100 100 000 - 0
// 192 Power-Off_Retract_Count -O--C- 097 097 000 - 14716
attribute = regexp.MustCompile(`^\s*([0-9]+)\s(\S+)\s+([-P][-O][-S][-R][-C][-K])\s+([0-9]+)\s+([0-9]+)\s+([0-9-]+)\s+([-\w]+)\s+([\w\+\.]+).*$`)
// ID# ATTRIBUTE_NAME FLAGS VALUE WORST THRESH FAIL RAW_VALUE
// 1 Raw_Read_Error_Rate PO-RC-+ 200 200 051 - 30
// 5 Reallocated_Sector_Ct POS-C-+ 200 200 140 - 0
// 192 Power-Off_Retract_Count -O-RCK+ 200 200 000 - 4
attribute = regexp.MustCompile(`^\s*([0-9]+)\s(\S+)\s+([-P][-O][-S][-R][-C][-K])[\+]?\s+([0-9]+)\s+([0-9]+)\s+([0-9-]+)\s+([-\w]+)\s+([\w\+\.]+).*$`)
// Additional Smart Log for NVME device:nvme0 namespace-id:ffffffff
// nvme version 1.14+ metrics: