ironsheep / RPi-Reporter-MQTT2HA-Daemon

Linux service to collect and transfer Raspberry Pi data via MQTT to Home Assistant (for RPi Monitoring)
GNU General Public License v3.0
442 stars 62 forks source link

Add monitoring tempfs partitions (drives section) #90

Open estegewr opened 1 year ago

estegewr commented 1 year ago

Is your feature request related to a problem? Please describe. I use the fantastic rpi-monitor to track some RPIs. Problems of a monitored RPIs also show up by an untypical increase of logfile size. All my log files are stored in a tmpfs partition to reduce "physical" read-write accesses. Unofrtunately, tmpfs partitions are not listed under drives section.

Describe the solution you'd like Add tmpfs partitions in monitoring (drives section).

Additional context

df -h
tmpfs           400M   43M  358M  11% /var/log
/dev/loop1       54M   54M     0 100% /snap/core20/1825

/snap/core20/1825 is reported via MQTT by rpi-monitor, but /var/log not.

ironsheep commented 1 year ago

@estegewr Would you be willing to provide example commands for how you set this up? I can then replicate what you are doing and maybe adjust my scripts to see these partitions.

estegewr commented 1 year ago

@estegewr Would you be willing to provide example commands for how you set this up? I can then replicate what you are doing and maybe adjust my scripts to see these partitions.

Thanks, @ironsheep for your openness to implement this feature. To create a temporary filesystem e.g. for /var/log add them to your /etc/fstab file. See example below for a few directories:

tmpfs   /tmp        tmpfs   defaults,noatime,nosuid,size=150m       0 0
tmpfs   /var/tmp    tmpfs   defaults,noatime,nosuid,size=50m        0 0
tmpfs   /var/log    tmpfs   defaults,noatime,nosuid,mode=0755,size=400m 0 0
#tmpfs  /var/run    tmpfs   defaults,noatime,nosuid,mode=0755,size=2m   0 0

See also this out of many tutorials explaining the purpose and the procedure to create tempos for certain directories with files which get written repeatedly (and bringing a SD card to an increasing risk to fail).

bsimmo commented 1 year ago

As a side, in the article you can now do read only in Raspi-config. Another alternative is to reduce the logging in the first place and disable what you can, there was a recent post in RPi forum going through bits and bobs on this.