Simple to use JVM library for watching linux/windows/mac resources like cpu-usage, memory, disk space, etc.
The library is written in Java and tested with Spock framework.
It was tested with:
- Ubuntu 18.04, 20.04, 22.04, 22.10, 23.04, 23.10
- OpenSUSE 15
- Fedora 37
- MacOS 12, 13, 14
- Windows 10, 11
The compiled libraries are deployed to Maven Central.
Usage with maven:
<dependency>
<groupId>io.github.kamilszec</groupId>
<artifactId>resourcewatcher</artifactId>
<version>5.10</version>
</dependency>
Usage with gradle:
implementation 'io.github.kamilszewc:resourcewatcher:5.10'
Example in Java:
ResourceWatcher resourceWatcher = ResourceWatcherFactory.create();
DiskWatcher diskWatcher = resourceWatcher.getDiskWatcher();
Memory memory = diskWatcher.getFreePartitionSpace("/");
Long sizeInMB = memory.MB();