Added note and refactor code #16
20
agent.py
|
@ -162,9 +162,27 @@ class ServerData:
|
||||||
return post_data
|
return post_data
|
||||||
|
|
||||||
def create_note_data(self, server_id):
|
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(
|
||||||
PeterSurda marked this conversation as resolved
PeterSurda
commented
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.
swapnil
commented
Even this part of the code assumes multiple sections with 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.
PeterSurda
commented
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 = {
|
note_data = {
|
||||||
'service_id': server_id,
|
'service_id': server_id,
|
||||||
'note': 'Bla bla bla'
|
'note': note,
|
||||||
}
|
}
|
||||||
return note_data
|
return note_data
|
||||||
PeterSurda
commented
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.
swapnil
commented
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. 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`.
PeterSurda
commented
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.
|
|||||||
|
|
||||||
|
|
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.
Please share a sample
sudo dmidecode -t1
output.Here's what I see on test2:
one:
two: