[Discovery - CPU Count/Cores] Understanding how the CPU count and CPU cores for virtual boxes. (Linux/Windows)SummaryQuestion #1How do we get the CPU information for the Linux Servers (Physical/Virtual servers)AnswerLinux uses command cat /proc/cpuinfo to fetch the information in regards to the CPUs. This information also includes the "physical id" of each processor.Reference: Please refer the pattern "Linux Server" step# 12.1 (Get CPU info)Question #2How do we populate the CPU Count for the Linux Servers (Physical/Virtual)?Answer:We calculate CPU's based on the unique Physical id. Other-words lets say we have few processors but with same physical id then we consider it as a single CPU. Based on sample data below, you can see here from the output that all processors have physical id as 0. This is counted as 1 CPU as they are all associated with the same physical id.Sample Data:""processor : 1vendor_id : GenuineIntelcpu family : 6model : 62model name : Intel(R) Xeon(R) CPU E7-8890 v2 @ 2.80GHzstepping : 7microcode : 0x715cpu MHz : 2793.269cache size : 38400 KBphysical id : 0processor : 2vendor_id : GenuineIntelcpu family : 6model : 62model name : Intel(R) Xeon(R) CPU E7-8890 v2 @ 2.80GHzstepping : 7microcode : 0x715cpu MHz : 2793.269cache size : 38400 KBphysical id : 0""If there are processors with different physical id like 0 and 1, it will be counted as 2 CPUs.Reference: Please refer the pattern "Linux Server" step# 12.5 (Parse CPU data)Also refer the KB below: https://hi.service-now.com/kb_view.do?sysparm_article=KB0817725Code:""if (name == "physical id"){physical_id_in_curr_block = value;if (!physicalIds[value]){physicalIds[value] = true;physicalIds.count++;}}"" Question #3:How do we populate the CPU count for Windows servers (physical or virtual)?Answer:We use the Win32_Processor API and get the information like "NumberofCores and NumberofLogicalProcessors"Reference: Please refer the pattern "Windows OS - Server" step# 9.1.1 (Get partial CPU data from Win32_Processor) Question #4:How do we populate the CPU count for Windows Servers (Physical or Virtual)Answer:We populate the count of the processor's table.Reference: Please refer the pattern "Windows OS - Server" step# 10 (Insert System, OS and CPU data to cmdb_ci_win_server)Code:""var rtrn = '';var processorsTable = ${Win32_Processor};rtrn = (processorsTable)?processorsTable.size():"";"" Related Links How does Discovery calculate CPU Count/CPU Core CountHow does linux-CPU probe calculate CPU count?