9 releases
0.1.8 | Oct 8, 2024 |
---|---|
0.1.7 | Sep 18, 2024 |
#236 in Operating systems
199 downloads per month
37KB
814 lines
sysinfo_rs
A library for retrieving system information.
Usage
use sysinfo_rs::get_machine_info;
fn main() -> anyhow::Result<()> {
let machine_info = get_machine_info()?;
println!("{:?}", machine_info);
Ok(())
}
Prerequisites
Before using this library, ensure that you have libudev-devel
installed on your system. This is required for the libudev-sys
crate, which is a dependency of sysinfo_rs
.
You can install libudev-devel
using your package manager. For example:
-
On Debian-based systems (like Ubuntu):
sudo apt-get install libudev-dev
-
On Red Hat-based systems (like CentOS or Fedora):
sudo yum install libudev-devel
Structure
Hardware Information
hardware
: Contains information about the hardware.cpu_is_virtual
: Analyzes the results of thecpuid
command execution to determine if the system is running in a virtual machine (key field).disk_serial_number
: The serial number of the hard disk.mac_addresses
: A list of MAC addresses for all network interfaces in the system.bios_info
: Contains BIOS information, including manufacturer, version, release date, and whether it's a virtual machine.system_info
: System manufacturer, product name, serial number, and UUID.enclosure_info
: Chassis information, including manufacturer, type, version, serial number, and asset tag number.
Software Information
software
: Contains information about the software.os_release
: Operating system version information.uname
: Systemuname
information, including machine, nodename, release, sysname, and version fields.
Dependencies
~3.5–5.5MB
~101K SLoC