From 01c44aa2fe916f29cd657ba8f4d647494931f525 Mon Sep 17 00:00:00 2001 From: Benjamin Wiegand <126627496+Benjamin-Wiegand@users.noreply.github.com> Date: Mon, 20 May 2024 00:01:32 -0700 Subject: [PATCH] Add/remove additional drive metrics - add drive model - add drive port - remove drive location from numbers, it is redundant --- main.py | 12 ++++++------ targets/drive.py | 13 +++++++++++-- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/main.py b/main.py index d1fff3d..6766e6f 100644 --- a/main.py +++ b/main.py @@ -177,12 +177,12 @@ if __name__ == '__main__': DRIVE_INDEX, 'drive', 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]), - ('Sizes of installed drives in megabytes', DRIVE_SIZE, [DRIVE_BOX, DRIVE_BAY, DRIVE_VENDOR, DRIVE_LOCATION, DRIVE_SERIAL]), - ('Temperatures of installed drives in celsius', DRIVE_TEMP, [DRIVE_BOX, DRIVE_BAY, DRIVE_VENDOR, DRIVE_LOCATION, DRIVE_SERIAL]), - ('Temperature thresholds of installed drives in celsius', DRIVE_TEMP_THRESHOLD, [DRIVE_BOX, DRIVE_BAY, DRIVE_VENDOR, DRIVE_LOCATION, DRIVE_SERIAL]), - ('Maximum temperatures of installed drives in celsius', DRIVE_TEMP_MAX, [DRIVE_BOX, DRIVE_BAY, DRIVE_VENDOR, DRIVE_LOCATION, DRIVE_SERIAL]), - ('Reference time of installed drives in hours', DRIVE_REFERENCE_TIME, [DRIVE_BOX, DRIVE_BAY, DRIVE_VENDOR, DRIVE_LOCATION, DRIVE_SERIAL]), + ('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_PORT, DRIVE_BOX, DRIVE_BAY, DRIVE_VENDOR, DRIVE_MODEL, 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_PORT, DRIVE_BOX, DRIVE_BAY, DRIVE_VENDOR, DRIVE_MODEL, 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_PORT, DRIVE_BOX, DRIVE_BAY, DRIVE_VENDOR, DRIVE_MODEL, DRIVE_SERIAL]), scan_method=scrape.detect_complex, )) diff --git a/targets/drive.py b/targets/drive.py index 8f7c21a..39dcdeb 100644 --- a/targets/drive.py +++ b/targets/drive.py @@ -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' -# controller? idk -# if anyone can show me a situation where this and drive bay are not related I'll uncomment this +# controller index? # DRIVE_CONTROLLER = BulkNumbers( # (lambda i: (1, 3, 6, 1, 4, 1, 232, 3, 2, 5, 1, 1, 1) + i), # 'controller' # ) +DRIVE_PORT = BulkStrings( + (lambda i: (1, 3, 6, 1, 4, 1, 232, 3, 2, 5, 1, 1, 62) + i), + 'port' +) + DRIVE_BOX = BulkNumbers( (lambda i: (1, 3, 6, 1, 4, 1, 232, 3, 2, 5, 1, 1, 63) + i), 'box' @@ -35,6 +39,11 @@ DRIVE_SERIAL = BulkStrings( 'serial', ) +DRIVE_MODEL = BulkStrings( + (lambda i: (1, 3, 6, 1, 4, 1, 232, 3, 2, 5, 1, 1, 4) + i), + 'model', +) + DRIVE_SIZE = BulkNumbers( (lambda i: (1, 3, 6, 1, 4, 1, 232, 3, 2, 5, 1, 1, 45) + i), 'size',