This is a bare copy of


import collectd

PATH = '/sys/class/thermal/thermal_zone0/temp'

def config_func(config):
    path_set = False

    for node in config.children:
        key = node.key.lower()
        val = node.values[0]

        if key == 'path':
            global PATH
            PATH = val
            path_set = True
  'cpu_temp plugin: Unknown config key "%s"' % key)

    if path_set:'cpu_temp plugin: Using overridden path %s' % PATH)
    else:'cpu_temp plugin: Using default path %s' % PATH)
def read_func():
    # Read raw value
    with open(PATH, 'rb') as f:
        temp =

    # Convert to degrees celsius
    deg = float(int(temp)) / 1000

    # Dispatch value to collectd
    val = collectd.Values(type='temperature')
    val.plugin = 'cpu_temp'


Configure collectd

<Plugin python>
    ModulePath "/opt/collectd_plugins"
    Import "cpu_temp"
    <Module cpu_temp>

Grafana query from InfluxDB

SELECT last(value)  FROM "cpu_temp_value" WHERE "type" = 'temperature' AND "host" =~ /^$host$/ AND $timeFilter GROUP BY time($interval) 

(info) The CPU temperature is also monitored by Repetier Server integrated monitoring

  • No labels
Write a comment…