I made a patch for 2.3.2 pfSense version for a CPU temperature graph for the above mentioned old thread. I used a lot of it but changed some things. I am not a programmer so things could be better. ;)
This patch is for a quad core N3700 CPU.
--- /etc/inc/rrd.inc 2016-08-21 23:05:29.707358000 +0200
+++ /etc/inc/rrd.inc.modified 2016-08-21 23:44:15.376961000 +0200
@@ -242,6 +242,7 @@
$spamd = "-spamd.rrd";
$proc = "-processor.rrd";
$mem = "-memory.rrd";
+ $cputemp = "-temperature.rrd";
$mbuf = "-mbuf.rrd";
$cellular = "-cellular.rrd";
$vpnusers = "-vpnusers.rrd";
@@ -274,6 +275,7 @@
$rrdlbpoolinterval = 60;
$rrdprocinterval = 60;
$rrdmeminterval = 60;
+ $rrdcputempinterval = 60;
$rrdmbufinterval = 60;
$rrdcellularinterval = 60;
$rrdvpninterval = 60;
@@ -291,6 +293,7 @@
$lbpoolvalid = $rrdlbpoolinterval * 2;
$procvalid = $rrdlbpoolinterval * 2;
$memvalid = $rrdmeminterval * 2;
+ $cputempvalid = $rrdcputempinterval * 2;
$mbufvalid = $rrdmbufinterval * 2;
$cellularvalid = $rrdcellularinterval * 2;
$vpnvalid = $rrdvpninterval * 2;
@@ -733,6 +736,49 @@
/* End Memory statistics */
+ /* CPU Temperature */
+ /* the CPU Temperature gathering function */
+ /* This is for a Pentium N3700 and coretemp which reports 4 cores */
+ /* CPU Temp, create the CPU Temperature database */
+ if (!file_exists("$rrddbpath$ifname$cputemp")) {
+ $rrdcreate = "$rrdtool create $rrddbpath$ifname$cputemp --step $rrdcputempinterval ";
+ $rrdcreate .= "DS:cpu0temp:GAUGE:$cputempvalid:-273:5000 ";
+ $rrdcreate .= "DS:cpu1temp:GAUGE:$cputempvalid:-273:5000 ";
+ $rrdcreate .= "DS:cpu2temp:GAUGE:$cputempvalid:-273:5000 ";
+ $rrdcreate .= "DS:cpu3temp:GAUGE:$cputempvalid:-273:5000 ";
+ $rrdcreate .= "RRA:AVERAGE:0.5:1:1200 ";
+ $rrdcreate .= "RRA:AVERAGE:0.5:5:720 ";
+ $rrdcreate .= "RRA:AVERAGE:0.5:60:1860 ";
+ $rrdcreate .= "RRA:AVERAGE:0.5:1440:2284 ";
+ $rrdcreate .= "RRA:MIN:0.5:1:1200 ";
+ $rrdcreate .= "RRA:MIN:0.5:5:720 ";
+ $rrdcreate .= "RRA:MIN:0.5:60:1860 ";
+ $rrdcreate .= "RRA:MIN:0.5:1440:2284 ";
+ $rrdcreate .= "RRA:MAX:0.5:1:1200 ";
+ $rrdcreate .= "RRA:MAX:0.5:5:720 ";
+ $rrdcreate .= "RRA:MAX:0.5:60:1860 ";
+ $rrdcreate .= "RRA:MAX:0.5:1440:2284 ";
+ $rrdcreate .= "RRA:LAST:0.5:1:1200 ";
+ $rrdcreate .= "RRA:LAST:0.5:5:720 ";
+ $rrdcreate .= "RRA:LAST:0.5:60:1860 ";
+ $rrdcreate .= "RRA:LAST:0.5:1440:2284 ";
+
+ create_new_rrd($rrdcreate);
+ unset($rrdcreate);
+ }
+
+ /* enter UNKNOWN values in the RRD so it knows we rebooted. */
+ if (platform_booting()) {
+ mwexec("$rrdtool update $rrddbpath$ifname$cputemp N:U:U:U:U");
+ }
+
+ /* the CPU Temperature gathering function */
+ $rrdupdatesh .= "CPUTEMP=`$sysctl -n dev.cpu.0.temperature dev.cpu.1.temperature dev.cpu.2.temperature dev.cpu.3.temperature | ";
+ $rrdupdatesh .= "cut -c-2 | tr '\n' ':' | sed 's/.$//'`\n";
+ $rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$cputemp N:\${CPUTEMP}\n";
+
+ /* end CPU Temperature gathering */
+
/* mbuf, create mbuf statistics database */
if (!file_exists("$rrddbpath$ifname$mbuf")) {
$rrdcreate = "$rrdtool create $rrddbpath$ifname$mbuf --step $rrdmbufinterval ";
For easy implementation use the "patches" package.
[image: CPUtemp.png]
[image: CPUtemp.png_thumb]