Ad Widget

Collapse

Creating a percentage based off of a pools total dataset storage?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DoItAgainSteelyDan
    Junior Member
    • Mar 2025
    • 21

    #1

    Creating a percentage based off of a pools total dataset storage?

    Hello,

    I am trying to create an item and trigger inside Zabbix (7.2 version, but would like it to work 6.0+)

    Click image for larger version

Name:	image.png
Views:	117
Size:	12.5 KB
ID:	501522Click image for larger version

Name:	image.png
Views:	58
Size:	6.8 KB
ID:	501524
    (As we can see they are not reflecting total amount used 2.46gb)

    zfs.test.avail.bytes and zfs.test.used.bytes, I was able to get their OIDs using "snmpwalk -v2c -c public truenas-ip"

    Click image for larger version

Name:	image.png
Views:	58
Size:	26.1 KB
ID:	501523

    I want this percentage to reflect in Zabbix from TrueNAS using zfs.test.avail.bytes and zfs.test.used.bytes. I want a trigger in place that says when it is above >X%

    I thought this would work:

    100 * last("zfs.test.used.bytes") / (last("zfs.test.used.bytes") + last("zfs.test.avail.bytes"))


    But I am getting bad output.

    Click image for larger version

Name:	image.png
Views:	59
Size:	63.2 KB
ID:	501526

    Goal:

    Monitor storage pools, when datasets make the pool full an item in zabbix will make a trigger go off saying it is above >X%​​
    Attached Files
  • salavie
    Junior Member
    • Oct 2020
    • 29

    #2
    100 * last(//zfs.test.used.bytes) / (last(//zfs.test.used.bytes) + last(//zfs.test.avail.bytes))

    Comment

    • DoItAgainSteelyDan
      Junior Member
      • Mar 2025
      • 21

      #3
      Thanks, this worked. Any tips for remembering how to do syntax correctly?

      Comment

      • DoItAgainSteelyDan
        Junior Member
        • Mar 2025
        • 21

        #4
        Also, I'm trying to monitor the total percentage used for a pool, meaning total data within the datasets combined for total sum.
        I'm getting an offset on the calculations, in TrueNAS it will be at 94% storage used, while in Zabbix it is around 91%~. how am I able to monitor the raw data that TrueNAS is showing in its dashboard to show in the Zabbix Dashboard.

        Examples:

        Click image for larger version  Name:	image.png Views:	0 Size:	33.7 KB ID:	501664Click image for larger version  Name:	image.png Views:	0 Size:	8.6 KB ID:	501665

        It's two 15GiB hard drives in mirror mode. It reflects as 12.5GiB in Zabbix. I assume that it is not taking into consideration the partition data or metadeta?

        Thank you for the help

        Comment

        • salavie
          Junior Member
          • Oct 2020
          • 29

          #5
          Calculated items



          I don't know about nas

          Comment

          • Brambo
            Senior Member
            • Jul 2023
            • 245

            #6
            Originally posted by DoItAgainSteelyDan
            Also, I'm trying to monitor the total percentage used for a pool, meaning total data within the datasets combined for total sum.
            I'm getting an offset on the calculations, in TrueNAS it will be at 94% storage used, while in Zabbix it is around 91%~. how am I able to monitor the raw data that TrueNAS is showing in its dashboard to show in the Zabbix Dashboard.

            Examples:

            Click image for larger version Name:	image.png Views:	0 Size:	33.7 KB ID:	501664Click image for larger version Name:	image.png Views:	0 Size:	8.6 KB ID:	501665

            It's two 15GiB hard drives in mirror mode. It reflects as 12.5GiB in Zabbix. I assume that it is not taking into consideration the partition data or metadeta?

            Thank you for the help
            The difference could be GB vs GiB. To know that for sure look at the raw values and do some /1000 vs /1024 on those values and compare it with your expected result. If Zabbix gets the wrong data presented then Zabbix isn't the issue but maybe you can fix it with a pre-processing step for correction.

            Comment

            • DoItAgainSteelyDan
              Junior Member
              • Mar 2025
              • 21

              #7
              Originally posted by Brambo

              The difference could be GB vs GiB. To know that for sure look at the raw values and do some /1000 vs /1024 on those values and compare it with your expected result. If Zabbix gets the wrong data presented then Zabbix isn't the issue but maybe you can fix it with a pre-processing step for correction.
              I've figured out a way to monitor the pools storage percentage, it reflects the number in TrueNAS.



              One of the roadblocks were the percentages were off. I learned it's because TrueNAS reports in GiB and Zabbix reports in GB. There is a difference in byte size.



              The expression is



              ((last(//truenas.zpool.used[tank]) / last(//truenas.zpool.size.total[tank])) * 100) * 1.032967



              which calculates a ZFS pool usage percent and applies a coorection factor (1.032967 offset to fix the difference in byte size converting from GiB to GB. )



              It will monitor and update the pools storage percentage, however I noticed that if I delete data out of an SMB, the storage doesn't change right away. If there are snapshots with the deleted data, then it still reflects in both TrueNAS and Zabbix as the last known highest percentage. Scrubbing the pool did not seem to update this, it was only until I deleted the snapshots with the data on them would the storage percentage go back down in TrueNAS/Zabbix.

              Why is this? Is there anyway to show it without having to delete snapshots? Maybe more of a TrueNAS forums question.

              Thank you.









              Comment

              Working...