oshi
by oshi
OSHI is a cross-platform Java library that provides native operating system and hardware information without requiring additional native dependencies.
Native Operating System and Hardware Information
Primary Use Case
OSHI is primarily used by developers and security professionals who need to programmatically access detailed system information such as OS version, CPU, memory, disk, and sensor data for endpoint protection, security automation, and log analysis. It enables integration of hardware and OS metrics into Java applications across multiple platforms without complex native setups.
- Cross-platform support for Windows, macOS, Linux (including Android), and UNIX variants
- Retrieves detailed OS and hardware information including processes, CPU, memory, disks, partitions, devices, and sensors
- JNA-based implementation requiring no additional native library installations
- Supports Java 6, 8, and Java 11+ with modular JPMS support
- Optional integration with jLibreHardwareMonitor for enhanced sensor data on Windows
- Comprehensive documentation including API, FAQ, changelog, and performance considerations
- Open source under the MIT License with active community and contribution guidelines
Installation
- Add 'oshi-core' as a dependency in your project using Maven or Gradle dependency manager
- For Windows sensor data, optionally add the 'jLibreHardwareMonitor' dependency (licensed under MPL 2.0)
- For Android, include the JNA AAR artifact and exclude OSHI's transitive JAR dependency
- Ensure your classpath includes OSHI and its dependencies
- Refer to the FAQ for troubleshooting common JNA-related errors such as NoClassDefFoundError or NoSuchMethodError
Usage
>_ SystemInfo si = new SystemInfo();Creates a new instance of the SystemInfo class to access system information.
>_ HardwareAbstractionLayer hal = si.getHardware();Retrieves the hardware abstraction layer from the SystemInfo instance.
>_ CentralProcessor cpu = hal.getProcessor();Accesses the CPU information from the hardware abstraction layer.
- Integrate OSHI into endpoint monitoring tools to enrich telemetry with native OS and hardware data for enhanced anomaly detection.
- Leverage OSHI in automated security orchestration workflows to dynamically collect system state during incident response.
- Use OSHI as a lightweight cross-platform agent in purple team exercises to simulate reconnaissance and discovery phases.
- Combine OSHI data with SIEM solutions to improve context for alerts related to system and hardware anomalies.
- Develop custom security dashboards using OSHI metrics to provide real-time endpoint health and security posture visibility.
Docs Take 2 Hours. AI Takes 10 Seconds.
Ask anything about oshi. Installation? Config? Troubleshooting? Get answers trained on real docs and GitHub issues—not generic ChatGPT fluff.
3 free chats per tool • Instant responses • No credit card
Related Tools

rustdesk
rustdesk/rustdesk
An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.
osquery
osquery/osquery
SQL powered operating system instrumentation, monitoring, and analytics.
macOS-Security-and-Privacy-Guide
drduh/macOS-Security-and-Privacy-Guide
Community guide to securing and improving privacy on macOS.
How-To-Secure-A-Linux-Server
imthenachoman/How-To-Secure-A-Linux-Server
An evolving how-to guide for securing a Linux server.
Atlas
Atlas-OS/Atlas
🚀 An open and lightweight modification to Windows, designed to optimize performance, privacy and usability.
fail2ban
fail2ban/fail2ban
Daemon to ban hosts that cause multiple authentication errors
