Help with calculation with an SNMP sensor for free disk space

Hello,
I want to monitor the free disk space from my Open Media Vault Hard Disk, but I´m not good with that calculating syntax.
The goal is to display the sensor result in GB. Below is the code, which of course don´t work, as I would be grateful for the code on how I can realize it.

II guess it must be something like “total space - used space / 1073741824 = free space in gigabytes”, if I´m not mistaken?

Many thanks,
Philipp

  - platform: snmp
    name: omvfreespace
    host: 192.168.1.81
    baseoid: 1.3.6.1.2.1.25.2.3.1.5.77
    unit_of_measurement: GB
    accept_errors: true
    value_template: '{{1967925760000 - ((value) * 4096)) / 1073741824 }}'

try

    value_template: '{{ (1967925760000 - value | int * 4096) / 1073741824 }}'

hm, with this code I get a result of 0.0 GB, although there are 37 GB free on the volume

Forget it. I´m such a moron. there was a typing error in the OID path. In this case i had calculated the total size - total size, which is indeed 0. :laughing:

Thanks for the help!

1 Like