简体   繁体   中英

How To get hardware information using Ruby in Rails?

我正在尝试获取服务器的硬件信息并将其保存到数据库,该怎么办?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM