Sennevds / system_sensors

Logging of system sensor specific for the RPI and sending them to a MQTT broker
MIT License
361 stars 112 forks source link

system.sensors.service Fails to Start - TLS error #172

Closed mdisabato closed 7 months ago

mdisabato commented 7 months ago

When attempting to start the service, the following results:

× system.sensors.service - Python based System Sensor Service for MQTT Loaded: loaded (/etc/systemd/system/system.sensors.service; enabled; preset: enabled) Active: failed (Result: exit-code) since Mon 2024-01-29 17:18:28 GMT; 5s ago Duration: 391ms Process: 853107 ExecStart=/home/runewalker/system_sensors/system_sensors_venv/bin/python3 /home/runewalker/system_sensors/src/system_sensors.py> Main PID: 853107 (code=exited, status=1/FAILURE) CPU: 389ms

Jan 29 17:18:27 pixie systemd[1]: Started system.sensors.service - Python based System Sensor Service for MQTT. Jan 29 17:18:28 pixie python3[853107]: Unable to import apt package. Available updates will not be shown. Jan 29 17:18:28 pixie python3[853107]: Traceback (most recent call last): Jan 29 17:18:28 pixie python3[853107]: File "/home/runewalker/system_sensors/src/system_sensors.py", line 259, in Jan 29 17:18:28 pixie python3[853107]: if 'ca_certs' in settings['tls']: Jan 29 17:18:28 pixie python3[853107]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Jan 29 17:18:28 pixie python3[853107]: TypeError: argument of type 'NoneType' is not iterable Jan 29 17:18:28 pixie systemd[1]: system.sensors.service: Main process exited, code=exited, status=1/FAILURE Jan 29 17:18:28 pixie systemd[1]: system.sensors.service: Failed with result 'exit-code'.

Config File:

mqtt: hostname: 10.1.10.181 port: 1883

user:

password:

tls:

ca_certs

certfile

keyfile

deviceName: pixie client_id: pixie

I am not using TLS or other certificates as both machines are on the same network.

Thank you.

Sennevds commented 7 months ago

Just remove the tls part in your settings

mdisabato commented 7 months ago

After doing that, I received pretty much the same thing:

× system.sensors.service - Python based System Sensor Service for MQTT Loaded: loaded (/etc/systemd/system/system.sensors.service; enabled; preset: enabled) Active: failed (Result: exit-code) since Mon 2024-01-29 20:54:04 GMT; 4s ago Duration: 393ms Process: 866457 ExecStart=/home/runewalker/system_sensors/system_sensors_venv/bin/python3 /home/runewalker/system_sensors/src/system_sensors.py> Main PID: 866457 (code=exited, status=1/FAILURE) CPU: 390ms

Jan 29 20:54:03 pixie systemd[1]: Started system.sensors.service - Python based System Sensor Service for MQTT. Jan 29 20:54:04 pixie python3[866457]: Unable to import apt package. Available updates will not be shown. Jan 29 20:54:04 pixie python3[866457]: Traceback (most recent call last): Jan 29 20:54:04 pixie python3[866457]: File "/home/runewalker/system_sensors/src/system_sensors.py", line 259, in Jan 29 20:54:04 pixie python3[866457]: if 'ca_certs' in settings['tls']: Jan 29 20:54:04 pixie python3[866457]: ~~~~^^^^^^^ Jan 29 20:54:04 pixie python3[866457]: KeyError: 'tls' Jan 29 20:54:04 pixie systemd[1]: system.sensors.service: Main process exited, code=exited, status=1/FAILURE Jan 29 20:54:04 pixie systemd[1]: system.sensors.service: Failed with result 'exit-code'.

BartGysens commented 7 months ago

Having the same problem, after removeing 'tls:' - I get "KeyError: 'tls'"

Sennevds commented 7 months ago

Okay I just saw the issue. I've made some changes. Could you try again (without tls in config)

BartGysens commented 7 months ago

It works - FIXED!

Tip: change the rule TX maybe in something more compatible (this generated a new error) > it works with the adjustment below:

"net_tx: true # "enp1s0" # true for all interfaces, otherwise the name of the interface"

Thank you @Sennevds - great work!

mdisabato commented 7 months ago

That fixed it. I have documented how I reinstalled and started this and will post it to the forum.

Thank you @Sennevds - Now I can finally migrate from Glances. It's a good package, but way overkill for what I need.

:)