CPU and mem are just WMI and PerformanceCounter objects:
ManagementObjectSearcher cpuSearch = new ManagementObjectSearcher(@"\root\CIMV2",
"SELECT * FROM Win32_PerfFormattedData_PerfOS_Processor WHERE Name=\"_Total\"");
ManagementObjectCollection moc = cpuSearch.Get();
ManagementObject mo = moc.Cast<managementobject>().First();
string cpu = mo["PercentIdleTime"].ToString();
PerformanceCounter memCounter = new PerformanceCounter("Memory", "Available MBytes");
string mem = memCounter.NextValue().ToString();
</managementobject>
Ping is not something you can just measure: it's a round trip time value to a specific server, and it measures the connection speed of both machines and their response times. You can't just say "My ping is nn" because it is completely meaningless! It needs a server to measure it against.