KNOWN_ATTRIBUTES masks for specific drive models #142

Closed
opened 2019-11-08 15:05:17 -07:00 by 2Shirt · 1 comment
2Shirt commented 2019-11-08 15:05:17 -07:00 (Migrated from gitea.2shirt.work)

The Crucial SSDs occasionally have a pending sector count of 1 but it returns to 0 shortly thereafter. I should apply model specific threshold changes; perhaps like so:

KNOWN_MODEL_ATTRIBUTES = {
  r'CT\d+MX\d+SSD': {197: {'Warning': 1, 'Error': 2}},
  }

# Disk attribute check
known_attributes = KNOWN_ATTRIBUTES.copy()
for model, attributes in KNOWN_MODEL_ATTRIBUTES.items():
  if re.search(model, self.details['model']):
    for _id, thresholds in attributes.items():
      if _id in known_attributes:
        known_attributes[_id].update(thresholds)
      else:
        known_attributes[_id] = thresholds
The Crucial SSDs occasionally have a pending sector count of 1 but it returns to 0 shortly thereafter. I should apply model specific threshold changes; perhaps like so: ``` KNOWN_MODEL_ATTRIBUTES = { r'CT\d+MX\d+SSD': {197: {'Warning': 1, 'Error': 2}}, } # Disk attribute check known_attributes = KNOWN_ATTRIBUTES.copy() for model, attributes in KNOWN_MODEL_ATTRIBUTES.items(): if re.search(model, self.details['model']): for _id, thresholds in attributes.items(): if _id in known_attributes: known_attributes[_id].update(thresholds) else: known_attributes[_id] = thresholds ```
2Shirt commented 2019-11-08 15:05:36 -07:00 (Migrated from gitea.2shirt.work)

Better yet:

# Disk attribute check
known_attributes = get_known_attributes(self.details['model])

# Functions
def get_known_attributes(model):
  <Code from above>
Better yet: ``` # Disk attribute check known_attributes = get_known_attributes(self.details['model]) # Functions def get_known_attributes(model): <Code from above> ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: 2Shirt/WizardKit#142
No description provided.