WebTemp.org

WTUPS (Freeware)

This (windows) project enables WebTemp to display UPS data (line voltage, load, battery voltage and temperature).

System requirements

At the moment WTUPS supports PowerWalker UPSs on COM and USB ports and also models made by APC on USB ports. The port the UPS is connected to is detected automatically.
The software reads line and battery voltages and load percentages directly from the device. My PowerWalker UPS, however, reports a bogus temperature value which stays at 25 degrees Celsius all the time. Battery charge and remaining time are estimated values.

Download

Version 0.2.0 • October, 18th 2009 • Download WTUPS.zip • 266.95 KB


Configuration

WTUPS offers the execution of three event-driven batch files with the names "OnACFail.bat", "OnBatteryLow.bat" and "OnACRestored.bat". You can use these files to start any other tools of your desire.


OnACFail.bat

This file gets started whenever your UPS reports missing/low line voltage. Its content could be:
shutdown -f -s -t 180
This command will shut down the local system in 3 minutes from now. Now, why would we do that? Why would we wait 3 minutes before shutting down the system. Well, power outages often last for only seconds or minutes. Server environments should be as reliable as possible. And we can cancel a running timeout (read on). So we'll better wait 3 minutes and only if the power is still gone the system is allowed to shut down.

We can shut down remote systems (which are connected to the same UPS):
shutdown -f -s -t 180 -m \\HOSTNAME
To shut down remote Linux systems we need an additional freeware tool "plink" (which executes commands remotely):
plink -ssh -pw PASSWORD USERNAME@HOSTNAME /sbin/shutdown -h +3
You can- of course- combine as many command lines as you need (and e.g. trigger a backup).


OnBatteryLow.bat

Sometimes the UPS is drained before the timer has passed. But even in this case the device warns about the impending bad. If we hurry there's still enough time to have all systems shut down. The corresponding commands are (compare to the last paragraph):
 
shutdown -f -s -t 0
shutdown -f -s -t 0 -m \\HOSTNAME
plink -ssh -pw PASSWORD USERNAME@HOSTNAME /sbin/shutdown -h now

OnACRestored.bat

Of course, IF power comes back before the battery is depleted, we'd like to cancel the timers. This is done like this (again based on the three cases we were looking at):
 
shutdown -a
shutdown -a -m \\HOSTNAME
plink -ssh -pw PASSWORD USERNAME@HOSTNAME /sbin/shutdown -c

Integration into WebTemp

When WebTemp is started, WTUPS automatically transmits measurements to it. UPS temperature will be at T1 (unfortunately on my Powerwalker UPS this is a fake value). Line voltage is V1, battery voltage V2 and UPS load is Load no. 3. Take a look:


The layout can be changed by editing WTUPS.ini which- by default- is:
[WebTemp]
Temperature = 1
InputVoltage = 1
OutputVoltage = 2
BatteryVoltage = 3
Load = 3
United States 10:03:41 up 35 days, 8:51, 0 users, load average: 16.48, 14.91, 13.14 Contact • Legal info • Privacy policy