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 61909258a0 - Show all commits

View File

@ -179,8 +179,18 @@ class ServerData:
processor_model = processor_info[0].get('Version', 'Unknown') if processor_info else 'Unknown'
processor_count = len(processor_info)
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.
ram_info = [section for section in self.dmidecode_data if section['DMIType'] == 17]
ram_details = []
for ram in ram_info:
size = ram.get('Size', 'Unknown')
speed = ram.get('Speed', 'Unknown')
ecc = 'Yes' if ram.get('Total Width') == '72 bits' and ram.get('Data Width') == '64 bits' else 'No'
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.
serial_number = ram.get('Serial Number', 'Unknown')
ram_type = ram.get('Type', 'Unknown')
ram_details.append("Size: {}, Speed: {}, ECC: {}, Serial Number: {}, Type: {}".format(size, speed, ecc, serial_number, ram_type))
Review

There are actually two speeds reported, one is the specification of the module and the other is configured speed. What you could do, is to report them both separated with "@". E.g. "1866@1333MHz".

There are actually two speeds reported, one is the specification of the module and the other is configured speed. What you could do, is to report them both separated with "@". E.g. "1866@1333MHz".
Review

Example output:

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

Handle 0x005D, DMI type 17, 34 bytes
Memory Device
	Array Handle: 0x005E
	Error Information Handle: 0x0062
	Total Width: 64 bits
	Data Width: 64 bits
	Size: 8 GB
	Form Factor: DIMM
	Set: None
	Locator: ChannelA-DIMM0
	Bank Locator: BANK 0
	Type: DDR3
	Type Detail: Synchronous
	Speed: 1600 MT/s
	Manufacturer: Micron
	Serial Number: 1FC8D19A
	Asset Tag: 9876543210
	Part Number: 16KTF1G64AZ-1G9P1
	Rank: 2
	Configured Memory Speed: 1600 MT/s

So "Speed" will be "1600 MT/s @ 1600 MT/s" ?

Example output: ```bash root@test2:~# sudo dmidecode -t17 # dmidecode 3.3 Getting SMBIOS data from sysfs. SMBIOS 2.7 present. Handle 0x005D, DMI type 17, 34 bytes Memory Device Array Handle: 0x005E Error Information Handle: 0x0062 Total Width: 64 bits Data Width: 64 bits Size: 8 GB Form Factor: DIMM Set: None Locator: ChannelA-DIMM0 Bank Locator: BANK 0 Type: DDR3 Type Detail: Synchronous Speed: 1600 MT/s Manufacturer: Micron Serial Number: 1FC8D19A Asset Tag: 9876543210 Part Number: 16KTF1G64AZ-1G9P1 Rank: 2 Configured Memory Speed: 1600 MT/s ``` So "Speed" will be "1600 MT/s @ 1600 MT/s" ?
Review

Yes.

Yes.
note = "Chassis Model: {} | Serial Number: {} ||| Processor Model: {} | Count: {} ||| RAM Details: {}".format(
chassis_model, chassis_serial, processor_model, processor_count, '\n'.join(['R1', 'R2', 'R3']))
chassis_model, chassis_serial, processor_model, processor_count, ' | '.join(ram_details))
note_data = {
'note': note,