Open meerweten opened 4 years ago
The default configuration calculates free space by subtracting total from used. However the real available space for you is less due to the reserved filesystem blocks on ext4. (by default 5%). You can read more here https://unix.stackexchange.com/questions/7950/reserved-space-for-root-on-a-filesystem-why.
In order to account the real available space and utilization, you can create 2 new dynamic KPIs, to extract available space and % usage directly from "df -t ext4" output. Below is copy of my own configuration, you can adapt relevant parts to yours.
static.10.name=storage1_total
static.10.source=df -t ext4
static.10.regexp=sda1\s+(\d+)
static.10.postprocess=$1/1024
dynamic.16.name=storage1_available
dynamic.16.source=df -t ext4
dynamic.16.regexp=sda1\s+\d+\s+\d+\s+(\d+)
dynamic.16.postprocess=$1/1024
dynamic.16.rrd=GAUGE
dynamic.17.name=storage1_usedperc
dynamic.17.source=df -t ext4
dynamic.17.regexp=sda1\s+\d+\s+\d+\s+\d+\s+(\d+)
dynamic.17.postprocess=$1
dynamic.17.rrd=GAUGE
web.status.1.content.9.name=Storage
web.status.1.content.9.icon=usb_hdd.png
web.status.1.content.9.line.1="<b>/storage1</b> Available: <b>"+KMG(data.storage1_available,'M')+"</b> (Total: <b>"+ KMG(data.storage1_total,'M') +"</b>)"
web.status.1.content.9.line.2=ProgressBar(data.storage1_usedperc,100,80,95)
web.statistics.1.content.9.name=Storage1
web.statistics.1.content.9.graph.1=storage1_total
web.statistics.1.content.9.graph.2=storage1_available
web.statistics.1.content.9.ds_graph_options.storage1_total.label=Storage1 total space (MB)
web.statistics.1.content.9.ds_graph_options.storage1_total.color="#FF7777"
web.statistics.1.content.9.ds_graph_options.storage1_available.label=Storage1 available space (MB)
web.statistics.1.content.9.ds_graph_options.storage1_available.lines={ fill: true }
web.statistics.1.content.9.ds_graph_options.storage1_available.color="#7777FF"
So i run a df -h in terminal (as i was monitoring a data transfer from one disk to another) but i couldn't seem te get it working correctly in RPIMonitor, the free space is like double:
from df -h: ma apr 6 08:59:44 CEST 2020 /dev/sdc1 1,4T 1,2T 84G 94% /media/share temp=63.4'C
from RPIMonitor:
from windows (samba):
my storage code: `static.10.name=storage1_total static.10.source=df -t ext4 static.10.regexp=sdc1\s+(\d+) static.10.postprocess=$1/1024
static.11.name=storage2_total static.11.source=df -t fuseblk static.11.regexp=sdb1\s+(\d+) static.11.postprocess=$1/1024
dynamic.14.name=storage1_used dynamic.14.source=df -t ext4 dynamic.14.regexp=sdc1\s+\d+\s+(\d+) dynamic.14.postprocess=$1/1024 dynamic.14.rrd=GAUGE dynamic.14.default=10
dynamic.15.name=storage2_used dynamic.15.source=df -t fuseblk dynamic.15.regexp=sdb1\s+\d+\s+(\d+) dynamic.15.postprocess=$1/1024 dynamic.15.rrd=GAUGE dynamic.15.default=10
web.status.1.content.9.name=Storage web.status.1.content.9.icon=usb_hdd.png web.status.1.content.9.line.1="/Data Share Used: "+KMG(data.storage1_used,'M')+" ("+Percent(data.storage1_used,data.storage1_total,'M')+") Free: "+KMG(data.storage1_total-data.storage1_used,'M')+ " Total: "+ KMG(data.storage1_total,'M') +"" web.status.1.content.9.line.2=ProgressBar(data.storage1_used,data.storage1_total) web.status.1.content.9.line.3="/storage2 Used: "+KMG(data.storage2_used,'M')+" ("+Percent(data.storage2_used,data.storage2_total,'M')+") Free: "+KMG(data.storage2_total-data.storage2_used,'M')+ " Total: "+ KMG(data.storage2_total,'M') +"" web.status.1.content.9.line.4=ProgressBar(data.storage2_used,data.storage2_total)
web.statistics.1.content.9.name=Storage1 web.statistics.1.content.9.graph.1=storage1_total web.statistics.1.content.9.graph.2=storage1_used web.statistics.1.content.9.ds_graph_options.storage1_total.label=Storage1 total space (MB) web.statistics.1.content.9.ds_graph_options.storage1_total.color="#FF7777" web.statistics.1.content.9.ds_graph_options.storage1_used.label=Storage1 used space (MB) web.statistics.1.content.9.ds_graph_options.storage1_used.lines={ fill: true } web.statistics.1.content.9.ds_graph_options.storage1_used.color="#7777FF"
web.statistics.1.content.10.name=Storage2 web.statistics.1.content.10.graph.1=storage2_total web.statistics.1.content.10.graph.2=storage2_used web.statistics.1.content.10.ds_graph_options.storage2_total.label=Storage2 total space (MB) web.statistics.1.content.10.ds_graph_options.storage2_total.color="#FF7777" web.statistics.1.content.10.ds_graph_options.storage2_used.label=Storage2 used space (MB) web.statistics.1.content.10.ds_graph_options.storage2_used.lines={ fill: true } web.statistics.1.content.10.ds_graph_options.storage2_used.color="#7777FF" `