2

I'm trying to get the hardware information of my server and save it to database, How can I do that?

anothermh
  • 9,815
  • 3
  • 33
  • 52
endyey Es
  • 479
  • 1
  • 5
  • 17
  • Why do you want do that? What do you try to achieve? – spickermann Apr 22 '15 at 02:51
  • FWIW: this answer has some linux-specific suggestions: http://stackoverflow.com/questions/7882664/how-do-i-get-linux-system-information-in-ruby – orde Apr 22 '15 at 03:05
  • @endyey-es if those answers bellow work for you please consider accept one. This will help others to see the best answer to this question, and will pay for responder's time and efforts. – Misha Slyusarev Apr 22 '15 at 16:18

2 Answers2

3

I believe it depends on your system, but looks like there is a gem called hardware_information. Maybe it's what you're looking for.

Misha Slyusarev
  • 1,353
  • 2
  • 18
  • 45
0

If your server is running Linux, your code can just read files in /proc to get hardware information. For example:

  1. File /proc/meminfo contains the ram information.
  2. File /proc/cpuinfo contains the cpu information.
  3. There are many other files.
crazyjin
  • 56
  • 7