getreceivedbyaddress without knowing the private key Not considering any external services, is there any way (opensource implementation) that would keep up with the blockchain and expose an API with the same functionality as the original getreceivedbyaddress method in bitcoind?

To emphasize, I need the API to return the sum of coins ever received on that address, NOT a current balance. Preferably, this would work without the need of registering/importing that address in advance (so the system should auto-index all addresses spotted in the blockchain).

There's an old (0.8+) fork of bitcoind (https://github.com/TOCICI/bitcoin) that adds importaddress RPC call, which is the best I could find so far (even though it's not optimal since it requires the addresses to be imported first).

Also, there's a continuing discussion going on about watch-only wallets, but I'm afraid (correct me if I'm wrong) this will only provide address balance, not the total amount ever sent.

I've also considered using Electrum server for this, but was only able to see that one can get a current balance of an address.

Any ideas?
Bitcoin Core 0.10 was just released with support for watch-only wallets.

You can use the importaddress command to make a wallet consider the address to be belonging to it, and track incoming payments to it. getreceivedbyaddress will work as expected in that case. In fact, Bitcoin Core does not support an "address balance" feature at all.

It does indeed require you to import the address in advance (or go through a lengthy rescanning procedure). The upside is that this approach scales much better (it doesn't require a fully indexed blockchain, and is compatible with future pruning features).