networkupstools / nut

The Network UPS Tools repository. UPS management protocol Informational RFC 9271 published by IETF at https://www.rfc-editor.org/info/rfc9271 Please star NUT on GitHub, this helps with sponsorships!
https://networkupstools.org/
Other
2.01k stars 351 forks source link

Setting up NUT and starter options #1935

Open SheepDomination opened 1 year ago

SheepDomination commented 1 year ago

I was reviewing the documentation although I don't know how to get this setup and running and what options are available over the manufacturers abysmal documentation for most UPS.

jimklimov commented 1 year ago

Sadly, this is largely trial and error to see what your device supports (and NUT drivers in your version). Some vendors effectively ship very different things under same name and model, with different FW/HW revisions.

Several typical setup scenarios were documented pretty well two decades ago already (in docs, FAQ, config comments, NUT Config Examples book), like 1 PC + 1 UPS, several computers on same UPS, multi-PSU servers on several UPSes...

SheepDomination commented 1 year ago

Which documentation are you referring too; I searched what I could find on the NUT documentation and I couldn't get things started ?

How do I begin, do you have any guide to some extent ?

jimklimov commented 1 year ago

Sorry for slow replies, i'm on a trip now with very occasional signal.

Not really sure about modern docs and how-to's. When I was figuring this out some 20+ years ago, almost before tge Internet, the docs in source tarball were all there was, and they sufficed. I don't think they got any less informative or detailed over the years... e.g. nut-scanner appeared since then to help draft first setups for a device.

They might remain techy, hacky and cryptic in spirit (assuming of reader readiness to experiment and investigate) though. PRs are welcome for a beginner-friendly how-to :)

SheepDomination commented 1 year ago

What do you mean PRs are welcome for a beginner-friendly how-to ?

Would you by means of Team Viewer to help me to get NUT setup ?

jimklimov commented 1 year ago

PRs are "pull requests".

NUT sources do include the setup documentation which sufficed for many readers over quarter of a century; nowadays there are also a Wiki, as well as many third-party blogs detailing their authors' experiences (and woes).

It is becoming evident that the original documentation made assumptions about the readers (who would be sysadmins or similar "geeks", ready to hack, investigate and experiment until success), and the current generation of new users wants something ready-made single-click; more so with NUT embedded as a plugin to some other systems and so not easily accessible by itself.

Nothing wrong with that desire per se, but somebody with that mindset should take the pile of knowledge already available and rearrange it in a manner understandable by "laymen". This is a common problem addressed by many open-source projects. Such efforts are best made by people who actually see a (comprehensibility) problem with current docs, and not by those who already think they are easy night-time reading, or find it easier to invest a bit of overtime to understand existing docs instead of a lot of time to write new ones.

For this case, I'd welcome and encourage you to write something like a Quick start guide (ideally compact for TL;DR readers who doze off after two minutes of reading, and referencing existing docs for nitty-gritty details for readers still awake). And post a pull request to this project to add a yet another text to the sources.

jimklimov commented 1 year ago

Or maybe we need to step back to the issue(s) at hand: originally you asked "I don't know how to get this setup and running and what options are available" - to the best of my knowledge, this is excessively documented in text files available in the NUT sources (some of which get parsed into HTML or PDF docs, or man pages), as well as in sample configuration files. Maybe too excessively so one drowns in that information upon first reading and gets lost in the maze. Maybe too technically written so a degree is needed to wade through it. But otherwise it is there and many people survived making sense of it and not ending up in an asylum :) Contributions are welcome to make this more accessible to less patient or technically-inclined readers.

The practical "help me get NUT set up" depends on details not provided: what OS you have, what NUT version, what device model and media/protocol are involved, what have you tried, what failed and how, config samples, nut-scanner suggestions, driver logs, etc.

SheepDomination commented 1 year ago

Does NUT have to be installed using Linux or can it be installed in Windows. I've read the documentation although that is the first question as to how it should be installed ?

jimklimov commented 1 year ago

Normally so far, it should be fully supported in POSIX-compliant systems (Linux, BSD, MacOS, Solaris, AIX, HP-UX, ...) to the extent that those environments provide further libraries and facilities used by specific drivers (e.g. "Linux i2c" interface is not present on other systems).

There were side projects about NUT for Windows that sort of fizzled out 12-14 years ago with a 2.6.5-based fork. Last year (after 2.8.0 release) this effort was integrated back to the main codebase and is now a "first-class citizen" in terms of buildability and NUT CI farm checks. For the most popular cases (with USB/SNMP drivers) it should work similar to POSIX builds, for some others the platform equivalence code is known missing (e.g. effectively empty methods in some serial-port drivers) and such issues are tracked in https://github.com/orgs/networkupstools/projects/2/views/1 board.

Another notable caveat is that the installer was not revived yet, so currently it is only possible to build NUT (or take a tarball from CI), and then fiddle with libusb configuration so the NUT driver and not stock "HID Battery" would handle the device => for more details see #5, #1050 and https://github.com/networkupstools/nut/issues/1690#issuecomment-1455206002 in particular.

I am not aware yet of any issues (nor success stories) about actually running the full stack with shutdowns and all on Windows alone. According to codebase, there were several generations of integration attempts for upsmon etc. running as Windows services and privileged enough to cause the shutdown. I know this worked in ~2005-2010 when I used it on some servers only running the upsmon for Windows, and talking to a driver and upsd running on a Solaris machine. Configuration-file based setup is equivalent on all platforms.

Current NUT for Windows archives from CI are available at https://ci.appveyor.com/project/nut-travis/nut/build/artifacts - note this is a rolling URL for a "latest" build that may include PR checks; for a somewhat-stable codebase (PR merges to "master" branch) one needs to find the newest AppVeyor build link from a green-ticked commit at https://github.com/networkupstools/nut/commits/master history.

SheepDomination commented 1 year ago

NUT is still being developed for Windows; are you running NUT and if so, how did you install. Start with that so I can get something up and running and what is the first command you suggest I should run ?

jimklimov commented 1 year ago

Who were these questions directed to?

If to myself, I already wrote most of what I can say about this, from a developer perspective. I do not currently use NUT on Windows, just develop it there among other places.

If this question is a shout into the crowd, I guess it would take time for someone who does to notice and reply. Given the recent and experimental nature of that port, I guess there are not many people with hands-on experience so far.

Note that as said above, currently there is no installer, so...

Probably the first thing to run is a browser to find the tarball of binaries made from master branch (see above). Then the archiver to unpack it. Then something to get libusb to handle the UPS, if it is an USB one. Then notepad to edit configs, similar to Unix/Linux...