Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

com.github.oshi:oshi-core-shaded

Package Overview
Dependencies
Maintainers
0
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

com.github.oshi:oshi-core-shaded

  • 6.1.0
  • Source
  • Maven
  • Socket score

Version published
Maintainers
0
Source

OSHI

MIT License Maven central first-timers-only Tidelift Travis Build Status Appveyor Build status Cirrus Build Status Windows CI macOS CI Linux CI FreeBSD CI OpenBSD CI Solaris CI AIX CI SonarQube Bugs SonarQube Vulnerabilities SonarQube Maintainability SonarQube Reliability SonarQube Security Coverity Scan Build Status Codacy Grade Code Quality: Java CodeQL Coverage Status Scrutinizer Code Quality Openhub Stats github-sponsor buymeacoffee

OSHI is a free JNA-based (native) 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 • Linux • macOS • Unix (AIX, FreeBSD, OpenBSD, Solaris)

Essentials

Supported features

  • Computer System and firmware, baseboard
  • Operating System and Version/Build
  • Physical (core) and Logical (hyperthreaded) CPUs, processor groups, NUMA nodes
  • System and per-processor load, usage tick counters, interrupts, uptime
  • Process uptime, CPU, memory usage, user/group, command line args, thread details
  • 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) and partitions
  • Network interfaces (IPs, bandwidth in/out), network parameters, TCP/UDP statistics
  • Battery state (% capacity, time remaining, power usage stats)
  • USB Devices
  • Connected displays (with EDID info), graphics and audio cards
  • Sensors (temperature, fan speeds, voltage) on some hardware

Downloads

Stable Release VersionCurrent Development VersionDependencies
oshi-core-6.1.0oshi-core-6.1.1-SNAPSHOTJNASLF4J
Java 11 (JPMS) VersionCurrent Development Version
oshi-core-java11-6.1.0oshi-core-java11-6.1.1-SNAPSHOT
Java 6 VersionCurrent Development Version
oshi-core-3.14.0None

Usage

  1. Include OSHI and its dependencies on your classpath. We strongly recommend you add OSHI as a dependency to your project dependency manager such as Maven or Gradle. You can find the appropriate syntax to include OSHI here.

  2. Create a new instance of SystemInfo

  3. Use the getters from SystemInfo to access hardware or operating system components, such as:

SystemInfo si = new SystemInfo();
HardwareAbstractionLayer hal = si.getHardware();
CentralProcessor cpu = hal.getProcessor();

See the PERFORMANCE document for general CPU/Memory tradeoffs and specific Windows (WMI) recommendations depending upon your application.

See the FAQ document for common implementation and calculation questions.

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

The oshi-demo artifact includes several proof-of-concept examples of using OSHI to obtain information, including a basic Swing GUI.

Note: OSHI uses the latest version of JNA. If you experience a NoClassDefFoundError or NoSuchMethodError issues with JNA artifacts, you likely have an older version of either jna or jna-platform in your classpath from a transitive dependency on another project. Consider one or more of the following steps to resolve the conflict:

  • Listing OSHI earlier (or first) in your dependency list
  • Specifying the most recent version of JNA (both jna and jna-platform artifacts) in your pom.xml as dependencies.
  • If you are using the Spring Boot Starter Parent version 2.2 and earlier that includes JNA as a dependency:
    • Upgrade to version 2.3 which does not have a JNA dependency (preferred)
    • If you must use version 2.2 or earlier, override the jna.version property to the latest JNA version.

Support

  • For bug reports, feature requests, or general questions about OSHI's longer term plans, please create an issue.
  • For help integrating OSHI into your own project or maintainer code review of your PRs, tag @dbwiddis in issues or pull requests on your project site.
  • For "how to" questions regarding use of the API, consult examples in the oshi-demo project, create an issue, or search on Stack Overflow using the oshi tag, asking a new question if it hasn't been answered before.
  • To say thanks to OSHI's primary maintainer, you can sponsor him or buy him a coffee.

OSHI for enterprise

Available as part of the Tidelift Subscription

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

To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.

Output

OSHI provides output directly via Java methods for each of its interfaces. By periodically polling dynamic information (e.g., every second), users can calculate and track changes.

You can see more examples and run the SystemInfoTest and see the full output for your system by cloning the project and building it with Maven:

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

./mvnw test-compile -pl oshi-core exec:java \
  -Dexec.mainClass="oshi.SystemInfoTest" \
  -Dexec.classpathScope="test"

In addition, the oshi-demo project includes an OshiGui class implementing a basic Swing GUI offering suggestions for potential visualizations using OSHI in a UI, monitoring, or alerting application, as shown below. For a more advanced GUI based on this approach, see the MooInfo project.

General information about the operating system and computer system hardware: Operating System and Hardware

By measuring ticks (user, nice, system, idle, iowait, and irq) between time intervals, percent usage can be calculated. Per-processor information is also provided. CPU Usage

Process information including CPU and memory per process is available. Process Statistics

Memory and swapfile information is available. Memory Statistics

Statistics for the system battery are provided:

Power Sources:
 Name: InternalBattery-0, Device Name: bq20z451,
 RemainingCapacityPercent: 100.0%, Time Remaining: 5:42, Time Remaining Instant: 5:42,
 Power Usage Rate: -16045.216mW, Voltage: 12.694V, Amperage: -1264.0mA,
 Power OnLine: false, Charging: false, Discharging: true,
 Capacity Units: MAH, Current Capacity: 7213, Max Capacity: 7315, Design Capacity: 7336,
 Cycle Count: 6, Chemistry: LIon, Manufacture Date: 2019-06-11, Manufacturer: SMP,
 SerialNumber: D869243A2U3J65JAB, Temperature: 30.46°C

The EDID for each Display is provided. This can be parsed with various utilities for detailed information. OSHI provides a summary of selected data.

Displays:
 Display 0:
  Manuf. ID=SAM, Product ID=2ad, Analog, Serial=HA19, ManufDate=3/2008, EDID v1.3
  41 x 27 cm (16.1 x 10.6 in)
  Preferred Timing: Clock 106MHz, Active Pixels 3840x2880
  Range Limits: Field Rate 56-75 Hz vertical, 30-81 Hz horizontal, Max clock: 140 MHz
  Monitor Name: SyncMaster
  Serial Number: H9FQ345476
 Display 1:
  Manuf. ID=SAM, Product ID=226, Analog, Serial=HA19, ManufDate=4/2007, EDID v1.3
  41 x 26 cm (16.1 x 10.2 in)
  Preferred Timing: Clock 106MHz, Active Pixels 3840x2880
  Range Limits: Field Rate 56-75 Hz vertical, 30-81 Hz horizontal, Max clock: 140 MHz
  Monitor Name: SyncMaster
  Serial Number: HMCP431880

Disks and usage (reads, writes, transfer times) are shown, and partitions can be mapped to filesystems.

Disks:
 disk0: (model: SanDisk Ultra II 960GB - S/N: 161008800550) size: 960.2 GB, reads: 1053132 (23.0 GiB), writes: 243792 (11.1 GiB), xfer: 73424854 ms
 |-- disk0s1: EFI (EFI System Partition) Maj:Min=1:1, size: 209.7 MB
 |-- disk0s2: Macintosh HD (Macintosh SSD) Maj:Min=1:2, size: 959.3 GB @ /
 disk1: (model: Disk Image - S/N: ) size: 960.0 GB, reads: 3678 (60.0 MiB), writes: 281 (8.6 MiB), xfer: 213627 ms
 |-- disk1s1: EFI (EFI System Partition) Maj:Min=1:4, size: 209.7 MB
 |-- disk1s2: Dropbox (disk image) Maj:Min=1:5, size: 959.7 GB @ /Volumes/Dropbox

Sensor readings are available for some hardware (see notes in the API).

Sensors:
 CPU Temperature: 69.8°C
 Fan Speeds:[4685, 4687]
 CPU Voltage: 3.9V

Attached USB devices can be listed:

USB Devices:
 AppleUSBEHCI
 |-- Root Hub Simulation Simulation (Apple Inc.)
     |-- IOUSBHostDevice
         |-- IR Receiver (Apple Computer, Inc.)
         |-- USB Receiver (Logitech)
 AppleUSBEHCI
 |-- Root Hub Simulation Simulation (Apple Inc.)
     |-- FaceTime HD Camera (Built-in) (Apple Inc.) [s/n: DJHB1V077FDH5HL0]
     |-- IOUSBHostDevice
         |-- Apple Internal Keyboard / Trackpad (Apple Inc.)
         |-- BRCM2070 Hub (Apple Inc.)
             |-- Bluetooth USB Host Controller (Apple Inc.)
 AppleUSBEHCI
 |-- Root Hub Simulation Simulation (Apple Inc.)
     |-- IOUSBHostDevice
         |-- Apple Thunderbolt Display (Apple Inc.) [s/n: 162C0C25]
         |-- Display Audio (Apple Inc.) [s/n: 162C0C25]
         |-- FaceTime HD Camera (Display) (Apple Inc.) [s/n: CCGCAN000TDJ7DFX]
         |-- USB2.0 Hub
             |-- ANT USBStick2 (Dynastream Innovations) [s/n: 051]
             |-- Fitbit Base Station (Fitbit Inc.)

Where are we? 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. Particular testing needs include:
    • Windows systems with over 64 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.

Acknowledgements

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

Applications and Projects using OSHI

Atlassian Confluence
Atlassian Confluence
CAS Server

CAS Server
GeoServer
GeoServer
Apache Flink
Apache Flink
DeepLearning4J
DeepLearning4J
Kamon System Metrics
Kamon System Metrics
NoSQLbench
NoSQLbench
Octopus Deploy
Octopus Deploy
Apache Karaf
Apache Karaf
Universal Media Server
Universal Media Server
PSI Probe
PSI Probe

JPPF


JPPF
Minecraft: Java Edition
Minecraft: Java Edition
Konduit
Konduit
AppDynamics
AppDynamics
HiveMQ
HiveMQ
MOSIP
MOSIP

Handle.net


Handle.net
Trino DBTrino DBWGCLOUD
WGCLOUD
t-io
t-io

Apache DataLab

Apache DataLab
Cryptolens
Cryptolens
OPSLI
OPSLI
GigaSpaces XAP

GigaSpaces XAP
OpenHAB Systeminfo Binding
OpenHAB Systeminfo Binding
Jenkins Swarm Plugin
Jenkins Swarm Plugin
IBM Watson IoT Platform
IBM Watson IoT Platform
DAGR
DAGR
Apache Dolphin Scheduler
Apache Dolphin Scheduler
Hawkular Agent
Hawkular Agent
DynamiaModules SaaS Remote
DynamiaModules SaaS Remote
Apache Doris
Apache Doris
Semux
Semux
Guns
Guns
BlueKing CI
BlueKing CI
N-Squared Java SLEE
N-Squared Java SLEE
EnOS IoT Hub
EnOS IoT Hub
FastChar-ExtJs
FastChar-ExtJs

Garmadon


Garmadon

Hutool


Hutool
Crux Utilities

Crux Utilities
A44K Edge Agent
AR4K Edge Agent
NexCap MAT
NexCap MAT

SAP 360Suite

SAP 360Suite
GoMint

GoMint
RuoYi Management System
RuoYi Management System
DataX Web
DataX Web
Lightstep
Lightstep
GoCypher
GoCypher
javahost
JavaHost.org monitoring pane
Axway ATS Agent
Axway ATS Agent
CloudSlang Score
CloudSlang Score
Erupt Framework
Erupt Framework
StarRocksStarRocks

Graylog

Graylog


Vaadin Platform

Vaadin Platform
Habit Analytics
Habit Analytics


Ridko Notify

Ridko Notify
sys-API
sys-API
BioImaging And Optics Platform
BioImaging And Optics Platform
Alluxio
Alluxio


PC-Details

PC-Details
Paremus UI Server

Paremus UI Server
Ward
Ward
MooInfo
MooInfo

License

This project is licensed under the MIT License.

FAQs

Package last updated on 20 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc