Feature Request: support RAID for TrueNAS widget pool metrics #3493
Replies: 18 comments 36 replies
-
Thanks for posting a discussion about homepage here on GitHub. Homepage now uses a fancy new AI tool thanks to our friends at Glime, so the answer below is the AI bot's attempt to answer your question. If you feel it's sufficient you can mark the answer and close this post, otherwise feel free to leave it open of course! Thanks for using Homepage! ❤️ Hello, Based on the information provided, it seems that you have already configured the TrueNAS widget correctly with the However, there are a few things we can check to troubleshoot the issue:
If after checking these points the issue persists, it might be a bug on Homepage's end or an incompatibility with the latest TrueNAS SCALE version. In that case, I would recommend reporting the issue on the Homepage GitHub repository, providing all the details and screenshots you've shared here. If you need further assistance, please let me know! This comment was generated by Glime. |
Beta Was this translation helpful? Give feedback.
-
Could someone help me figure this out, please? |
Beta Was this translation helpful? Give feedback.
-
can back this up. have the same problem |
Beta Was this translation helpful? Give feedback.
-
I found something even better. However my javascript and my understandig of this service are not good enough to implement it cleanly: you can get the name and the health status of all pools like it's done now. however you can then send a second api request to note: the api values are in bit. so maybe a conversion would be good I can recommend trying the following curl command:
this will return only the needed values for the pool size of that id |
Beta Was this translation helpful? Give feedback.
-
Having this issue as well. |
Beta Was this translation helpful? Give feedback.
-
I have the same issue and I have a stripe pool.. and even if I add the reported disk sizes it's still off by 200GB |
Beta Was this translation helpful? Give feedback.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
-
Has there been able to be any more progress on this? |
Beta Was this translation helpful? Give feedback.
-
I want to take a moment to share my understanding of TrueNAS, which may help with this issue. Disclaimer: I am not affiliated with TrueNAS, nor am I an expert with TrueNAS; this is just my understanding. I believe /api/v2.0/pool is analogous to "zpool list", which provides a list of the pools. These numbers are in TiB units; they are based on raw disk size and do not take into account mirroring, RAID, etc. In the example below, I have 16 2TB drives, so SIZE = 16 * 2TB = 32TB; 32TB * 1000^4 / 1024^4 = 29TiB
I believe /api/v2.0/pool/dataset is analogous to "zfs list", which provides a list of the datasets. These numbers are also in TiB units; but they are based on actual usable disk space (i.e., with mirroring, RAID, etc. taken into consideration).
I haven't done programming in years so I can't assist with that, but I think you can get the info you need via /api/v2.0/pool/dataset. Ignore everything except the top-level datasets (i.e., the ones that don't have slashes in them). Take the "used" and "available" raw values for the top-level datasets, then do the GiB calculation so you can display it however you want (e.g., 12T, 11.7T, 11.70T, etc.) rather than relying on the TrueNAS pre-formatted values. Size = Used + Available.
In the little bit of testing I did, the API numbers match the numbers from the "zfs list" command which match the numbers on the TrueNAS Dashboard. In my opinion, the dataset values would be far more useful on HomePage than the pool numbers that are currently being displayed, In my case HomePage gives the appearance that I have 13.7TB free, when in reality I only have 8.66T free due to RAID. I would also recommend using the XiB units rather than XB units so that it aligns with the way TrueNAS displays it. Personally, I'd prefer to see Available / Total (xx%) rather than Used / Total (xx%); it saves me from doing the math to find out how much space I have left, which is the number that I really care about. Also, as a side note, ZFS RAIDZ# is not RAID-# (e.g., ZFS RAIDZ1 is not RAID-5). Functionally they are similar (e.g., both ZFS RAIDZ1 and RAID-5 can survive the loss of a single drive), however ZFS uses a more complex method of handling the parity bits. Because of this, you can't do the calculation by simply looking at the number of drives and the RAID configuration, then subtracting the appropriate number of parity drives from the total; it doesn't work that way with ZFS. |
Beta Was this translation helpful? Give feedback.
-
First, a quick heads up regarding some info I ran across while digging into this. TrueNAS Core is currently at v13.3; TrueNAS Scale is currently at v24.10. Documentation for both products can be found on the TrueNAS Documentation Hub at https://www.truenas.com/docs/. If you expand the "TrueNAS" section of the Documentation Hub, you can find documentation for various versions, and under each version is an associated API section. Starting with v24.10 (and including development v25.04), there is a REST API Deprecation Notice dated 11/15/2024: The TrueNAS REST API is deprecated in TrueNAS 25.04 and replaced by the TrueNAS Websocket client. Full removal of the REST API is planned for a future release. This new API Client is not the deprecated TrueNAS CLI (midcli). The API Client is integrated in TrueNAS 25.04 onwards. It provides the midclt command-line tool, and the means to easily communicate with middleware using Python to make calls through the Websocket API. This API client allows for better integration of TrueNAS into third-party solutions. Use this as a reference for projects that require direct TrueNAS integration. TrueNAS API documentation remains available in the UI and through the TrueNAS Documentation Hub. This is a bit over my head, and I don't know if you're using REST or Websocket, but this might be something you want to take into consideration as it looks like the future direction for TrueNAS API access. There are query-filters and query-options features that might make retrieval of the information needed easier and quicker, but they are only available via Websocket, not via REST. In particular, query-options.extra.flat provides a hierarchical response where only the top level datasets are returned in the list. From the API documentation for pool/dataset: At present, via REST, the flat structure looks like this (I have stripped out most of the data so you can see the overall structure: p01 is the pool
As you can see, each dataset is listed as a separate object, and each object also contains all of the data for it's children, so there is a lot of repetitious data, thus it's slower. I have around 30 datasets and my /api/v2.0/pool/dataset response is 32k+ lines (665 KB). Unfortunately without using Websocket, I don't think there is a way to retrieve the data needed in a more streamlined way (i.e., with the aid of query-options.extra.flat). So, continuing with REST, you're basically looking for the top level pool "id"s (i.e., the ones that don't have any slashes in them) such as The original JSON was produced by curl -s -X GET -H "Authorization: Bearer 1-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" "https://(IPADDRESS)/api/v2.0/pool/dataset" This is the beginning of the JSON output, which starts with p01, the first of two pools. This shows the iocage dataset on p01. This shows p02, the second pool. To make it valid JSON, get rid of that last comma and add a closing brace ( ] ) instead. You just need the "id", "used" and "available" raw values from the top level pool ids; size=used+available. In theory, you could provide monitoring per-dataset if you wanted. The "used" value for each dataset includes the dataset itself plus all of it's children. "Available" is provided for each dataset, but it will be the same for all datasets on a given pool unless per-dataset quotas are in effect. I only use quotas on a couple of datasets so this isn't a huge need for me, but others may find it helpful. Regardless, you'll always ignore the children and just look for the top level datasets as each dataset will have a top level object in the JSON. |
Beta Was this translation helpful? Give feedback.
-
I figured it was quicker to spin up a VM with TrueNAS than to read through 32k lines of JSON and potentially miss something that should have been redacted, so... Here is the API output from /api/v2.0/pool/dataset from a new TrueNAS server. The server has two pools, pool1 and pool2. Each pool has a single dataset, dataset1 on pool1 and dataset2 on pool2. curl -s -X GET -H "Authorization: Bearer 1-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" "http://(IPADDRESS)/api/v2.0/pool/dataset" |
Beta Was this translation helpful? Give feedback.
-
I copied my existing homepage data to a new homepage-test and created a new container for it. That worked fine, so I changed the tag to grab the new version. Now I get this when I try to open homepage. Tried clearing browser cache. Did I miss something to cause this? Something went wrong.
|
Beta Was this translation helpful? Give feedback.
-
Ok. Don't know if I'll get to it tonight. Also, I'm spinning up a TrueNAS Scale so I should be able to test both platforms. |
Beta Was this translation helpful? Give feedback.
-
That fixed the semver issue. Thanks! I'm seeing something odd that doesn't make sense to me. The Used, Total, and Percentages for zfs list, the API output, and Homepage are matching for both Core and Scale, except for one: The Total (and thus the %) for the first pool on TrueNAS Core does not match, and I cannot seem to figure out where Homepage is getting the Total for the first pool from; it doesn't seem to match anything. On my test server, it should be 15.9GB according to zfs list and /api/v2.0/pool/dataset, but Homepage is saying 28.5GB. What's wierd is that the total for the second pool on Core is correct, and the totals for both pools on Scale are correct. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
The new version (tag = feature-truenas-dataset-3493) looks good on my test and production TrueNAS systems. Can OP confirm? The only other suggestion I have on this would be to display Available / Total rather than Used / Total. TrueNAS Core UI displays available space; TrueNAS Scale UI displays both used and available. Both display the percentage as %Used. I suspect that is because performance can start to degrade once you reach 80% Used so TrueNAS wants you to see that percentage. For me, when I glance at status screens like Homepage, seeing how much space I have remaining (i.e. Available) is more useful than knowing how much I've used. Pool sizes can vary, but empty is always zero, so the closer Available gets to zero, the more urgent doing something becomes vs having to look at Used vs Total to make that determination. The Used percentage is helpful, but it's relative based on the size of the pool (e.g., a large pool could be 90% Used but still have 10s of TiB available). Just my opinion, but I'd be interested in hearing others' perspectives on this. I supposed you could display both as TrueNAS Scale is doing, but I think that adds clutter, and with long pool names it could cause display issues with the limited amount of space available in the widget. |
Beta Was this translation helpful? Give feedback.
-
Agreed. Sorry, I didn't mean to introduce scope creep. I believe the issue at hand has been resolved pending confirmation by others. If Available vs Used is something folks would like to see changed, I'd suggest we submit it as a feature request for implementation when priorities allow. |
Beta Was this translation helpful? Give feedback.
-
Description
Hello,
I noticed that the TrueNAS widget is not reporting the size and used space of my pools correctly. Here's what I have in Homepage:
And here are snapshots of the two pools from within TrueNAS's interface:
My
settings.yaml
contains this:and I'm running TrueNAS-SCALE-23.10.0.1.
Do you know if this is caused by their API or is it a bug on Homepage's end?
Thanks!
homepage version
v0.8.13 (986a181, May 6, 2024)
Installation method
Docker
Configuration
No response
Container Logs
No response
Browser Logs
No response
Troubleshooting
N/A
Beta Was this translation helpful? Give feedback.
All reactions