The client implementations in libupsclient (C), libnutclient (C++), PyNUT (Python), Nut.pm (Perl), and jNut (Java) were audited against the NUT network protocol defined in docs/net-protocol.txt.
The C library is the most mature and complete implementation, used by most core NUT utilities (upsc, upscmd, upsrw, upsmon).
- Commands: Supports all protocol commands:
GET,LIST,SET,INSTCMD,LOGIN,LOGOUT,USERNAME,PASSWORD,VER,NETVER,HELP,STARTTLS,PRIMARY/MASTER,FSD. - Sub-commands: Full support for
GET(VAR, TYPE, DESC, CMDDESC, UPSDESC, NUMLOGINS) andLIST(UPS, VAR, RW, CMD, ENUM, RANGE, CLIENT). - SSL/TLS: Comprehensive support for both OpenSSL and Mozilla NSS backends via
upscli_sslinitandupscli_tryconnect. - Tracking: Implements protocol 1.3
TRACKINGsupport (GET/SET TRACKING). - Completeness: ~100%. This is the reference implementation.
The C++ library provides a high-level, object-oriented abstraction of the protocol.
- Commands: Supports all primary commands. It maps protocol actions to C++ methods (e.g.,
Device::executeCommand,Device::setVariable). - Sub-commands: Supports
GETandLISTfor all standard resources. - SSL/TLS: Supports OpenSSL and NSS, matching
libupsclientcapabilities. - Tracking: Fully implements protocol 1.3
TRACKINGsupport, includingsendTrackingQueryandgetTrackingResult. - Alias Support: Correctly handles
PRIMARY/MASTERaliases andPROTVER/NETVER. - Completeness: ~100%. Highly modern and feature-parity with the C library.
The Python implementation is a single-class abstraction (PyNUTClient). While functional for most tasks, it lags slightly behind the C/C++ versions in protocol depth.
- Commands Supported:
GET UPSLIST/UPSVars,LIST UPS/VAR/RW/CMD/CLIENT,SET VAR,INSTCMD,LOGIN,FSD(handlesPRIMARY/MASTER),HELP,VER. - SSL/TLS: Supports
STARTTLSusing the Pythonsslmodule (since version 1.9.0 in the code). - Missing Features:
- Tracking: No direct implementation of protocol 1.3
TRACKINGcommands (though they can be sent via raw queries if needed). - Sub-commands: Lacks dedicated methods for
GET TYPE,GET DESC,GET CMDDESC, andLIST ENUM/RANGE. - NUMLOGINS: Implemented as
GetDeviceNumLogins(added in recent versions).
- Tracking: No direct implementation of protocol 1.3
- Completeness: ~85%. Excellent for automation and basic monitoring, but lacks native wrappers for advanced protocol 1.3 features like execution tracking.
The Perl implementation provides a unique TIEHASH interface, allowing the UPS state to be accessed as a standard Perl hash.
- Commands Supported:
GET,LIST,SET,INSTCMD,LOGIN,LOGOUT,USERNAME,PASSWORD,VER. - Interface: Uses a socket-based communication but is primarily designed around the
TIEHASHmechanism for monitoring. - Missing Features:
- SSL/TLS: No support for
STARTTLS. - Tracking: No support for Protocol 1.3
TRACKING. - Sub-commands: Missing several newer sub-commands like
UPSDESC,RANGE, andCLIENT.
- SSL/TLS: No support for
- Completeness: ~75%. Best suited for legacy Perl environments and simple monitoring scripts.
The Java client is a standalone library (available in a separate repository/directory) that provides an object-oriented API for NUT.
- Commands Supported:
GET,LIST,SET,INSTCMD,LOGIN,LOGOUT,USERNAME,PASSWORD,MASTER,FSD. - Missing Features:
- SSL/TLS: Confirmed absence of
STARTTLSsupport inStringLineSocket.java. - Tracking: No Protocol 1.3
TRACKINGsupport. - Sub-commands: Lacks support for
TYPE,ENUM, andRANGEsub-commands.
- SSL/TLS: Confirmed absence of
- Completeness: ~70%. Functional for core operations but lacks modern security and advanced protocol features.
| Feature | C (libupsclient) | C++ (libnutclient) | Python (PyNUT) | Perl (Nut.pm) | Java (jNut) |
|---|---|---|---|---|---|
| Core Commands | Yes | Yes | Yes | Yes | Yes |
| SSL/TLS (STARTTLS) | Yes (OpenSSL/NSS) | Yes (OpenSSL/NSS) | Yes (Python ssl) |
No | No |
| GET (All sub-cmds) | Yes | Yes | Partial | Partial | Partial |
| LIST (All sub-cmds) | Yes | Yes | Partial | Partial | Partial |
| TRACKING (Prot 1.3) | Yes | Yes | No | No | No |
| PRIMARY/MASTER Alias | Yes | Yes | Yes | Yes | Yes |
| Status Tracking | Yes | Yes | No | No | No |