How can I properly measure the capacity of a UPS battery? Unplugging it from the wall is a bad idea since it loses the ground, so how can this be done?
If your UPS has a serial or usb port, there are some open source softwares that can read information from UPS.
Which UPS model do you have? Which OS are you using?
This info I get from a Back-UPS CS 500 usb consumer model connected to a debian linux server using apcupsd:
server:~# apcaccess APC : 001,045,1130 DATE : Fri Aug 20 14:32:06 CEST 2010 HOSTNAME : server RELEASE : 3.14.4 VERSION : 3.14.4 (18 May 2008) debian UPSNAME : zolder CABLE : USB Cable MODEL : Back-UPS CS 500 UPSMODE : Stand Alone STARTTIME: Sat Jun 05 17:47:29 CEST 2010 STATUS : ONLINE LINEV : 226.0 Volts LOADPCT : 33.0 Percent Load Capacity BCHARGE : 100.0 Percent TIMELEFT : 21.4 Minutes MBATTCHG : 5 Percent MINTIMEL : 3 Minutes MAXTIME : 0 Seconds OUTPUTV : 230.0 Volts SENSE : Medium DWAKE : 000 Seconds DSHUTD : 000 Seconds LOTRANS : 180.0 Volts HITRANS : 266.0 Volts RETPCT : 000.0 Percent ITEMP : 29.2 C Internal ALARMDEL : Always BATTV : 13.4 Volts LINEFREQ : 49.0 Hz LASTXFER : Low line voltage NUMXFERS : 1 XONBATT : Fri Aug 06 23:50:52 CEST 2010 TONBATT : 0 seconds CUMONBATT: 2 seconds XOFFBATT : Fri Aug 06 23:50:54 CEST 2010 SELFTEST : NO STATFLAG : 0x07000008 Status Flag SERIALNO : BB0505019948
BATTDATE : 2008-08-13 NOMOUTV : 230 Volts NOMINV : 230 Volts NOMBATTV : 12.0 Volts NOMPOWER : 300 Watts FIRMWARE : 808.q5.I USB FW:q5 APCMODEL : Back-UPS CS 500 END APC : Fri Aug 20 14:32:07 CEST 2010
UPS batteries age over time, so their ability to sustain a load will diminish as it ages. It's for this reason that the more expensive UPS units include electronics built into the UPS itself that monitor battery condition, and then allow that to be queried by a port on the UPS itself. Older UPSes used straight up 9-pin serial connections for this, newer ones use USB or Ethernet. You will need some kind of software to query it, either one from a vendor or there are some open-source options.
Electrically, it is really tricky to judge what condition the battery is in without having sensors on the inputs/outputs of the battery itself before the DC/AC transformer. You can get a rough idea by pulling the plug from the wall, or pulling the circuit-breaker for that outlet, and seeing how long it takes to run out of juice. This is not good on your equipment since it'll crash, but at least you'll have an idea how long you can run before kicking off shut-down scripts.