A simple Java NUT (Network UPS Tools) client.
This software is part of the Shredzone Commons.
Experimental! I wrote this client because I found no other one at Maven Central. It is a very simple implementation that does not cover all protocol features, and is also not quite well unit tested.
For me it is sufficient like that, so don't expect frequent updates. However, please give feedback if you're using this client in your project (for example by starring it at GitHub). If there is sufficient interest in this client, it would motivate me to invest more time into its development.
- Connects to many UPS via a NUT server.
- Supports the most important commands of the protocol.
- Small footprint, only requires Java 11 or higher.
- Logging via SLF4J
- Semantic Versioning.
Just create a Client
object as starting point, and use its methods.
try (Client client = new Client("localhost")) {
client.getDeviceList().forEach(System.err::println);
Device ups = client.getDevice("myups");
ups.getVariables().forEach(System.err::println);
ups.getRWVariables().forEach(System.err::println);
ups.getCommands().forEach(System.err::println);
} catch (NutException ex) {
ex.printStackTrace();
}
This client implements only the most important features of the NUT protocol 1.2 or higher.
These commands are not supported yet:
GET TYPE
,LIST ENUM
,LIST RANGE
GET TRACKING
,SET TRACKING
LIST CLIENT
PRIMARY
,FSD
STARTTLS
and socket encryption
By setting the log level of the org.shredzone.commons.nut
package to DEBUG
, the communication with the NUT server will be logged.
Caution: The DEBUG
log output contains the login credentials! Do not use it on production level.
- Fork the Source code at GitHub. Feel free to send pull requests.
- Found a bug? File a bug report!
commons-nut is open source software. The source code is distributed under the terms of GNU Lesser General Public License Version 3.