Sennevds / system_sensors

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

net_rx is always 0.0 #120

Closed mcrodrig closed 9 months ago

mcrodrig commented 2 years ago

Hi,

I noticed that net_rx is always 0.0 although I have data going through the net.

I'm running ubuntu 20.04 on raspberry pi 4b 8gb.

My configuration is as follows: sensors: temperature: true clock_speed: true disk_use: true memory_use: true cpu_usage: true load_1m: true load_5m: true load_15m: true net_tx: true net_rx: true swap_usage: true power_status: true last_boot: true hostname: true host_ip: true host_os: true host_arch: true last_message: true updates: true wifi_strength: false wifi_ssid: false

Is there anything wrong?

Thanks in advance

emigrating commented 2 years ago

I'm seeing the same behavior. It seems like it happens because PSUtil is being run twich in quick succession to get bytes out/in. I solved it by adding a time.sleep(2) between the two calls, but it''s far from ideal. I reckon it'd be better to run it once and return both values at once.