diff --git a/src/config.py.example b/src/config.py.example index 29018b5..55a12fc 100644 --- a/src/config.py.example +++ b/src/config.py.example @@ -26,6 +26,7 @@ sleep_time = 0.5 cpu_load = True cpu_temp = True used_space = True +used_space_path = '/mnt' voltage = True sys_clock_speed = True swap = True diff --git a/src/rpi-cpu2mqtt.py b/src/rpi-cpu2mqtt.py index 4f4bea4..18ee2b5 100644 --- a/src/rpi-cpu2mqtt.py +++ b/src/rpi-cpu2mqtt.py @@ -301,13 +301,16 @@ if __name__ == '__main__': # delay the execution of the script time.sleep(config.random_delay) + if hasattr(config, 'used_space_path'): used_space_path = config.used_space_path + else: used_space_path = '/' + print(used_space_path) # collect the monitored values if config.cpu_load: cpu_load = check_cpu_load() if config.cpu_temp: cpu_temp = check_cpu_temp() if config.used_space: - used_space = check_used_space('/') + used_space = check_used_space(used_space_path) if config.voltage: voltage = check_voltage() if config.sys_clock_speed: