MightySlaytanic / pve-monitoring

Proxmox VE temperature and disk-health stats upload to influxdb2
MIT License
65 stars 8 forks source link

i7-1270P Help #13

Open miarcin opened 8 months ago

miarcin commented 8 months ago

I try to implement yours solution for my intel Nuc i7-1270P but i have errors, somehow

ERROR: Can't get value of subfeature temp1_input: Can't read Traceback (most recent call last): File "/root/scripts/pve_temp_stats_to_influxdb2.py", line 68, in stats[f"core{index}"] = int(data[CORETEMP_NAME][f"Core {index}"][f"temp{index+CORE_OFFSET}_input"])


KeyError: 'Core 1'

Command sensors -j give me 

sensors -j
{
   "coretemp-isa-0000":{
      "Adapter": "ISA adapter",
      "Package id 0":{
         "temp1_input": 50.000,
         "temp1_max": 100.000,
         "temp1_crit": 100.000,
         "temp1_crit_alarm": 0.000
      },
      "Core 0":{
         "temp2_input": 49.000,
         "temp2_max": 100.000,
         "temp2_crit": 100.000,
         "temp2_crit_alarm": 0.000
      },
      "Core 4":{
         "temp3_input": 47.000,
         "temp3_max": 100.000,
         "temp3_crit": 100.000,
         "temp3_crit_alarm": 0.000
      },
      "Core 8":{
         "temp4_input": 43.000,
         "temp4_max": 100.000,
         "temp4_crit": 100.000,
         "temp4_crit_alarm": 0.000
      },
      "Core 12":{
         "temp5_input": 54.000,
         "temp5_max": 100.000,
         "temp5_crit": 100.000,
         "temp5_crit_alarm": 0.000
      },
      "Core 16":{
         "temp6_input": 48.000,
         "temp6_max": 100.000,
         "temp6_crit": 100.000,
         "temp6_crit_alarm": 0.000
      },
      "Core 17":{
         "temp7_input": 48.000,
         "temp7_max": 100.000,
         "temp7_crit": 100.000,
         "temp7_crit_alarm": 0.000
      },
      "Core 18":{
         "temp8_input": 48.000,
         "temp8_max": 100.000,
         "temp8_crit": 100.000,
         "temp8_crit_alarm": 0.000
      },
      "Core 19":{
         "temp9_input": 48.000,
         "temp9_max": 100.000,
         "temp9_crit": 100.000,
         "temp9_crit_alarm": 0.000
      },
      "Core 20":{
         "temp10_input": 46.000,
         "temp10_max": 100.000,
         "temp10_crit": 100.000,
         "temp10_crit_alarm": 0.000
      },
      "Core 21":{
         "temp11_input": 46.000,
         "temp11_max": 100.000,
         "temp11_crit": 100.000,
         "temp11_crit_alarm": 0.000
      },
      "Core 22":{
         "temp12_input": 46.000,
         "temp12_max": 100.000,
         "temp12_crit": 100.000,
         "temp12_crit_alarm": 0.000
      },
      "Core 23":{
         "temp13_input": 46.000,
         "temp13_max": 100.000,
         "temp13_crit": 100.000,
         "temp13_crit_alarm": 0.000
      }
   },
   "acpitz-acpi-0":{
      "Adapter": "ACPI interface",
      "temp1":{
         "temp1_input": 53.000,
         "temp1_crit": 105.000
      }
   },
   "iwlwifi_1-virtual-0":{
      "Adapter": "Virtual device",
      "temp1":{
ERROR: Can't get value of subfeature temp1_input: Can't read

      }
   },
   "nvme-pci-0100":{
      "Adapter": "PCI adapter",
      "Composite":{
         "temp1_input": 39.850,
         "temp1_max": 89.850,
         "temp1_min": -273.150,
         "temp1_crit": 94.850,
         "temp1_alarm": 0.000
      },
      "Sensor 1":{
         "temp2_input": 39.850,
         "temp2_max": 65261.850,
         "temp2_min": -273.150
      },
      "Sensor 2":{
         "temp3_input": 46.850,
         "temp3_max": 65261.850,
         "temp3_min": -273.150
      }
   }
}
MightySlaytanic commented 8 months ago

Hi @miarcin , the problems that I can see are the error in sensors -j output and a non consecutive numbering of CPUs on Gen12.. BTW I expected an error while converting json output into a dictionary before the index error on CPUs... trying to ignore the iwlwifi error in json output and looking at your error, within the .sh launcher set export PCH_INFO="" and then within the pve_temp_stats_to_influxdb2.py replace the following (starting at row 67)

    for index in range(0,CPU_CORES):
        stats[f"core{index}"] = int(data[CORETEMP_NAME][f"Core {index}"][f"temp{index+CORE_OFFSET}_input"])

with this

    temp_index = range(2,14)
    temp_index_pointer = 0
    for index in "0,4,8,12,16,17,18,19,20,21,22,23".split(','):
        index = int(index)
        stats[f"core{index}"] = int(data[CORETEMP_NAME][f"Core {index}"][f"temp{temp_index[temp_index_pointer]}_input"])
        temp_index_pointer += 1

Unfortunately at present time I can not elaborate something universal or more configurable but maybe this will work for you. Let me know if it works ;-)

miarcin commented 8 months ago

Thansk it workd, i was not sure if i can change code like you did. I'm not good in programing :) I have still error : " ERROR: Can't get value of subfeature temp1_input: Can't read" , but data are now showing.

MightySlaytanic commented 8 months ago

The error is related to sensors error as seen in your output, btw I'm glad it works for you now ;-)