The CPU temperature comes from sensors out of the lm_sensors package (Core). You first have to setup sensors by running sensors-detect. Out of my head (no guarantee), your motherboard should have a sensors chip which is supported by lm_sensors. The hard drive temperature can be read by hddtemp (Extras). At least if your drive has a sensor and provides the data through S.M.A.R.T.
Slick. I know RRD (round-robin database) could be used to log that over time. Has anyone set up scripts to do that? And a nice web page to display the result?