oshi is a free, open source monitoring & observability project written in Java and released under MIT. It has 5,274 GitHub stars, 912 forks and 5 open issues, and was last pushed 16 hours ago. On this registry it ranks #86 of 270 tracked projects in Monitoring & Observability, with 5 head-to-head comparisons available. It gained 9 stars over the last 30 tracked days.

What is oshi?

OSHI is a free, MIT-licensed Java library that reads native operating system and hardware information — OS version, processes, memory and CPU usage, disks and partitions, devices, and sensors — through a single cross-platform API without installing any additional native libraries.

What it is

OSHI is a Java library for retrieving native operating system and hardware information. It is built on either Java Native Access (JNA) or the JDK Foreign Function and Memory API (FFM), and ships its own native access layer, so applications do not need to install additional native libraries or compile platform-specific code. One shared API covers Windows, macOS, Linux (including Android), and UNIX systems such as AIX, DragonFly BSD, FreeBSD, NetBSD, OpenBSD, and Solaris (illumos).

The concrete problem it solves is collecting system metrics in Java without writing and maintaining per-platform native code. It replaces the custom, platform-by-platform native bindings that Java monitoring and inventory applications would otherwise have to build and support, and it covers more ground than parsing the output of platform commands. It lives in the Java monitoring and observability ecosystem, addressing cpu-usage, memory-usage, disk-utilization, process-list, hardware-information, and system-monitoring needs through interfaces its consumers already use.

Key capabilities

  • Reports computer system and firmware detail, baseboard information, and virtualization (hypervisor) detection.
  • Enumerates physical (core) and logical (hyperthreaded) CPUs, processor groups, NUMA nodes, caches, and feature flags, with load, usage tick counters, interrupts, and uptime.
  • Exposes per-process uptime, CPU and memory usage, user and group, command line arguments, and thread details.
  • Reads physical and virtual memory used and available, mounted filesystems with type, usable and total space, options, reads and writes, and disk drives with model, serial, size, and I/O counters.
  • Collects network interfaces with IPs and in/out bandwidth, network parameters, routing table, and TCP/UDP statistics.
  • Reports battery state, USB and Bluetooth peripherals, displays with EDID info, graphics and audio cards, and GPU utilization, VRAM, temperature, power draw, and clock speeds.
  • Covers sensors (temperature, fan speeds, voltage) on some hardware, container resource limits and usage under cgroup v1/v2, and printers with name, status, and driver.

Who uses it and how

  • Java monitoring and observability services collecting CPU, memory, disk, and network metrics without shipping per-platform native binaries.
  • Inventory and asset tools enumerating CPU features, disk drives with model and serial, USB and Bluetooth peripherals, printers, and installed applications.
  • Fleet and capacity tooling reading container resource limits and usage through cgroup v1 and v2.
  • JVM performance agents gathering process-level thread counts, command line arguments, and per-process CPU and memory for a metrics pipeline.
  • Desktop, kiosk, or mixed-OS fleet applications needing battery state, display EDID info, and graphics card details from one API across Windows, macOS, Linux, and the BSDs.

Getting started

Add the dependency from Maven Central under the com.github.oshi namespace: oshi-core (JNA, JDK 8+) or oshi-core-ffm (FFM, JDK 25+) at version 7.6.1, with oshi-common carrying the shared API interfaces.

How it compares

The facts supply no list of paid products that OSHI replaces, and they name no directly similar tools, so on the available evidence the project stands alone in this registry.

When to use it — and when not to

There is no database, storage, or SMTP service to operate, because OSHI is a library linked into an application rather than a server; the operational choice is instead which implementation to compile against, since oshi-core requires JNA, oshi-core-ffm requires JDK 25+, and both can draw the JDK's --enable-native-access warning. Projects wanting fewer native dependencies can fall back to the pure-Java oshi.nativefree implementation, which reads only procfs, sysfs, sysctl, and command-line tools, but it covers Linux and NetBSD only. Teams pinned to a JDK 6 or JDK 7 baseline must use legacy releases (oshi-core-3.14.0 and oshi-core-3.13.6), and anyone wanting a ready-made agent, server, or dashboard should look elsewhere, because OSHI supplies system information rather than a monitoring product.

project readme (upstream, from github) — read inline

OSHI

MIT License Maven Central javadoc first-timers-only GitHub contributors

OSHI is a free native (JNA or FFM) Operating System and Hardware Information library for Java. It does not require the installation of any additional native libraries and aims to provide a cross-platform implementation to retrieve system information, such as OS version, processes, memory and CPU usage, disks and partitions, devices, sensors, etc.

Supported Platforms

  • Windows
  • macOS
  • Linux (Android)
  • UNIX (AIX, DragonFly BSD, FreeBSD, NetBSD, OpenBSD, Solaris (illumos))

Supported Features

  • Computer System and firmware, baseboard
  • Operating System and Version/Build, virtualization (hypervisor) detection
  • Physical (core) and Logical (hyperthreaded) CPUs, processor groups, NUMA nodes, caches, feature flags
  • System and per-processor load, usage tick counters, interrupts, uptime
  • Process uptime, CPU, memory usage, user/group, command line args, thread details
  • Services and daemons, login sessions, desktop windows, installed applications
  • Physical and virtual memory used/available
  • Mounted filesystems (type, usable and total space, options, reads and writes)
  • Disk drives (model, serial, size, reads and writes), partitions, and logical volume groups
  • Network interfaces (IPs, bandwidth in/out), network parameters, routing table, TCP/UDP statistics
  • Battery state (% capacity, time remaining, power usage stats)
  • Peripheral devices (USB, Bluetooth)
  • Connected displays (with EDID info), graphics and audio cards
  • GPU utilization, VRAM and shared memory used, temperature, power draw, clock speeds
  • Sensors (temperature, fan speeds, voltage) on some hardware
  • Container resource limits and usage (cgroup v1/v2)
  • Printers (name, status, driver)

Native Access Implementations

OSHI provides two native access implementations:

Both implementations share the same API interfaces from oshi-common. Choose one at compile time, or include both and select at runtime (see Usage below).

oshi-common also carries a third, pure-Java implementation (oshi.nativefree) that reads only procfs, sysfs, sysctl and other command-line tools. It needs no native access at all, so it runs without an --enable-native-access flag and without the warning the JDK prints when one is missing. It covers Linux and NetBSD only, and is selected when neither oshi-core nor oshi-core-ffm is on the classpath.

Downloads and Dependency Management

Stable Release Versions

Snapshot builds of the next version are published to https://central.sonatype.com/repository/maven-snapshots/, which your build must be configured to use.

Legacy Versions

Usage

  1. Include OSHI and its dependencies on your classpath.

    • We strongly recommend you add oshi-core (and/or oshi-core-ffm) as a dependency to your project dependency manager such as Maven or Gradle. Transitive dependencies (including oshi-common and JNA) are resolved automatically.
    • If you manage JAR files manually, download all needed JARs from the oshi-dist zip file attached to each GitHub release. It contains oshi-common, oshi-core, and oshi-core-ffm plus their runtime dependencies; the oshi-demo examples and their dependencies are not included. See UPGRADING.md for details.
    • For Windows, consider the optional jLibreHardwareMonitor dependency if you need sensor information. Note the binary DLLs in this dependency are licensed under MPL 2.0.
    • For Android, you'll need to add the AAR artifact for JNA and exclude OSHI's transitive (JAR) dependency.
    • See the FAQ if you encounter NoClassDefFoundError or NoSuchMethodError problems.
  2. Create a new instance of SystemInfo (implementing SystemInfoProvider):

    // Automatically selects the best available implementation based on your classpath and runtime.
    SystemInfoProvider si = SystemInfoFactory.create();
    
    Classpath JDK Selected implementation
    oshi-core only 8+ JNA (oshi.SystemInfo)
    oshi-core-ffm only 25+ FFM (oshi.ffm.SystemInfo)
    Both oshi-core and oshi-core-ffm 8+ FFM (JDK 25+), otherwise JNA
    oshi-common only 8+ No --enable-native-access required — Linux and NetBSD only (oshi.nativefree.SystemInfo)

    You can also instantiate directly:

    SystemInfoProvider si = new oshi.SystemInfo();            // JNA (oshi-core)
    SystemInfoProvider si = new oshi.ffm.SystemInfo();        // FFM (oshi-core-ffm, JDK 25+)
    SystemInfoProvider si = new oshi.nativefree.SystemInfo(); // no native access (oshi-common)
    
  3. Use the getters from SystemInfo to access hardware or operating system components, such as:

    HardwareAbstractionLayer hal = si.getHardware();
    CentralProcessor cpu = hal.getProcessor();
    OperatingSystem os = si.getOperatingSystem();
    

Some settings are configurable in the oshi.properties file, which may also be manipulated using the GlobalConfig class or using Java System Properties. This should be done at startup, as configuration is not thread-safe and OSHI does not guarantee re-reading the configuration during operation.

Sample Output for Your System

To print a full report of your own system, clone the repository and run the SystemInfoTest main method. Both native implementations provide one:

git clone https://github.com/oshi/oshi.git && cd oshi

# Build and install the modules first, so the shared oshi-common classes resolve
./mvnw install -DskipTests

# JNA (oshi-core), JDK 8+
./mvnw exec:java -pl oshi-core \
  -Dexec.mainClass="oshi.SystemInfoTest" \
  -Dexec.classpathScope="test"

# FFM (oshi-core-ffm), JDK 25+
./mvnw exec:java -pl oshi-core-ffm \
  -Dexec.mainClass="oshi.ffm.SystemInfoTest" \
  -Dexec.classpathScope="test"

See SystemInfoTest.java for the source, or the pre-generated Sample Output for an example report.

Documentation

Additional Modules

oshi-demo — Examples and Demos

Proof-of-concept examples including a Swing GUI, JSON output, JMX integration, and more. Try instantly with jbang:

jbang json@oshi/oshi    # JSON dump of system info
jbang gui@oshi/oshi     # Swing GUI dashboard

See the oshi-demo README for all available demos and usage instructions.

oshi-metrics — Micrometer Metrics

First-party Micrometer integration providing system, process, and container metrics following OpenTelemetry semantic conventions. Works with Prometheus, Grafana, Datadog, and any Micrometer-compatible backend.

OshiMetrics.bindTo(registry, SystemInfoFactory.create());

See the oshi-metrics README for full setup, selective registration, and the complete list of metrics.

oshi-benchmark — JMH Benchmarks

JMH benchmarks comparing JNA and FFM implementations side by side. Requires JDK 25+.

./oshi-benchmark/scripts/run-benchmarks.sh

See the oshi-benchmark README for running specific benchmarks and custom JMH options.

Support

Please see SUPPORT.md.

OSHI for Enterprise

Available as part of the Tidelift Subscription Tidelift

The maintainers of OSHI and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

Security Contact Information

Please see SECURITY.md.

Continuous Integration Test Status

AppVeyor Build Status Android CI Windows CI macOS CI Linux CI Unix CI Cfarm CI SonarQube Bugs SonarQube Vulnerabilities SonarQube Maintainability SonarQube Reliability SonarQube Security Coverity Scan Build Status Codacy Badge CodeQL Coverage Status

How Can I Help?

OSHI originated as a platform-independent library that did not require additional software and had a license compatible with both open source and commercial products. We have developed a strong core of features on major Operating Systems, but we would love for you to help by:

  • Testing! Our CI testing is limited to a few platforms. Download and test the program on various operating systems/versions and hardware and help identify gaps that our limited development and testing may have missed. Specific high priority testing needs include:
    • Windows systems with over 64 logical processors
    • Raspberry Pi
    • Less common Linux distributions
  • Contributing code. See something that's not working right or could work better? Help us fix it! New contributors are welcome.
  • Documenting implementation. Our Wiki is sparse and the oshi-demo artifact is a place to host proof-of-concept ideas. Want to help new users follow in your footsteps?
  • Suggesting new features. Do you need OSHI to do something it doesn't currently do? Let us know.

Contributing to OSHI

Acknowledgments

Many thanks to the following companies for providing free support of Open Source projects including OSHI:

License

This project is licensed under the MIT License.

Frequently asked questions

Is oshi free to use?

oshi is open source under the MIT licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does oshi do?

Native Operating System and Hardware Information

What is oshi written in?

oshi is primarily written in Java. Its source is publicly available at https://github.com/oshi/oshi, and it has 5,274 GitHub stars.