Description
Background
When I initially started working on the health monitor for update, we landed on a design for the inventory API where each sled agent had a designated health-monitor object which would contain different health checks. Each health check is done asynchronously every minute as a background job:
$ curl -H "api-version: 16.0.0" http://[::1]:41364/inventory | jq
<...>
"health_monitor": {
"smf_services_in_maintenance": {
"ok": {
"services": [
{
"fmri": "svc:/site/fake-service2:default",
"zone": "global"
},
{
"fmri": "svc:/site/fake-service:default",
"zone": "global"
}
],
"errors": [],
"time_of_status": "2026-01-19T06:03:13.713176608Z"
}
},
"unhealthy_zpools": {
"ok": {
"zpools": [
{
"zpool": "fakepool1",
"state": "degraded"
},
{
"zpool": "fakepool2",
"state": "degraded"
}
],
"errors": [],
"time_of_status": "2026-01-19T06:03:13.690492960Z"
}
}
}
<More health checks>
}This approach made sense from a usability standpoint for a few reasons:
- All health check data is contained in one place and with a clear purpose, which makes it easy for consumers to ingest.
- Empty health check lists mean all components checked are healthy based on the parameters we have, so it's very easy to deduct whether there is a problem or not.
Unfortunately, there are a few issues with this approach:
- For some components that will be checked for health, we are already collecting data, like zpools in the reconciler. This is a problem. For example, the health monitor could end up reporting on different zpools than the reconciler. The reconciler reports data on demand, whereas the health monitor polls every minute.
- Not all health checks will be run on a "per sled" basis, like stale sagas. Having a single health monitor object per sled would be confusing and impractical.
- Some health checks report on the state of some component that is reported by itself, like services in maintenance or zpool health, but others will be determined by self imposed thresholds like stale sagas, dataset usage etc. Having all of the health checks lumped in a "health-monitor" would not make these nuances obvious.
Proposal
Instead of having a single health-monitor object per sled, add additional health status/information to every component or create a new entry for components that aren't listed yet. This approach will also allow new components that have no data recorded in inventory yet, to contain more information than just health.
Taking SMF services as an example, with the current approach, we only list services in maintenance. Only listing services in maintenance could prove to be insufficient information to gauge a system's health (e.g. #9855 (comment)), we would have more information to go on by.
In addition to health information/status, each item should have a timestamp of when the sample was taken. This will help with accuracy and avoid relying on assumptions.
It will be the job of the consumer to decide whether a status meets the criteria of a failed health check or not.
I have also assessed the current manual health check script, and have a list of what health status information we'll want to include. It'd be great to have input from others on this:
| Health check | Scope | Necessary? |
|---|---|---|
| Uptime | per sled | no |
| Kernel low memory scan | per sled | maybe? Would need to have a threshold to compare the result against. May need to run the command on a loop for a bit as well. |
| SMF service health | per sled/zone | yes - priority |
| Core file or kernel core file | per sled | no, There could be leftover core files that don’t mean anything |
| NVME firmware version | per sled | possibly necessary, but not urgent |
| expected physical disk count | per sled | yes |
| zpool health | per sled | yes- priority |
| unmounted dataset | per sled | yes. Will need to make sure the datasets are ones that matter (e.g. not support bundles) |
| expected crucible zone count | per rack | yes |
| dataset usage over 80% of quota or root dataset with <150 GiB avail |
per sled | yes |
| crucible free space when total capacity minus total used < 5TiB |
per rack | yes |
| dimm expected memory (1 or 2 TB) | per rack | yes |
| missing sleds | per rack | yes - priority |
| missing components for MGS driven updates |
per rack | yes |
| stale sagas - not on the script but we want to add this check |
per rack | yes - priority |
Open questions
To avoid triggering a bunch of expensive calls when an inventory collection is created, @jgallagher suggested we use the intermittent polling background tasks in the existing health monitor. This could also have the unintended consequence of data being older than the inventory collection itself. Is this acceptable? How would this impact the reconciler?
Activity
karencfv commentedon Feb 18, 2026
Would love to have feedback from @davepacheco @jgallagher @smklein @andrewjstone and anyone else interested in the topic!
davepacheco commentedon Feb 18, 2026
Thanks @karencfv. I think we're on the same page about this. To play it back:
health_monitorcontainer to where the zpools are already (elsewhere in the inventory structure).I misread this a few times. I think what you're saying is: assuming there's some new hardware or software component that we want to add health information for, the design pattern is to add a set of records about it to the top level of the sled agent inventory rather than grouping health-only information under a
health_monitorcontainer. That seems fine. But I can't tell if you're also saying that if we're going to do this, we should list all instances of the component along their health (e.g., all SMF services, not just those in maintenance). I wouldn't go that far. In the case of SMF services: I wouldn't include all the healthy instances. There are quite a lot of them and most of their information isn't relevant to the control plane unless they're unhealthy.I gather you're trying to create a general rule that we can follow as we add more of these. I'd recommend against trying to generalize more than we need to right now. I don't think we have enough information about our future needs to know what's going to work. But that's okay because we can also change all of this pretty easily later (merge conflicts aside 😬). In the long-term, health monitoring is the responsibility of the fault management subsystem and that project may have different approaches for collecting this information. For example, your entry for "crucible free space when total capacity minus total used < 5TiB" -- that could also be implemented by reporting usage to Oximeter and having FM monitor metric data from Clickhouse. In that case, effort we spend here trying to incorporate that into inventory would be a waste. I think if we know how we're expressing SMF service health and zpool health in the per-sled inventory structure, we're good for now.
Thinking out loud a bit: I'd say the only constraint here is that making multiple concurrent requests for inventory must not spawn multiple processes collecting the same information concurrently. You shouldn't be able to cause sled agent to fork a thousand of these concurrently by making the request a thousand times concurrently.
That aside, there are pros and cons of doing the work inline with the request:
Yet another option here would be to have a mechanism that forks off a command to collect this data, but ensures that (1) no more of these commands is ever outstanding at a time and (2) the consumer always gets results from a collection that started after their request was made. The Nexus background task subsystem looks like this. Something like this:
zpool listZ1zpool lists are kicked off until another request comes in.I may well be overthinking this and am happy to discuss further.
I think there are two principles in tension here:
[-]Rrestructure of update health monitor inventory representation[/-][+]Restructure of update health monitor inventory representation[/+]karencfv commentedon Feb 19, 2026
Eek! Looks like I forgot to add stale sagas to that list (#9412). I only added what was in the script, I'll fix.
Reading this back again I can see that it's just bad English on my part 😄 Yeah, what you understood is what I meant. I agree that listing all SMF services is overkill, what I meant is that we could have more information about each SMF service than just it's health/zone this way. I do want to clear up what unhealthy means in the context of SMF services though. In #9855 (comment) Alan was able to see something was wrong by services that were offline. If we stick to just listing SMF services in maintenance then a scenario like what Alan encountered would have been marked as healthy. Perhaps we list all "oxide" SMF services? That seems like too much. Or perhaps list all services that are not "online"? I'm not sure here tbh.
I do believe that the level of detail or number of components listed should be on a case by case basis.
Yeah, fair. My main point was about just adding general information to a higher level object rather than having a dedicated health monitor object, I might have got carried away.
In this case what I assumed we'd do is only report crucible's free/used space. The consumer would take that information and make a decision (is it less than 5 TiB?) on whether it was enough free space to mark the rack as healthy or not. But yeah, this item is not on the priority list so we can punt on this anyway.
In this scenario, the correct approach would be to use this mechanism for every inline request triggered by an inventory collection yes? At this point, it kind of feels like a task that is not necessarily part of the health monitoring project but rather a refactoring of inventory collection to make it more resilient?
That said, I do like your approach. I didn't entirely love the background tasks for all of inventory, but I couldn't articulate exactly why. Your pros and cons list made it a lot clearer.
Regarding the two principles in conflict, thinking about principle 1:
I don't think your proposal clashes with this principle entirely. The latest information available will always be the tiniest bit out of date by the time a consumer receives it. With your proposal we may be adding a little bit of time if a large amount of requests are triggered concurrently, but I don't think it will make much of a difference. In addition, with the timestamps, the consumer will know exactly how "out of date" these values are.
davepacheco commentedon Feb 24, 2026
👍 to most of that.
I expect we want to use the same criteria that SMF uses to determine whether the service shows up in
svcs -x. I suspect it's something like "inmaintenancestate or in stateofflinebut enabled". I'd take a look at whatsvcs -xdoes (let me know if you want help). Regardless, I don't think we want to limit it to "oxide" services nor include "oxide" services that are healthy.I'm not totally sure what you mean here. Yeah, the suggestion here is that in sled agent, when it receives an HTTP request to report its inventory: if the command already outstanding, it waits for it to finish. Regardless of whether it waited, it then forks off the command to fetch the information it needs and reports it. To be clear, this is all within sled agent. (I usually think of "inventory collection" as the Nexus side that's making these requests, so just being clear that that's not what we mean, right? That part is already resilient to sled agents that are failing or slow.)
If you're asking "is this refactor a blocker for the health checking work" -- I guess that depends on whether the changes we're already doing here increase the risk.
There's an important difference between:
Here's the example I have in my head: a client makes a change to the sled's disk config and then wants to fetch inventory and verify that the change has happened.
This client doesn't care about changes made to the config after its inventory request. But it does very much care that the information it got back actually reflects the change that it had made previously. With "approach 2", where the data is collected inline with the request, it's easy for the client to reason about things, and the reasoning matches intuition: if you collect the inventory after you make the change, then the inventory will reflect the change. With "approach 1", where the data was always collected before your request was even received, it's harder to reason about. You have to know to look at the timestamps, and as I write that, I realize that even that's fraught because distributed time is complicated.
Then there's the question of: what do you do if the inventory you got back doesn't reflect the change? You have to keep polling. How long? As long as whatever interval we've used for the background collection. That means the whole operation the client is doing could take as long as whatever this interval is. That usually sucks. So people usually wind up adding to these APIs switches to say
force_refresh=trueorinvalidate_cache=zpoolor whatever. This is maximally flexible, but it also tends to be a source of bugs. Now the request is sometimes fast and sometimes not, sometimes has the latest data and sometimes not, and operations can seem to work when they're working by accident (because they technically require aforce_refreshbut the intervals happen to work right most of the time).So why would you go with approach 1 at all? It better deals with data collection operations that are slow or even hang. Although it's not common, I've seen it a lot over the years. (
zfs listat least used to take several minutes with thousands of filesystems.svcs -Zhas to make RPC calls to configd in all of the zones on the system, and any of those being stuck will cause it to hang.zpool listcould take a minute if some disks are not responding due to failures.) The idea behind approach 1 is: these events can always happen, and when they do, we still want to be able to instantly see the latest information. Concretely: suppose thezpool listis taking 5 minutes. Approach 1 says you should still be able to runomdbto get the inventory from a sled, have it respond immediately (not block for 5 minutes), and the response should show that the latestzpool listis much older than expected (and maybe even show that it's been running for 5 minutes).I do waffle a bit on this but in my previous comment I was coming around to approach 2 just because it's so much simpler to think about and hard to introduce weird races. The runtime risk is real but maybe something that can be mitigated in other ways.
[inventory] Remove HealthMonitor type but keep health check (#9899)
karencfv commentedon Feb 25, 2026
Fair. I took a look at what the docs say for
svcs -x:It wasn't super clear what states that meant, so I set up a few fake services in my local machines and only the ones that were "offline", "maintenance" or "degraded" showed up. It seems reasonable to me to show services in this state. I presume we'll want to keep using
svcs -a -o state,fmri,zoneinstead ofsvcs -xbecause of how annoying it is to parse the response from that.Ahhh aha! Yup, I had been thinking of this in Nexus the whole time.
I didn't think of it so much as a blocker, but rather that we should not stop at just taking this approach for the calls related to health reporting. Also, that this work didn't necessarily have to be part of the "health monitor" work.
I agree that approach 2 is simpler to reason about, and it's easier to make assumptions about. I have a remaining concern though.
I remember when we talked about this at some point we said that if taking an inventory collection took longer than necessary we could always just get the latest one instead. The latest collection could be up to 10 minutes old if I remember correctly. In 10 minutes, there is a big chance the health status will be completely out of date. I wouldn't want to make decisions based off of an inventory collection that old. I'm guessing we could set a max threshold of how old the data is and if it's older that that report the system as unhealthy? Or try retrieving a new inventory collection a few times before reporting the system as unhealthy?
Something that I like about approach 1 is that you can make decisions about the validity of the data on a per-component level
jgallagher commentedon Feb 25, 2026
I don't think I'd frame this as a question about timeliness of inventory (at least not yet), because inventory is always out of date by the time you look at it. E.g., I'm not sure "10 minute old inventory" is noticeably worse than "3 minute old inventory" the majority of the time - either way lots of things may have changed.
Instead, I think I'd ask this from the point of view of the consumer of inventory. Who or what is making decisions based on it, and do they have enough information to make informed choices knowing that inventory is inherently stale? E.g. for the blueprint planner, I know we've talked about refusing to plan until the latest inventory is at least as new as the parent blueprint, because any older than that guarantees any changes made by that blueprint aren't yet reflected. But I'm not sure who/what is going to consume this health info. If it's solely for humans, at least at first, a timestamp seems like it could be sufficient - a human can decide whether they care that they're looking at N minute old info and wait for a newer one. If it's for support bundle inclusion, I don't think the time scale we're talking about here matters basically at all, because opening a support case, collecting a bundle, copying it off the rack, etc., is a lot longer time period than any timeouts we'd consider here.
karencfv commentedon Feb 26, 2026
The idea here would be that the consumer triggers an inventory collection to get the latest information. If it cannot fetch a new inventory for whatever reason (we'd probably have to have some sort of timeout here I guess), it would attempt to use the latest one. We'd probably have to have a threshold of how old we allow the inventory to be. Or perhaps just report that we were not able to retrieve the information within a time limit, and that itself is a problem?
We'll have 2 consumers:
jgallagher commentedon Feb 26, 2026
I'm 100% on board with this consumer (and IIUC it was the original motivator for this work, although I think it was phrased as something to check after an update completes to see if the system is still healthy, just like today support runs post-update health checks). I think a timestamp here is important to see how stale the information is, but I'm not sold we need a way to collect a new inventory. That would need to be asynchronous anyway, since inventory collection can take a long time (especially on an unhealthy system), which doesn't seem all that different from reporting the latest collection?
I'm a lot less sure about this one. Reconfigurator should already have safeties in place for any individual update step it's going to take - if this work would prevent it from doing something, that feels like a gap in the existing safeties?
Agreed but I'm a little confused - doesn't inventory already attach timestamps to everything it collects? (With the caveat that anything within an inventory collection that's reporting cached data should also include a timestamp of when that data was collected, as discussed above.)
davepacheco commentedon Feb 26, 2026
I was figuring we'd look at the source to see what it does. It looks like the
-xgets processed here:https://github.com/oxidecomputer/illumos-gate/blob/3e086896f3d0022ce65caf791d7bb173b82b4e45/usr/src/cmd/svc/svcs/svcs.c#L3808-L3811
which goes into:
https://github.com/oxidecomputer/illumos-gate/blob/stlouis/usr/src/cmd/svc/svcs/explain.c
which is a surprisingly complicated subsystem, though it also does a lot more than what we need here. I've only done a very cursory look so far and it may be more annoying than I'd hoped to work this out. There's some related-looking decision-making in
determine_causes()but it doesn't correspond with exactly what I'd expect. Then there'sdetermine_summary(), but that supports explaining services that don't have any problems, so it's hard to know which of those branches actually are problems.Going straight to
explain(), when not given any other arguments (i.e.,svcs -x), it basically walksg_causesand prints information for each one. I think that brings us back todetermine_causes()(which is the one that appends tog_causes). That includes the cases we expected: (1) explicitly in maintenance and (2) offline because some dependency is running, plus a bunch of other things:state) hasn't seen that yet?none(not sure what this one means)The first two seem easy to capture and worth including. Maybe we just want to grab everything that's enabled and whose state is not "online"?
In practice the way inventory gets used isn't straight-line code like this. Consumers don't try to collect inventory and if that fails then go back to an older one. Instead:
There are cases where something both kicks off a collection and consumes a collection but it's usually not straight-line code that does both. Instead, it's an RPW (or two), like Reconfigurator itself. The planner accepts the latest inventory (however old it is), maybe plans some stuff, the executor executes it, and that kicks off another collection.
It's a good call to focus on the specific consumers here:
In this situation, we always have to live with the staleness risk (i.e., that we collect inventory showing everything's fine, the user hits "start update", but something has already failed that we didn't take). That's fine. There is the question of: does some degree of staleness itself reflect a problem? I'd say so. If the last inventory collection is 30m old (just making up a number), that itself should constitute a health check failure.
The question we were trying to answer was: if
zpoolis slow or hanging, do we want these inventory requests to fail (time out) or return older data? I don't think it really matters that much here. If the requests fail, we'll wind up with an incomplete inventory, and that will be its own health check failure -- and that's correct because something is wrong that requires support attention ifzpool listis taking that long. If the requests return older data, that's also fine -- but then at the point where we generate a list of problems from the inventory, we'll want to explicitly check for how old thezpool listdata is and if it's too old, treat that as a problem even if the inventory collection is recent. This is the complexity I was mentioning above. My current feeling is it's not worth it but I continue to be ambivalent.I would say that at most, we would use this to block setting the target release when the system is unhealthy. I can see doing this, but I can also see needing to override it (maybe the fix for the health issue involves new software), which means more complexity. Let's defer this until we've got more operational experience.
Agreed. To be clear though I think there's always a timestamp, no matter which of these options we pick:
zpoollist always happens during the request. In this case, the only timestamps you need are the ones that already exist in the inventory collection (collection time start, collection time done, and there's also a timestamp associated with when the individual sled's request started or finished, I'm not sure which).zpoollist may have happened before the request, and so maybe before the inventory collection started. This is the case where we need to add an additional timestamp and consumers need to know that this field may be even older than the rest of the data here.I'm pretty inclined at this point to go with the simpler API here, where we assume
zpool listdid happen during the request, but maybe let's discuss at an upcoming watercooler or team meeting?davepacheco commentedon Feb 26, 2026
In the update watercooler today we determined to do a few things:
zpool statusand other data collection operations will happen during the requestzpool listseparately for each pool? (though I'm not sure how we'll list pools -- ideally inventory would include stuff even when it's not expected to be found)svcsseparately for each zone, if it's easy to dozpoolandsvcsin a way such that:Does that sum it up @karencfv @jgallagher?
davepacheco commentedon Feb 26, 2026
One other note: that decoupleable work can be done before or after this. The current behavior (which allows sled agent inventory requests to hang and processes to pile up) is already a problem and not made worse by this project.
[inventory] Modify reporting on services per sled agent (#9977)
karencfv commentedon May 25, 2026
This has been implemented now. Tracking issue for remaining less urgent health checks -> #10488