Complete rewrite: SnapRAID SMART logger with BackBlaze algorithm
Fetches SMART data from Scrutiny's InfluxDB and calculates failure probabilities using the exact BackBlaze tables from SnapRAID source. Key features: - Calculates both v12 (with attr 193) and v13 (without attr 193) algorithms - v12 matches SnapRAID pre-v13.0 (includes Load Cycle Count) - v13 matches modern SnapRAID v13.0+ (excludes Load Cycle Count) - Stores both values for trending and comparison - Correctly applies bit masks (16-bit for 187/188, 32-bit for others) - Annualizes monthly rates and applies Poisson distribution - Logs to PostgreSQL with device metadata Solved the mystery: SnapRAID v12 uses attribute 193 which was removed in v13.0. Load cycle count has massive impact on failure predictions for some drives (80% vs 4% difference). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
-- Populate devices table with your drive metadata
|
||||
-- Replace the placeholder values with actual information from your drives
|
||||
|
||||
-- Device 1: WWN 0x5000c500744487c5
|
||||
INSERT INTO devices (device_wwn, device_path, serial_number, model, manufacturer, capacity_bytes, size_tb, disk_role, notes)
|
||||
VALUES (
|
||||
'0x5000c500744487c5',
|
||||
'/dev/sdc', -- Update with actual device path
|
||||
'ZLW0A3QJ', -- Update with actual serial
|
||||
'WDC WD120EFAX', -- Update with actual model
|
||||
'Western Digital', -- Update with manufacturer
|
||||
12000000000000, -- Update with capacity in bytes
|
||||
12.0, -- Size in TB
|
||||
'd1', -- SnapRAID role (d1, d2, parity, 2-parity, or '-' for unused)
|
||||
'Data drive 1' -- Optional notes
|
||||
);
|
||||
|
||||
-- Device 2: WWN 0x5000c500c455c45e
|
||||
INSERT INTO devices (device_wwn, device_path, serial_number, model, manufacturer, capacity_bytes, size_tb, disk_role, notes)
|
||||
VALUES (
|
||||
'0x5000c500c455c45e',
|
||||
'/dev/sdb',
|
||||
'ZX22EJ3Y',
|
||||
'WDC WD200EFAX',
|
||||
'Western Digital',
|
||||
20000000000000,
|
||||
20.0,
|
||||
'd2',
|
||||
'Data drive 2'
|
||||
);
|
||||
|
||||
-- Device 3: WWN 0x5000c500c46b0832
|
||||
INSERT INTO devices (device_wwn, device_path, serial_number, model, manufacturer, capacity_bytes, size_tb, disk_role, notes)
|
||||
VALUES (
|
||||
'0x5000c500c46b0832',
|
||||
'/dev/sdd',
|
||||
'ZTN1BNEZ',
|
||||
'WDC WD120EFAX',
|
||||
'Western Digital',
|
||||
12000000000000,
|
||||
12.0,
|
||||
'd5',
|
||||
'Data drive 5'
|
||||
);
|
||||
|
||||
-- Device 4: WWN 0x5000c500c570663e
|
||||
INSERT INTO devices (device_wwn, device_path, serial_number, model, manufacturer, capacity_bytes, size_tb, disk_role, notes)
|
||||
VALUES (
|
||||
'0x5000c500c570663e',
|
||||
'/dev/sda',
|
||||
'ZX20AAMV',
|
||||
'WDC WD200EFAX',
|
||||
'Western Digital',
|
||||
20000000000000,
|
||||
20.0,
|
||||
'parity',
|
||||
'Parity drive'
|
||||
);
|
||||
|
||||
-- Device 5: WWN 0x5000c500e584b9c8
|
||||
INSERT INTO devices (device_wwn, device_path, serial_number, model, manufacturer, capacity_bytes, size_tb, disk_role, notes)
|
||||
VALUES (
|
||||
'0x5000c500e584b9c8',
|
||||
'/dev/sdg',
|
||||
'2TJ97M6D',
|
||||
'WDC WD100EFAX',
|
||||
'Western Digital',
|
||||
10000000000000,
|
||||
10.0,
|
||||
'2-parity',
|
||||
'Second parity drive'
|
||||
);
|
||||
|
||||
-- Add remaining 4 devices following the same pattern
|
||||
-- Template:
|
||||
-- INSERT INTO devices (device_wwn, device_path, serial_number, model, manufacturer, capacity_bytes, size_tb, disk_role, notes)
|
||||
-- VALUES (
|
||||
-- '0xXXXXXXXXXXXXXXXX', -- WWN from InfluxDB
|
||||
-- '/dev/sdX', -- Device path
|
||||
-- 'SERIAL', -- Serial number from snapraid smart or smartctl
|
||||
-- 'MODEL', -- Model number
|
||||
-- 'MANUFACTURER', -- Manufacturer name
|
||||
-- 0, -- Capacity in bytes
|
||||
-- 0.0, -- Size in TB
|
||||
-- '-', -- SnapRAID role
|
||||
-- '' -- Notes
|
||||
-- );
|
||||
Reference in New Issue
Block a user