Add/remove additional drive metrics

- add drive model
- add drive port
- remove drive location from numbers, it is redundant
This commit is contained in:
Benjamin Wiegand 2024-05-20 00:01:32 -07:00
parent 3d4cda67e1
commit 01c44aa2fe
2 changed files with 17 additions and 8 deletions

12
main.py
View File

@ -177,12 +177,12 @@ if __name__ == '__main__':
DRIVE_INDEX, DRIVE_INDEX,
'drive', 'drive',
not args.scan_drives_once, not args.scan_drives_once,
('Information about installed drives', no_value, [DRIVE_BOX, DRIVE_BAY, DRIVE_VENDOR, DRIVE_LOCATION, DRIVE_SERIAL, DRIVE_LINK_RATE, DRIVE_STATUS, DRIVE_CONDITION]), ('Information about installed drives', no_value, [DRIVE_PORT, DRIVE_BOX, DRIVE_BAY, DRIVE_VENDOR, DRIVE_MODEL, DRIVE_SERIAL, DRIVE_LINK_RATE, DRIVE_STATUS, DRIVE_CONDITION]),
('Sizes of installed drives in megabytes', DRIVE_SIZE, [DRIVE_BOX, DRIVE_BAY, DRIVE_VENDOR, DRIVE_LOCATION, DRIVE_SERIAL]), ('Sizes of installed drives in megabytes', DRIVE_SIZE, [DRIVE_PORT, DRIVE_BOX, DRIVE_BAY, DRIVE_VENDOR, DRIVE_MODEL, DRIVE_SERIAL]),
('Temperatures of installed drives in celsius', DRIVE_TEMP, [DRIVE_BOX, DRIVE_BAY, DRIVE_VENDOR, DRIVE_LOCATION, DRIVE_SERIAL]), ('Temperatures of installed drives in celsius', DRIVE_TEMP, [DRIVE_PORT, DRIVE_BOX, DRIVE_BAY, DRIVE_VENDOR, DRIVE_MODEL, DRIVE_SERIAL]),
('Temperature thresholds of installed drives in celsius', DRIVE_TEMP_THRESHOLD, [DRIVE_BOX, DRIVE_BAY, DRIVE_VENDOR, DRIVE_LOCATION, DRIVE_SERIAL]), ('Temperature thresholds of installed drives in celsius', DRIVE_TEMP_THRESHOLD, [DRIVE_PORT, DRIVE_BOX, DRIVE_BAY, DRIVE_VENDOR, DRIVE_MODEL, DRIVE_SERIAL]),
('Maximum temperatures of installed drives in celsius', DRIVE_TEMP_MAX, [DRIVE_BOX, DRIVE_BAY, DRIVE_VENDOR, DRIVE_LOCATION, DRIVE_SERIAL]), ('Maximum temperatures of installed drives in celsius', DRIVE_TEMP_MAX, [DRIVE_PORT, DRIVE_BOX, DRIVE_BAY, DRIVE_VENDOR, DRIVE_MODEL, DRIVE_SERIAL]),
('Reference time of installed drives in hours', DRIVE_REFERENCE_TIME, [DRIVE_BOX, DRIVE_BAY, DRIVE_VENDOR, DRIVE_LOCATION, DRIVE_SERIAL]), ('Reference time of installed drives in hours', DRIVE_REFERENCE_TIME, [DRIVE_PORT, DRIVE_BOX, DRIVE_BAY, DRIVE_VENDOR, DRIVE_MODEL, DRIVE_SERIAL]),
scan_method=scrape.detect_complex, scan_method=scrape.detect_complex,
)) ))

View File

@ -2,13 +2,17 @@ from snmp_groups import BulkEnums, BulkNumbers, BulkStrings
DRIVE_INDEX = '1.3.6.1.4.1.232.3.2.5.1.1.2' DRIVE_INDEX = '1.3.6.1.4.1.232.3.2.5.1.1.2'
# controller? idk # controller index?
# if anyone can show me a situation where this and drive bay are not related I'll uncomment this
# DRIVE_CONTROLLER = BulkNumbers( # DRIVE_CONTROLLER = BulkNumbers(
# (lambda i: (1, 3, 6, 1, 4, 1, 232, 3, 2, 5, 1, 1, 1) + i), # (lambda i: (1, 3, 6, 1, 4, 1, 232, 3, 2, 5, 1, 1, 1) + i),
# 'controller' # 'controller'
# ) # )
DRIVE_PORT = BulkStrings(
(lambda i: (1, 3, 6, 1, 4, 1, 232, 3, 2, 5, 1, 1, 62) + i),
'port'
)
DRIVE_BOX = BulkNumbers( DRIVE_BOX = BulkNumbers(
(lambda i: (1, 3, 6, 1, 4, 1, 232, 3, 2, 5, 1, 1, 63) + i), (lambda i: (1, 3, 6, 1, 4, 1, 232, 3, 2, 5, 1, 1, 63) + i),
'box' 'box'
@ -35,6 +39,11 @@ DRIVE_SERIAL = BulkStrings(
'serial', 'serial',
) )
DRIVE_MODEL = BulkStrings(
(lambda i: (1, 3, 6, 1, 4, 1, 232, 3, 2, 5, 1, 1, 4) + i),
'model',
)
DRIVE_SIZE = BulkNumbers( DRIVE_SIZE = BulkNumbers(
(lambda i: (1, 3, 6, 1, 4, 1, 232, 3, 2, 5, 1, 1, 45) + i), (lambda i: (1, 3, 6, 1, 4, 1, 232, 3, 2, 5, 1, 1, 45) + i),
'size', 'size',