The way of deriving the information can be found here. So via the console,
sampleSize //!< [in] Larger n give more accurate numbers but with longer latency.
blockNum = eth.blockNumber; // Save this value to atomically get a block number.
blockTime = (eth.getBlock(blockNum).timestamp - eth.getBlock(blockNum - sampleSize).timestamp) / sampleSize;
difficulty = eth.getBlock(blockNum).difficulty; // You can sum up the last n-blocks and average; this is mathematically sound.
"hashrate": difficulty / blockTime,
Values are in seconds, hashes, and hashes per second, respectively.