From fa67103b2023128bfcd5c954828045babae54629 Mon Sep 17 00:00:00 2001 From: Swapnil Date: Tue, 25 Jun 2024 14:52:36 +0530 Subject: [PATCH] Added chachis and processor info in note --- agent.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/agent.py b/agent.py index 5aa776a..ceadc58 100644 --- a/agent.py +++ b/agent.py @@ -162,9 +162,27 @@ class ServerData: return post_data def create_note_data(self, server_id): + chassis_info = None + for section in self.dmidecode_data: + if section['DMIType'] == 1: + chassis_info = section + break + if chassis_info: + chassis_model = chassis_info.get('Product Name', 'Unknown') + chassis_serial = chassis_info.get('Serial Number', 'Unknown') + else: + chassis_model = chassis_serial = 'Unknown' + + processor_info = [section for section in self.dmidecode_data if section['DMIType'] == 4] + processor_model = processor_info[0].get('Version', 'Unknown') if processor_info else 'Unknown' + processor_count = len(processor_info) + + note = "Chassis Model: {}, Serial Number: {}\nProcessor Model: {}, Count: {}\nRAM Details:\n{}".format( + chassis_model, chassis_serial, processor_model, processor_count, '\n'.join(['R1', 'R2', 'R3'])) + note_data = { 'service_id': server_id, - 'note': 'Bla bla bla' + 'note': note, } return note_data