18

Is there a command, or package that can be used to calculate how much power my server is drawing? I am interested in knowing how much my server is costing me to run. I know the calculations of how much it would cost if drawing the full 300 Watts from the PSU, but I believe that this is unlikely to be the reality of it.

It is being used as a file and media server, so most of the time it will be reasonably idle. It is also running as a headless server, so all I am interested in, is the server itself.

Braiam
  • 67,791
  • 32
  • 179
  • 269
Codemwnci
  • 1,249
  • An idea is to grab the current voltage each piece of hardware is using and then convert it. This is what UPS systems do, it wouldn't take much math, but the theory fits. You should be able to pull CPU voltage using sensors. Since I expect you run a normal server you probably wouldn't be using any USB devices but you would need to calculate minimal voltage. There is a lot to it but it might be worth it to if you want to stay green. – Jordon Bedwell Nov 15 '10 at 17:34

3 Answers3

12

I don't think it's possible to calculate the power consumption by software in a reliable manner.

Some (most?) notebook can tell you how much power you're drawing from the battery. But I don't think that this is possible for desktop computers or servers without special hardware.

If you have physical access to the server, you could just plug it in an electricity usage monitor, e.g. this one for 22 USD.

pableu
  • 649
1

Thanks to the RAPL capabilities available in many intel/amd cpus (that is pretty reliable compared to a physical wattmeter) there are some projects emerging for that in the last years.

One of them is scaphandre. This is pretty recent but you can already get the machine power consumption and the consumption of each processes running on it.

nulse
  • 111
1

AFAIK most server & desktop hardware doesn't have the necessary hardware parts to measure this (unlike laptops where this is part of the battery electronics).

If you have an UPS, then this might be part of its features, so if you have one, you might want to look at its documentation.

Otherwise, there also devices that you can put between the server and the wall plug to measure this.

JanC
  • 19,422