November 10, 2015

Why NUT

Expectation doesn't always match actuality; which is a shame. But sometimes we can do something about it. This is a tiny tale of my attempt to do just that.

ups-examples

Earlier this year I was on the lookout for a Linux based NAS that had the more enterprise goodness I had encountered with my ventures into ZFS via FreeNAS ie CoW and data checksums, snapshots etc. and happened across Rockstor, but at the time it had no graphical UPS configuration. This for me was a show stopper (details below), my expectation was to adopt my dream NAS setup that ran on my favourite OS and to become a 100% Linux user again.

Sure I was impressed with FreeNAS but I'm a Linux guy and having been an all Linux setup for 15 years at least, it grated to be using nanobsd for my NAS. Nothing against FreeNAS but my mainstay OS of choice was set and I had grown very familiar with it; the BSD’s for all their splendour were just not my cup of tea and it sat uneasy that my darling OS was just not serving me in every way I wanted. So I began looking around again; it had been years since looking at NAS distros so surely something had happened. It was at this point when I first came across Rockstor. This thing was neat, focused, to the point, and most encouragingly developed completely in the open. Sure it was still quite young at < 2.5 years but the pace of development was fast. That’s great I thought, if it has what I need then marvellous but alas it was short of one key feature. It had no GUI way to configure NUT, a UPS tools system, and for me this was just not the ticket. Given that it is essentially a full CentOS with a WebUI bolted on to deal with the btrfs / NAS / sharing stuff I knew I could simply do a text based NUT config but that wasn't what I was looking for. That wasn't an appliance. I had already spent many years doing everything with my teeth even down to the early days of modelines in X and reserving ram just to get 3D going, and regular kernel recompilations or cups recompilations just to be able to print. My Linux should be better than that, it should by now be for the people; all the people. With all the goodness of a modern file system.

So I wondered on by. However the whole Rockstor dabble had left a lasting impression and I just couldn't shake the fact that I was just not happy running a nanoBSD based system when my passions and interests were Linux based. It also greatly excited me that I might once again become an all Linux setup. I enjoy the Linux ethos and I believe the nature of the licence to be key: i.e. Apple’s advancements in BSD that no one else has. Alas; sometimes expectation just doesn't match actuality.

But hold on I thought, I can’t let a little thing like a missing feature stand in my way. I began making tentative inroads into Rockstor's community and code to see what I might do to make a difference. There were some unusual elements to this NAS distro, they had obviously made significant efforts towards usability, you know where things make sense due to design; an all too sparse quality in many a distro / OS. I slowly and surely became convinced that this was an OS NAS OS of the future in the making. And I wanted to be part of that future.

Oh and what Brett said.

Sometimes one just has to adapt to a situation and sometimes one can adapt the situation.

serial-adaptation

Adaptation by adapter. Not all FT232R’s are equal; a null modem wired usb to serial adapter adapted for UPS testing. Sorted.

Part of the Future

At that time the forum was run on something decidedly inferior to discourse and wouldn't even render in my browser of choice, this wasn't good. So I dove into the git repo and browsed the issues and pull requests to try and gain a deeper understanding of the project. In my meandering I saw one or two tiny fixes I could make and on a whim started submitting the tiniest of pull requests. Whilst exploring the feature set further I received a friendly error message that something had gone wrong. Nicely caught and no horrible crashes just a neat dialog encouraging me to send a pre-prepared zip of logs to the developers. Elegant I though. Not just a long wait in the nothingness of an unresponsive system but true assistance and guidance. I was further impressed. So I got the log zip and out of not wanting to bother the developers with my silly problem took a peak. What I saw gave me the impression of something that had been crafted, full on Python with exceptions caught everywhere, not just another PHP monster but a proper structured entity with objects and fancy ways and means. Anyway the log zip pretty much pinpointed the problem but I just wasn't familiar enough with the code to tackle this myself so in the interests of living up to my ideals I posted an issue.

The response was surprisingly fast and entirely jovial; I had (in internet terms) met Suman, the project lead. A fix was committed and in no time at all this silly little issue of mine was sorted and this was good. The joys of a rapid development cycle.

I had at about the same time ventured an email to
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
declaring my interest in NUT and was pleasantly surprised by the encouraging return. They had no plans to implement this feature just yet but they were all to happy to try in whatever way they could to help.

Soon I became more involved and the forum, that was thankfully switched to the most excellent open source discourse, was becoming alive with the growing interest in this new fangled btrfs NAS solution. I was, perhaps unwisely, awarded the privilege of forum maintainer. It’s a pretty friendly place so no worries there.

I went on to submit some doc tweaks and additions. To my surprise the docs are programmatically generated from base .rst files (a markup language) that through the magic of Sphinx end up as html for the rockstor.com home page docs section. This was just getting better and better, and I had started to make a difference.

Why not NUT

So why not NUT, why bother, well indeed; in the context of no doubt well meaning mice this is a question that answers itself. But stories are nice so here goes.

Over time where I live and work the electric had been a little iffy, the occasional trip out but nothing too serious. I had as a matter of course implemented a number of UPS’s and hand configured NUT to deal with these little outages but more was to come.

One morning I awoke to a calmness, this can’t be bad I though, but there was a down side. The entire electric had failed and this time there was no just flipping it back on and going about my business no no. This time it was serious. It turned out that we could no longer make any sockets in the house live; the RCD refusing to enact our expectation. An investigation was in order:-

The Investigation

Most people who have dealings with computers have had mouse problems at one time or another, these days the problems tend not to be physical but electrical; given the prevalence of optical mice. And this was what my mouse problem turned out to be:-

electrical-mouse-problem

The mouse problem diagnosed; definitely electrical and behind a drywall at the back of a cupboard. Inconvenience in carnate.

So without ripping apart my whole (rented) Soho I can only assume that other as yet undiscovered gems such as the above are lying in wait. What's behind your walls?

After many hours of diagnostics and much frustration I had found at least one reason for our previously flaky and now critical electric situation. Needless to say my NUT interest grew and I began as a matter of course to make all systems aware of their pending doom; or at least when it might be a good idea to shut down. NUT, due to it’s network nature, is a perfect fit.

To cut a long story short I ended up submitting (on my 47th Birthday) my first non trivial pull request to rockstor-core. A fortnight of advice reviews and tweaks later and Rockstor now has graphical NUT configuration (in beta). I for one am chuffed. And yes wouldn't it be great to have a shiny UPS data page or a fancy additional widget on Rockstor's dashboard but until that time, successive approximation and development in the open and all, I offer up some “desktop” shiny.

Some Shiny

Given no fancy technology is complete without fancy telemetry; I present walNUT:-

walNUT gnome extension

walNUT the Gnome Shell Extension to monitor one’s UPS, thanks Daniele.

And for those of a KDE persuasion there is KNutClient, thanks Daniel. Note the similarity in the names; funny that. Graphical NUT clients are also available for other popular platforms.

 

What are these things but what we make them.

Click Here!