Added note and refactor code #16

Merged
PeterSurda merged 6 commits from swapnil/idlers-agent:main into main 2024-06-26 01:47:20 +02:00
Showing only changes of commit fa67103b20 - Show all commits

View File

@ -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')
Review

We should also report "baseboard", and "system", if present. Traditional servers seem to report "system" and/or "chassis" whereas custom build machines report only "baseboard" (i.e. motherboard), as there is no way for the motherboard to find out what kind of chassis it is mounted into.

We should also report "baseboard", and "system", if present. Traditional servers seem to report "system" and/or "chassis" whereas custom build machines report only "baseboard" (i.e. motherboard), as there is no way for the motherboard to find out what kind of chassis it is mounted into.
Review

Please share a sample sudo dmidecode -t1 output.
Here's what I see on test2:

root@test2:~# sudo dmidecode -t1
# dmidecode 3.3
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.

Handle 0x0001, DMI type 1, 27 bytes
System Information
	Manufacturer: System manufacturer
	Product Name: System Product Name
	Version: System Version
	Serial Number: System Serial Number
	UUID: 2aa1f520-d7da-11dd-b8b7-08606ee5b794
	Wake-up Type: Power Switch
	SKU Number: SKU
	Family: To be filled by O.E.M.
Please share a sample `sudo dmidecode -t1` output. Here's what I see on test2: ```bash root@test2:~# sudo dmidecode -t1 # dmidecode 3.3 Getting SMBIOS data from sysfs. SMBIOS 2.7 present. Handle 0x0001, DMI type 1, 27 bytes System Information Manufacturer: System manufacturer Product Name: System Product Name Version: System Version Serial Number: System Serial Number UUID: 2aa1f520-d7da-11dd-b8b7-08606ee5b794 Wake-up Type: Power Switch SKU Number: SKU Family: To be filled by O.E.M. ```
Review

one:

Handle 0x0001, DMI type 1, 27 bytes
System Information
	Manufacturer: To Be Filled By O.E.M.
	Product Name: X570D4U
	Version: To Be Filled By O.E.M.
	Serial Number: To Be Filled By O.E.M.
	UUID: 7533e379-96c4-49d9-f452-a8a159c72190
	Wake-up Type: Power Switch
	SKU Number: To Be Filled By O.E.M.
	Family: To Be Filled By O.E.M.

two:

Handle 0x0100, DMI type 1, 27 bytes
System Information
	Manufacturer: Dell Inc.
	Product Name: PowerEdge R630
	Version: Not Specified
	Serial Number: 1W9PPM2
	UUID: 4c4c4544-0057-3910-8050-b1c04f504d32
	Wake-up Type: Power Switch
	SKU Number: SKU=NotProvided;ModelName=PowerEdge R630
	Family: Not Specified
one: ``` Handle 0x0001, DMI type 1, 27 bytes System Information Manufacturer: To Be Filled By O.E.M. Product Name: X570D4U Version: To Be Filled By O.E.M. Serial Number: To Be Filled By O.E.M. UUID: 7533e379-96c4-49d9-f452-a8a159c72190 Wake-up Type: Power Switch SKU Number: To Be Filled By O.E.M. Family: To Be Filled By O.E.M. ``` two: ``` Handle 0x0100, DMI type 1, 27 bytes System Information Manufacturer: Dell Inc. Product Name: PowerEdge R630 Version: Not Specified Serial Number: 1W9PPM2 UUID: 4c4c4544-0057-3910-8050-b1c04f504d32 Wake-up Type: Power Switch SKU Number: SKU=NotProvided;ModelName=PowerEdge R630 Family: Not Specified ```
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(
PeterSurda marked this conversation as resolved
Review

I need to verify how it works if there are multiple processors. I have a couple of dual-socket systems, but they always have the same processor model.

I need to verify how it works if there are multiple processors. I have a couple of dual-socket systems, but they always have the same processor model.
Review

Even this part of the code assumes multiple sections with 'DMIType' 4. But only gets 'Version' from the first section. Since you've said "they always have the same processor model", I assume this code should be fine.

Even this part of the code assumes multiple sections with `'DMIType'` 4. But only gets `'Version'` from the first section. Since you've said "they always have the same processor model", I assume this code should be fine.
Review

Yes looks like it's ok.

Yes looks like it's ok.
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
Review

I was looking at some systems, and sometimes both TotalWidth and DataWidth is 72. I'm not really sure what it means. I vaguely remember reading that that's a bug in some DDR4 modules or motherboards. For now I would only check for TotalWidth and ignore DataWidth.

I was looking at some systems, and sometimes both TotalWidth and DataWidth is 72. I'm not really sure what it means. I vaguely remember reading that that's a bug in some DDR4 modules or motherboards. For now I would only check for TotalWidth and ignore DataWidth.
Review

I did some reading on this. TotalWidth is DataWidth + (any extra bits for error correction). So it doesn't matter what the exact number of the TotalWidth is, at least in theory. However, common configuration for ECC memory is to have TotalWidth of 72 bits and a DataWidth of 64, giving extra 8 bits for error checking.

TLDR; to determine if a memory module is ECC or non-ECC, we should compare TotalWidth and DataWidth. if TotalWidth > DataWidth: true else false.

I did some reading on this. TotalWidth is DataWidth + (any extra bits for error correction). So it doesn't matter what the exact number of the TotalWidth is, at least in theory. However, common configuration for ECC memory is to have TotalWidth of 72 bits and a DataWidth of 64, giving extra 8 bits for error checking. TLDR; to determine if a memory module is ECC or non-ECC, we should compare TotalWidth and DataWidth. `if TotalWidth > DataWidth: true else false`.
Review

It misreports on some DDR4 systems and I haven't found conclusive clarification. I have one system for example which reports TotalWidth 72 and DataWidth 72. But it doesn't influence the amount of available memory.

It misreports on some DDR4 systems and I haven't found conclusive clarification. I have one system for example which reports TotalWidth 72 and DataWidth 72. But it doesn't influence the amount of available memory.