How to find power draw in watts?
If your computer actually keeps track of power (e.g. notebook), than on kernel 3.8.11 you can use the command below. It returns power measured in microwatts.
cat /sys/class/power_supply/BAT0/power_now
This works on kernel 3.8.11 (Ubuntu Quantal mainline generic).
Another KISS solution completing Adam's sugestion. This is for people who dont have
a power_now
file. (Arch)
echo - | awk "{printf \"%.1f\", \
$(( \
$(cat /sys/class/power_supply/BAT1/current_now) * \
$(cat /sys/class/power_supply/BAT1/voltage_now) \
)) / 1000000000000 }" ; echo " W "
Reports the actual power draw in Watts with one decimal place.
Computers generally don't track the current they are drawing. It is common that there are voltage sensors that are readable.
Power consumption can vary widely over time depending on workload. CPUs now throttle back when load is low. Disks will shutdown when idle. Tools like powertop will track processes which trigger increases in power consumption. Other tools will aggressively tune down power consumption.
UPSs care about power consumption and often have accessible data.
The manufacturers specs will give you some idea of power consumption, but reconfiguration of hardware can change power consumption. This is probably a good place to start and estimate. Adding new devices or replacing existing ones may alter the power load.
There are devices like Kill-A-Watt that can be used to measure power consumption. However, they require disconnecting the device so that the power runs through the device.
You may want to invest in or borrow a current meter which works by clipping around the wire. This would allow you to calculate volt-amps. This is typically different (higher) than the wattage for servers.