开发者

Library that fetches "critical" machine information for debugging purposes?

The "critical" machine information will be logged and shall be used for debugging purposes once our software is in the field.

"Critical" information may include data that is "generally" important for debugging the application. It may include:

  1. Operating System
  2. Windows Updates Installed
  3. Hardware information: CPU, RAM, HDD
  4. Processes/Services running
  5. Current user account

I'm sorry for asking such vague question and I believe that it's fairly trivial to write 开发者_如何学运维a custom one using WMI. But, if there's already a library/framework that is designed to do this kind of stuff, it would be great to not reinvent the wheel.


Try something like this, pseudocode!

        private StringBuilder GetSystemInformationString()
        {
            StringBuilder sb = new StringBuilder();
            PropertyInfo[] properties = typeof(System.Windows.Forms.SystemInformation).GetProperties();
            if (properties != null && properties.Length > 0)
            {
                foreach (PropertyInfo pin in properties)
                {
                    sb.Append(System.Environment.NewLine);
                    sb.Append(pin.Name + " : " + pin.GetValue(pin, null));
                }
            }

            return sb;

        }

for memory can use something like this :

(System.Diagnostics.Process.GetCurrentProcess().WorkingSet64 / 1024).ToString() + " Kb";

Regards.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜