I capture the CPU temperature of my Raspberry Pi via a very short python program detailed below. After getting the temperature I append it to a log file with the time for graphing with another python program. Thanks to the gpiozero python library it is really simple to code this. This program is executed every five minutes using cron because I find the Raspberry Pi can sometimes get really hot for a minute or so and this way I can catch those spikes. See http://www.ke5prl.com/ke5prl-environment-graphs/ for my graphs.
#Import the CPUTemperature class from the gpiozero library.
from gpiozero import CPUTemperature
#Import the datetime module.
import datetime
#Get the temp, convert to f, round to nearest integer and convert to string.
cpu = CPUTemperature()
cpuf = str(round((cpu.temperature * 1.8) + 32))
#Get the current time and convert to string.
timenow = str(datetime.datetime.now())
#Concatenate temp and time with a pipe between them for parsing later then add a return.
logline = cpuf + "|" + timenow + "\n"
#Append the data to a log file
cputemp = open("cputemplog.txt", "a")
cputemp.write(logline)
cputemp.close()