简体   繁体   English

如何使用Ruby in Rails获取硬件信息?

[英]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 . 我相信这取决于您的系统,但是看起来好像有一个名为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. 如果您的服务器运行的是Linux,则您的代码只需读取/ proc中的文件即可获取硬件信息。 For example: 例如:

  1. File /proc/meminfo contains the ram information. 文件/ proc / meminfo包含ram信息。
  2. File /proc/cpuinfo contains the cpu information. 文件/ proc / cpuinfo包含cpu信息。
  3. There are many other files. 还有许多其他文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Ruby on Rails登录Facebook获取信息 - ruby on rails login facebook get information 如何在轨道上使用 Ruby 中的变量获得 model - How to get a model using a variable in Ruby on rails Ruby on Rails:如何以渲染形式查看信息? - Ruby on Rails : How to see information in render form? 如何在Ruby on Rails中的jQuery中包含会话信息? - How to include the session information in jQuery in ruby on rails? Ruby on Rails 3如何显示数据库中的信息 - Ruby on Rails 3 how to display information from the database 没有信息的Ruby on Rails“ NoMethodError” - Ruby on Rails “NoMethodError” with no information 如何从列表中的学生那里获得ID,并在另一页上显示学生的信息? Ruby on Rails - How do I get an id from a student in a list and display it the student's information on another page? Ruby on Rails Rails如何使用SoundCloud歌曲URL获取SoundCloud曲目信息 - Rails how to get SoundCloud track information using SoundCloud song URL 如何获得Rails select下拉列表中的红宝石以自动包含正确的信息? - How can I get a ruby on rails select dropdown to automatically contain the proper information? 如何使用Ruby / Rails或可能的PHP读取目录或文件信息? - How can I read directory or file information using Ruby/Rails or possibly PHP?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM