I’d take a different approach:
Use a bash script which reads the input from df
, greps for the line and updates some items via the REST api:
#!/bin/bash
numbers=$(df | grep '/dev/mmcblk1' | grep -E -o "[0-9]+")
number_of_blocks=$(echo $numbers | cut -d" " -f1)
used=$(echo $numbers | cut -d" " -f2)
available=$(echo $numbers | cut -d" " -f3)
used_percent=$(echo $numbers | cut -d" " -f4)
#and then Update the items
curl -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "$state" "http://$OHIP:8080/rest/items/$item/state"
then add the script to a crontab with crontab -e
so the measurements get updated frequently