Free RAM Slot for Linux

Hi All,

Can anyone help me on relevance for “Free RAM Slot for Linux”.
I am able to gather these information for Windows machine using DeviceLocator from Win32_PhysicalMemory of wmi class. Please have a look below for more clarifications:

So, Same way I need to gather Free RAM Slot information for LINUX machines.


On this server there are total 32 slots out of which 24 are free. I need to write the relevance in such a way that can fetch the value of Free RAM Slot from Linux machine.

I have tried with some of the code but looks like its fetching garbage (not correct) values.

1.

Q: (number of "Device_Locator" of "Physical_memory" of dmi)
A: 1
T: 0.066 ms

2.

Q: number of (string values "device_locator" of structures "memory_device" of smbios)
A: 2
T: 0.118 ms

3.

Q: (number of "Device_Locator" of "memory_device of dmi where Size!= 'No Module Installed'")
A: 1
T: 0.028 ms

Any help on this will be highly appreciated.

Thank You.

First thing that I would try is to get the structure component names of smbios

structure of <smbios>

Then, test the one that is related.

string value <string> of <smbios structure>

Hi @fermt,

You mean something like this??
(number of structure of (string values “devicelocator” of structures “memory_device” of smbios))

Please explain.

###See these analyses:

In particular, look at the results from this relevance: https://bigfix.me/relevance/details/2999603

I don’t have any physical Linux machines handy to really check the sanity of the results, but the answer should be below. I was able to test this on an Ubuntu VM.


physical_memory_array:

unique values of (item 0 of it & name of item 1 of it as trimmed string & "=" & item 1 of it as string as trimmed string) of (name of it & ": ", values of it) of structures whose("physical_memory_array"=name of it) of smbios

memory_device:

unique values of (item 0 of it & name of item 1 of it as trimmed string & "=" & item 1 of it as string as trimmed string) of (name of it & ": ", values of it) of structures whose("memory_device"=name of it) of smbios

number_of_memory_devices:

(it as string as integer) of values "number_of_memory_devices" of structures "physical_memory_array" of smbios

This should represent the number of motherboard ram slots

number of memory_devices

number of structures "memory_device" of smbios

This should be the same: number of values "device_locator" of structures "memory_device" of smbios


Related:

Related APAR/PMR:

1 Like

@jgstew Thank You James!!
I will test the code in our environment and will update on the outcomes. :smiley:

@jgstew Hi James,

I have tried with modifying the content of the code for FREE RAM SLOT for Linux, Looks like SMBIOS fetching values for Windows OS perfectly but when I’m trying to check for Linux machine it’s showing some garbage or Irrelevant data.

I have tested some others code as well but still haven’t got the exact values for Linux machines:


Q: number of unique values of (values "device_locator" of structures "memory_device" of smbios as string)
A: 64
T: 1.600 ms

Q: (it as string as integer) of values "number_of_memory_devices" of structures "physical_memory_array" of smbios
A: 64
T: 0.225 ms

Q: number of structures "memory_device" of smbios
A: 64
T: 0.277 ms

Q: number of values "device_locator" of structures "memory_device" of smbios
A: 64
T: 0.805 ms

Output: You can see value for Total RAM Slot & Free RAM Slot are same which are not correct.

Note : Column “A” represent Total RAM Slot on the machine and Column “B,C & D” represents Free RAM Slot on the same device.

Are these endpoints physical hardware or are they virtual machines?

I would guess that the one that returns 64 slots and 64 memory devices is a virtual machine.

Can you provide the results from the physical_memory_array and memory_device relevance above?

You really need to start with the raw values in order to make sense of the results.

Is there a way to double check these results on the linux command line?

Do you know what the expected result is for any of these? … like do you know the physical number of slots and sticks of RAM?

Yes, Correct!!
We’re testing these code for Physical machines.

Below code will get total no. memory devices from Win32_Physical_Memory_Array Class. I am not sure If this class has predefine property which can show No. of Free RAM Slot.

Q: ((unique values of (item 0 of it & name of item 1 of it as trimmed string & “=” & item 1 of it as string as trimmed string) of (name of it & ": ", values of it) of structures whose(“physical_memory_array”=name of it) of smbios) whose (it contains “devices”))
A: physical_memory_array: number_of_memory_devices=64
T: 0.815 ms

Yes, We have cross checked on one of the Linux endpoint (Physical box) through command line:
[~]# dmidecode -t 17 | grep -i “size: No Module Installed” | wc -l
O/P: 24
//Which Means 24 are Free RAM Slot outta 32 (Total RAM Slot).

I find this confusing. You are saying you are testing the relevance on linux, but then you are giving a screenshot from what appears to be the fixlet debugger, which is windows only.

You may need to use the DMI inspector to get the correct values for the linux system in question.

This relevance is not correct. This is the same as doing number of "a_string" which is meaningless.

See the documentation: https://developer.bigfix.com/relevance/reference/dmi.html


number of memory_devices of dmis

number_of_memory_devices of physical_memory_arrays of dmis

use of physical_memory_arrays of dmis

number of sizes whose(0=it) of memory_devices of dmis

Ahh, Sorry for the confusion!!
I’m testing the code on my local machine and production server (Both Windows).
After testing on fixlet debugger, I’m adding the code into one of the analyses and proving relevance only for Linux machines.

Here is the outcomes:

2 Likes

Try this:

number of values "size" whose(0=it as string as integer) of structures "memory_device" of smbios
1 Like

This is certainly interesting!!

I believe both the code are working perfectly now:

Q: number of values "size" whose(0=it as string as integer) of structures "memory_device" of smbios
Q: number of sizes whose(0=it) of memory_devices of dmis

Here is the screenshot using both above code.

All I need to verify it from the end-user. I will keep you updated on the progress.
@jgstew, I really appreciate your help on this. Tons of thanks for your precious time! :slight_smile: :smiley: :blush:

2 Likes

[root@ ~]# dmidecode -t 17 | grep -i “Size: No Module installed” | wc –l
I have tested the dmi command for gathering “Free RAM Slot” information on some of the physical server and its working properly. I am specifying filter for “Size: No Module installed” will show the exact no. of Free RAM slot on the machine.


Here is the screeshot from IBM BigFix Console which perfectly showing no. of Free and Total RAM Slot information.

Thank You :smiley: :slight_smile:

1 Like

That is awesome that this seems to be working. It seems the issue was figuring out how to get the right info out of the inspector. I misunderstood what the info in SMBIOS meant.

If the SMBIOS relevance works just fine, then that is what I would recommend using because it should work for Unix, Linux, and Windows, which is quite useful to have a single relevance statement for all platforms. (except mac)

On the Mac you have to use the IOKit registry instead, but it would be nice if Apple provided a SMBIOS compatible view into the same info.

2 Likes