Drivers Microdowell

Posted on  by 



Name:
nut-driver-microdowell
Version:
2.7.4-21
Description:
Driver for Microdowell Enterprise UPS series
Installed size:
19kB
Dependencies:
libc, libssp, nut, nut-server
Categories:
network
Repositories:
community-packages
Architectures:
aarch64_cortex-a53, aarch64_cortex-a72, aarch64_generic, arc_arc700, arc_archs, arm_arm1176jzf-s_vfp, arm_arm926ej-s, arm_cortex-a15_neon-vfpv4, arm_cortex-a5_vfpv4, arm_cortex-a7_neon-vfpv4, arm_cortex-a8_neon, arm_cortex-a8_vfpv3, arm_cortex-a9, arm_cortex-a9_neon, arm_cortex-a9_vfpv3, arm_fa526, arm_mpcore, arm_mpcore_vfp, arm_xscale, i386_pentium4, mips64_octeonplus, mips_24kc, mips_mips32, mipsel_24kc, mipsel_24kc_24kf, mipsel_74kc, mipsel_mips32, powerpc_464fp, powerpc_8540, x86_64
OpenWrt release:
OpenWrt-19.07.0
File size:
20kB
License:
GPL-2.0-or-later GPL-3.0-or-later GPL-1.0-or-later Artistic-1.0-Perl
Maintainer:
Daniel Dickinson
Bug report:
Bug reports
Source code:
Sources
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies

Port details: nut Network UPS Tools 2.7.418 sysutils =41 2.7.418 Version of this port present on the latest quarterly branch. Maintainer: cy@FreeBSD.org Port Added: unknown Last Update: 2020-11-14 07:58:15. Nut-driver-microdowell Version: 2.7.4-20 Description: Driver for Microdowell Enterprise UPS series Installed size: 19kB Dependencies: libc, libssp, nut, nut-server Categories: network Repositories: community-packages Architectures.

Upsdriversmicrodowell: Driver for Microdowell Enterprise UPS series upsdriversnetxml-ups: Driver for Eaton / MGE Network Management Card / Proxy (XML/HTTP Protocol) equipment upsdriversnut-ipmipsu: Driver for IPMI Power Supply Units (PSU) upsdriversnutdrvqx: Driver for Q. protocol serial and USB based UPS equipment. Driver for Microdowell Enterprise UPS series: Gentoo Packages Database. Data as current of Jan 11, 2021 05:35:37 UTC Questions or comments? Please feel free to.

A few years back, I bought a Network Management Card (AP9630) for my APC Smart UPS 1000. I figured it would simplify managing the multiple computers I was running on the UPS. I was wrong. The APC software was horrible. The linux version required Java and a graphical interface, and that wasn't going to cut it on my headless Linux server. NUT looked like a possibility, and after running across this post, I decided to give a shot at installing NUT on OpenWRT. After some effort, I now have NUT running on OpenWRT managing my UPS and serving my local network, and it does everything I had hoped that the expensive Network Management Card should have done.

By installing it on an OpenWRT router, you gain a few things over installing it on a linux server. The router boots up quickly, is on every hour of every day, and is a low power device. Power can be cut at any time without concern for corruption of the filesystem, and upon return of power, it will always boot back up to a running condition.

I found this so useful, that I thought I'd share it with the OpenWRT community. I wouldn't be opposed to writing a wiki on it, I just don't have any experience in that. I don't know if people would find that useful or not.

Here's what I did:

Building the NUT Package

The first thing I did was to build the NUT package. I am running Backfire 10.03.1 with the 2.4 kernel, on a WRT54GS. Prior to this, I had never built a package for OpenWRT. This is the part I have the least confidence in, so I won't go into detail. I started with the Makefile I found following the link in the post by OpenSys above. After some trouble compiling it, I eventually pared down the file to only include the apcsmart driver and a few other files. Here is the Makefile I used, including the commented out lines:

I installed the package, and to my surprise, it worked. I'm sure someone more experienced in building packages could figure out how to include all of the drivers. There was talk in the link above that suggested that somebody would package NUT for a future release of OpenWRT. I really hope this happens.

Installing a Serial Port

The WRT54GS has two serial ports at TTL levels. In order to use these, a RS-232 transceiver is required. I used a 3.3V version so it could be powered by the WRT54GS directly. The transceiver and capacitors I used can be found here:

MAX3232ECPE+
.47uF caps

I put the circuit together based on the 'typical operating circuits' figure on page 18 of the data sheet. I recommend using header pins / receptacles to connect your custom circuit to the router board. My initial circuit was missing a trace, and it wasn't possible to troubleshoot or fix it without being able to remove it. I cut holes in the side of the router and mounted two DB-9 connectors. It works great. The first serial port is configured as the console for the router. I used the second port to connect my UPS.

Since I bought my UPS refurbished, it did not come with the serial cable, so I made one myself using the diagram found here.

Configuring the NUT Master

Drivers Microdowell

For the examples to follow, I use the static IP address of 10.1.1.1 for my OpenWRT router.

By default, NUT runs as the user 'nobody', so the permissions on the serial port need to be changed accordingly. NUT also requires a directory to hold PID and other files. Create the directory and set the ownership to user 'nobody':

This is just for initial testing. I initially put these commands in /etc/rc.local so I didn't have to keep typing them in after rebooting. Eventually, I put these commands into a script in /etc/init.d to be run when the router starts up. (I'll get to that later)

Set the permissions of all configuration files:

Configuring the Driver

Microdowell

Add the following into /etc/nut/ups.conf

This configures NUT to use the apcsmart driver and serial port 1. Test the configuration to see if the driver runs properly as user 'nobody'. The process will have the name apcsmart (the name of the driver).

Configure the NUT Server

Add the following into /etc/nut/upsd.conf

This configures upsd to monitor the localhost and on 10.1.1.1 for clients.

Add the following into /etc/nut/upsd.users

Set passwords for each of the accounts. I used the 'admin' user to later configure the UPS settings. The user 'upsmon' is used by the NUT master (OpenWRT router), and two clients are listed. In my case, I have a headless linux server, and a Windows machine. Afterwards, test for the proper operation of the NUT server:

Check to see that the process is owned by user 'nobody'. You can also check the status of the UPS using the command:

Configure the UPS

Run the following commands to configure the UPS. Replace '12345' with the password of your 'admin' account.

These are the settings I used. Your settings may vary. I chose the maximum value for battery.runtime.low for testing purposes. I haven't chosen a final value yet, but make sure it is greater than the sleep delay value to be defined later. The ups.delay.shutdown value is set to zero. Because we don't have to worry about cutting power to the router, there is no need for this delay. The real benefit of running NUT on a router is that you eliminate most of the power race conditions you might encounter on a regular linux machine.

Configure the NUT Client on the OpenWRT Router

Add the following line to /etc/nut/nut.conf

This configures the OpenWRT to be the NUT master.

Add the following to /etc/nut/upsmon.conf

This configures the OpenWRT system to monitor the NUT server on the local host. Upon receiving a low battery condition, the NUT master will send the forced shutdown signal (FSD) to the clients to turn them off. It then immediately executes the SHUTDOWNCMD defined in /etc/nut/upsmon.conf. The shutdown command will sleep for 120 seconds, then turn off the UPS, giving the clients a little more than 2 minutes to shut down (the shutdown command to the UPS takes a little while to go through). With this setup, after the FSD is commanded, a shutdown is guaranteed to occur. Even if power comes on after the FSD is sent, the UPS will shut down for about a second and then power back on. This will result in a hard reset of the router, and will restart any computers that are configured to turn back on when power is restored.

This is the third delay / shutdown approach I tried. The first two approaches didn't work properly: The first approach was to set SHUTDOWNCMD='upsdrvctl shutdown', FINALDELAY=000, and ups.delay.shutdown=090. NUT would command a UPS shutdown immediately after sending the FSD, and the UPS would delay 90 seconds before shutting down, giving the clients time to turn off. The problem was that if the power came on between the FSD and the expiration of ups.delay.shutdown, the UPS wouldn't always shut itself down. It seemed that the UPS would notice it was no longer on battery, then declare everything to be ok, so there's no need to turn off. That's my guess, at least.

The second approach was to set SHUTDOWNCMD=upsdrvctl shutdown, FINALDELAY=120, and ups.delay.shutdown=000. After issuing the FSD, NUT would delay 120 seconds before commanding the UPS to shut down. Again, if the power came back on during this delay period, NUT would think everything is ok and wouldn't shut down the UPS.

Both of these cases work just fine to shut things down, but I wanted something that would guarantee that my server would turn back on when power was restored. Chances are that this particular situation (power coming on between FSD and UPS turning off) wasn't very likely, but I found something that works.

Test the client:

Confirm that there are two upsmon processes running, one by the user 'nobody' and one by 'root'.

Configure NUT to Start at Boot Time

Create the file /etc/init.d/nut:

Set the permissions of the script, and create a symbolic link in /etc/rc.d

At this point, you can remove the temporary commands in /etc/rc.local and reboot the router. Verify that apcsmart, upsd, and the two upsmon processes are running.

Configure the NUT Clients

Configuring a linux client is fairly simple. On Debian, you just need to install the nut package. Then add the following to /etc/nut/nut.conf

Add the following line to /etc/nut/upsmon.conf

where 'client1name' and '12345' are the user name and password for the linux client, as defined in /etc/nut/upsd.users on the NUT master.

Test the System

At this point, you can pull the plug and test out the complete system. I can't speak for other brands, but i the case of the APC Smart UPS, this is what I found: When AC power is lost, the UPS goes into 'on battery' mode. If you have notifications enabled (see below), NUT will send a notification. If power comes back on, the UPS returns to 'On-Line' mode. If AC power does not come back on, the UPS runs on battery until the battery.runtime parameter drops below battery.runtime.low at which point a Forced Shutdown (FSD) occurs. The NUT master sends the FSD command to all of the clients, then executes the SHUTDOWNCMD, which waits for 120 seconds then sends the command to turn off the UPS. If the line power were to come back on at this point, the command would still go through and the UPS will shut off for a second or so before coming back online. If line power never came back on, the UPS would shut off and remain off until line power returns. Once the UPS charge is greater than battery.charge.restart, the UPS turns back on and the router starts up, along with any computers that are configured to restart on restoration of power.

Setting up Email Notification

One of the cool features of the APC Network Management Card was that you could configure it to email you when certain power conditions occur. I really didn't want to lose this capability, and I was pleasantly surprised to find that NUT could be configured to do this as well.

Add the following to /etc/nut/upsmon.conf:

NUT will execute the script /etc/nut/notifyme if any of the above conditions occur, passing the text of the condition to the script. From this point, you can write your own custom script to notify you however you prefer. In my case, I wrote a script to send an email to my gmail account (from the same account). Install the msmtp package. Then add the following to /etc/msmtprc

where useraccount@gmail.com is your gmail account and 12345 is your password. (replace '12345' in the config file with your password, don't change your gmail password to '12345'! That's the kind of thing an idiot would have on his luggage!) Change the owner of /etc/msmtprc

Create the script /etc/nut/notifyme

Drivers Microdowell Test

Ok, so it might not be the most elegant script, but it works. If somebody has a better suggestion, I wouldn't mind hearing about it.

Change the permissions and ownership of the script:

Test it out by unplugging the UPS, and you'll get a cool little email notification. You can modify /etc/nut/notifyme to suit your preference. I think this is the coolest feature!

Drivers

Data Logging

An optional feature of NUT is to log UPS data. If you had some sort of practical storage on your router, you could do this on the router itself. Since my router only has the limited flash RAM, I chose to implement it on my linux server, acting as a NUT client. I created a directory and set permissions to user nut.

I then added the command to /etc/rc.local

Drivers Microdowell License Test

Drivers microdowell lbp

Web Status Interface

The last feature that the APC Network Management Card had, that I still wanted, was a web-based status page. I implemented this on my Debian linux NUT client. I installed the nut-cgi package. Then I added the line to /etc/nut/hosts.conf:

Drivers Microdowell Xerox

That's it. You can view your UPS status by going to http://yourservername/cgi-bin/nut/upsstats.cgi, where 'yourservername' is the name of your web server.





Coments are closed