Monitor disk space from other Raspberry Pi in Domoticz

Moderator: leecollings

Post Reply
Goudtik
Posts: 5
Joined: Friday 23 December 2016 14:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Monitor disk space from other Raspberry Pi in Domoticz

Post 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
jannl
Posts: 673
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: Monitor disk space from other Raspberry Pi in Domoticz

Post 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.
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Monitor disk space from other Raspberry Pi in Domoticz

Post 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.
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Monitor disk space from other Raspberry Pi in Domoticz

Post 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...
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest