I’m back. According to the tutorial in the first post, I made the python file based on this script:
from bases.FrameworkServices.ExecutableService import ExecutableService
ORDER = ['temperature']
CHARTS = {
'temperature': {
'options': ['temperature', 'Temperature', 'Celsius', 'temperature', 'custom.temperature', 'line'],
'lines': [
['zone0', None, 'absolute', 1, 1000],
['zone1', None, 'absolute', 1, 1000],
['zone2', None, 'absolute', 1, 1000],
['zone3', None, 'absolute', 1, 1000],
['zone4', None, 'absolute', 1, 1000],
]}
}
class Service(ExecutableService):
def __init__(self, configuration=None, name=None):
ExecutableService.__init__(self, configuration=configuration, name=name)
self.commands = {
'zone0': ['cat', '/sys/devices/virtual/thermal/thermal_zone0/temp'],
'zone1': ['cat', '/sys/devices/virtual/thermal/thermal_zone1/temp'],
'zone2': ['cat', '/sys/devices/virtual/thermal/thermal_zone2/temp'],
'zone3': ['cat', '/sys/devices/virtual/thermal/thermal_zone3/temp'],
'zone4': ['cat', '/sys/devices/virtual/thermal/thermal_zone4/temp'],
}
self.order = ORDER
self.definitions = CHARTS
def check(self):
data = self._get_data()
if not data:
return False
return True
def _get_data(self):
data = {}
for key in self.commands:
self.command = self.commands[key]
try:
out = int(self._get_raw_data()[0])
data[key] = out
except (ValueError, AttributeError):
continue
return data
I saved it as temperature.chart.py file in the folder /opt/netdata/usr/libexec/netdata/python.d
- the only folder that includes *.chart.py files.
Next (again - according to the tutorial) I added the line temperature: yes
to the python.d.conf file saved in the /opt/netdata/usr/lib/netdata/.
So the file looks like this:
# netdata python.d.plugin configuration
#
# This file is in YaML format.
# Generally the format is:
#
# name: value
#
# Enable / disable the whole python.d.plugin (all its modules)
enabled: yes
# ----------------------------------------------------------------------
# Enable / Disable python.d.plugin modules
#default_run: yes
#
# If "default_run" = "yes" the default for all modules is enabled (yes).
# Setting any of these to "no" will disable it.
#
# If "default_run" = "no" the default for all modules is disabled (no).
# Setting any of these to "yes" will enable it.
# Enable / Disable explicit garbage collection (full collection run). Default is enabled.
gc_run: yes
# Garbage collection interval in seconds. Default is 300.
gc_interval: 300
# adaptec_raid: yes
# alarms: yes
# am2320: yes
# anomalies: no
# beanstalk: yes
# bind_rndc: yes
# boinc: yes
# ceph: yes
# changefinder: no
# dockerd: yes
# dovecot: yes
# this is just an example
example: no
# exim: yes
# fail2ban: yes
# gearman: yes
go_expvar: no
# haproxy: yes
# hddtemp: yes
hpssa: no
# icecast: yes
# ipfs: yes
# litespeed: yes
logind: no
# megacli: yes
# memcached: yes
# mongodb: yes
# monit: yes
# nginx_plus: yes
# nvidia_smi: yes
# nsd: yes
# ntpd: yes
# openldap: yes
# oracledb: yes
# postfix: yes
# postgres: yes
# proxysql: yes
# puppet: yes
# rabbitmq: yes
# rethinkdbs: yes
# retroshare: yes
# riakkv: yes
# samba: yes
# sensors: yes
# smartd_log: yes
# spigotmc: yes
# springboot: yes
# squid: yes
# traefik: yes
# tomcat: yes
# tor: yes
# uwsgi: yes
# varnish: yes
# w1sensor: yes
# zscores: no
# temperature: yes
But nothing happens after reboot.
Could you tell me please, what I do wrong?
Tom