Git Product home page Git Product logo

oshi's Introduction

OSHI

MIT License Maven Central first-timers-only Openhub Stats 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)

Downloads and Dependency Management

Stable Release Version

Current Development (SNAPSHOT) downloads

Documentation

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.
  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 SystemInfoTest.java for examples. To see sample output for your machine:

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"

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.

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

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 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

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

Continuous Integration Test Status

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

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. 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

Acknowledgements

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.

oshi's People

Contributors

dbwiddis avatar dependabot[bot] avatar hazendaz avatar dependabot-preview[bot] avatar dblock avatar adrian-kong avatar henryx avatar kamenitxan avatar space2man avatar laurent-r avatar cilki avatar tausiflife avatar bilalam avatar mprins avatar dependabot-support avatar spyhunter99 avatar dornand avatar jimmy-653 avatar ckadner avatar kald0 avatar yoshienverde avatar kyongsik-yoon avatar zachsez avatar swimmesberger avatar ptitvert avatar lprimak avatar jpbempel avatar alessiofachechi avatar vatsalgp avatar rohitkukreja1508 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.