Page 1 of 1

Monitor disk space from other Raspberry Pi in Domoticz

Posted: Wednesday 04 January 2017 12:39
by Goudtik
A noob question.....

I am running Domoticz on my Raspberry Pi (Raspbian) and would like to monitor the disc-space (percentage) of another RPI (also running Raspbian).
I would like to monitor a harddisk (/dev/sda1 mounted on /media/pi/Security). Both of the devices are running in the same network.

I found some info on how to monitor this kind of info on a NAS but I can't seem to use this in this scenario? Could someone give me some help? I would really appreciate it! :D

Re: Monitor disk space from other Raspberry Pi in Domoticz

Posted: Wednesday 04 January 2017 13:00
by jannl
With a json call (in a script using curl for instance) you could enter it in Domoticz, you can install a slave Domoticz on the second pi.

Re: Monitor disk space from other Raspberry Pi in Domoticz

Posted: Wednesday 04 January 2017 17:00
by Egregius
I would use a cron job on the seond pi that runs a shell script to grab hdd usage and push it to domoticz. Or even better, send a telegram if space is to low instead of bothering domoticz with that.

Re: Monitor disk space from other Raspberry Pi in Domoticz

Posted: Wednesday 04 January 2017 17:22
by Egregius
Actually a good idea to set it up that way:

Code: Select all

#!/bin/sh
df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output;
do
  echo $output
  usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1  )
  partition=$(echo $output | awk '{ print $2 }' )
  if [ $usep -ge 80 ]; then
    msg="Running out of space \"$partition ($usep%)\" on $(hostname)"
    curl -s --connect-timeout 2 --max-time 5 --data-urlencode "text=$msg" --data "silent=false" http://192.168.2.10/secure/telegram.php
  fi
done
Added to cron to run daily...