# Temp sensors
# **Displaying CPU Temperature in Proxmox Summery in Real Time**
[Tutorial](https://www.reddit.com/r/homelab/comments/rhq56e/displaying_cpu_temperature_in_proxmox_summery_in/?rdt=45894)
**Here is an image of how it will look:**

Edit: You may have to add more Cores in the code below, depending on how many cores your systems has. Always start with 0.
This tutorial is a bit old now and If you are running this on a future version of proxmox that doesn’t support this code, you could try the following to roll back your manager as pointed by some in the comments ([u/RemarkableSteak](https://www.reddit.com/user/RemarkableSteak/)): apt install --reinstall pve-manager proxmox-widget-toolkit libjs-extjs
# 1) Lets install lm-sensors to show us the information we need. Type the following in the proxmox shell
```
apt-get install lm-sensors
```
Next we can check if its working. To do this we can type `sensors`
The main part we are interested in is:
```
root@pve:~# sensors
coretemp-isa-0000
Adapter: ISA adapter
Package id 0: +23.0°C (high = +84.0°C, crit = +100.0°C)
Core 0: +21.0°C (high = +84.0°C, crit = +100.0°C)
Core 1: +21.0°C (high = +84.0°C, crit = +100.0°C)
Core 2: +22.0°C (high = +84.0°C, crit = +100.0°C)
Core 3: +19.0°C (high = +84.0°C, crit = +100.0°C)
```
If you see this you are good to go!
# 2) Adding the output of sensors to information
Here we will use `Nano` to edit some files. In your shell, type the following:
```
nano /usr/share/perl5/PVE/API2/Nodes.pm
```
Next, you can press **F6** to search for `my $dinfo` and press **Enter**
The code should look like this:
```
$res->{pveversion} = PVE::pvecfg::package() . "/" .
PVE::pvecfg::version_text();
my $dinfo = df('/', 1); # output is bytes
```
We are going to add the following line of code in between: `$res->{thermalstate} = \sensors\;`
So the final result should look like this:
```
$res->{pveversion} = PVE::pvecfg::package() . "/" .
PVE::pvecfg::version_text();
$res->{thermalstate} = `sensors -j`;
my $dinfo = df('/', 1); # output is bytes
```
Now press **Ctrl+O** to save and **Ctrl+X** to exit.
# 3) Making space for the new information
Next we will need to edit another file, So once again we will use `Nano`
Type the following command into your shell: `nano /usr/share/pve-manager/js/pvemanagerlib.js`
Ok so you know the drill by now press **F6** to search for `wait` and press **Enter**
You will see a section of code like this:
```
{
itemId: 'wait',
iconCls: 'fa fa-fw fa-clock-o',
title: gettext('IO delay'),
valueField: 'wait',
rowspan: 2,
},
```
Ok now we need to add some code after this part. The code is:
```
{
itemId: 'thermal',
colspan: 2,
printBar: false,
iconCls: 'fa fa-fw fa-thermometer-half',
title: gettext('Temperature ºC'),
textField: 'thermalstate',
renderer: function(value) {
const cpu_temp_arr = JSON.parse(value);
const sections = [];
const deviceCount = {}; // Contador para dispositivos repetidos
for (const [dev, arr] of Object.entries(cpu_temp_arr)) {
const temp_arr = [];
for (const [name, temps] of Object.entries(arr)) {
if (name === 'Adapter') continue;
for (const [tempName, temp] of Object.entries(temps)) {
if (tempName.includes("_input")) {
temp_arr.push(parseFloat(temp).toFixed(2) + "°C"); // Formata temperatura
}
}
}
if (temp_arr.length > 0) {
// Adiciona índice para dispositivos repetidos
const baseName = dev.split('-')[0]; // Remove possíveis sufixos indesejados
if (!deviceCount[baseName]) {
deviceCount[baseName] = 1;
} else {
deviceCount[baseName]++;
}
const uniqueName = deviceCount[baseName] > 1 ? `${baseName}-${deviceCount[baseName]}` : baseName;
sections.push(`${uniqueName}: ${temp_arr.join(" | ")}`);
}
}
return sections.join(" "); // Usa quebras de linha para melhor legibilidade
}
},
```
Therefore your final result should look something like this:
```
{
itemId: 'wait',
iconCls: 'fa fa-fw fa-clock-o',
title: gettext('IO delay'),
valueField: 'wait',
//commented to add room for cpu temp. Added by PEdro Ponte
//rowspan: 2,
},
{
itemId: 'thermal',
colspan: 2,
printBar: false,
title: gettext('Thermal State(℃)'),
textField: 'thermalstate',
renderer: function(value) {
const cpu_temp_arr = JSON.parse(value);
const sections = [];
const deviceCount = {}; // Contador para dispositivos repetidos
for (const [dev, arr] of Object.entries(cpu_temp_arr)) {
const temp_arr = [];
for (const [name, temps] of Object.entries(arr)) {
if (name === 'Adapter') continue;
for (const [tempName, temp] of Object.entries(temps)) {
if (tempName.includes("_input")) {
temp_arr.push(parseFloat(temp).toFixed(2) + "°C"); // Formata temperatura
}
}
}
if (temp_arr.length > 0) {
// Adiciona índice para dispositivos repetidos
const baseName = dev.split('-')[0]; // Remove possíveis sufixos indesejados
if (!deviceCount[baseName]) {
deviceCount[baseName] = 1;
} else {
deviceCount[baseName]++;
}
const uniqueName = deviceCount[baseName] > 1 ? `${baseName}-${deviceCount[baseName]}` : baseName;
sections.push(`${uniqueName}: ${temp_arr.join(" | ")}`);
}
}
return sections.join(" "); // Usa quebras de linha para melhor legibilidade
}
},
```
Now we can finally press **Ctrl+O** to save and **Ctrl+X** to exit.
# 3)Restart the summary page
To do this you will have to type in the following command: `systemctl restart pveproxy`
If you got kicked out of the shell or it froze, dont worry this is normal! As the final step, either refresh your webpage with **F5** or ideally close you browser and open proxmox again.