Include generated services in Sysmonitor#25561
Merged
liat-grozovik merged 1 commit intosonic-net:masterfrom Mar 15, 2026
Merged
Include generated services in Sysmonitor#25561liat-grozovik merged 1 commit intosonic-net:masterfrom
liat-grozovik merged 1 commit intosonic-net:masterfrom
Conversation
Signed-off-by: William Tsai <willtsai@nvidia.com>
|
|
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
oleksandrivantsiv
approved these changes
Feb 18, 2026
Contributor
Author
|
/azp run Azure.sonic-buildimage |
|
Commenter does not have sufficient privileges for PR 25561 in repo sonic-net/sonic-buildimage |
Contributor
Author
|
/azpw run Azure.sonic-buildimage |
Collaborator
|
/AzurePipelines run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
@saiarcot895 Can you please review and signoff? |
Collaborator
|
@saiarcot895 kindly reminder for the review feedback. As this is needed for 202511 appreciate if you can prioritize that |
saiarcot895
approved these changes
Mar 9, 2026
Collaborator
|
Cherry-pick PR to 202511: #26194 |
yue-fred-gao
pushed a commit
to yue-fred-gao/sonic-buildimage
that referenced
this pull request
Mar 16, 2026
- Why I did it Starting from the systemd version used in Debian Trixie (systemd 257), systemd-sonic-generator creates service unit files in /run/systemd/generator/ to handle multi-instance dependency expansion on DPU and multi-ASIC platforms. systemd marks these units as UnitFileState=generated instead of enabled or static. sysmonitor did not recognize "generated" as a valid state, causing these services to be silently skipped during health checks — they were missing from show system-health sysready-status and STATE_DB ALL_SERVICE_STATUS. - How I did it Adds "generated" to the accepted UnitFileState values in sysmonitor.py, so that services with UnitFileState=generated are correctly reported in show system-health sysready-status. This 1-line change adds "generated" to the accepted states so that all services are properly monitored regardless of where their unit file resides. Tests Added two unit tests to verify that the generated state is handled correctly: test_get_unit_status_generated_running_ok — a service with UnitFileState=generated and ActiveState=active is reported as OK test_get_unit_status_generated_inactive_not_ok — a service with UnitFileState=generated and ActiveState=inactive is reported as NOT OK - How to verify it show system-health sysready-status Signed-off-by: William Tsai <willtsai@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why I did it
Starting from the systemd version used in Debian Trixie (systemd 257),
systemd-sonic-generatorcreates service unit files in/run/systemd/generator/to handle multi-instance dependency expansion on DPU and multi-ASIC platforms. systemd marks these units asUnitFileState=generatedinstead ofenabledorstatic.sysmonitordid not recognize"generated"as a valid state, causing these services to be silently skipped during health checks — they were missing fromshow system-health sysready-statusandSTATE_DB ALL_SERVICE_STATUS.Work item tracking
How I did it
Adds
"generated"to the acceptedUnitFileStatevalues insysmonitor.py, so that services withUnitFileState=generatedare correctly reported inshow system-health sysready-status.This 1-line change adds
"generated"to the accepted states so that all services are properly monitored regardless of where their unit file resides.Tests
Added two unit tests to verify that the
generatedstate is handled correctly:test_get_unit_status_generated_running_ok— a service withUnitFileState=generatedandActiveState=activeis reported as OKtest_get_unit_status_generated_inactive_not_ok— a service withUnitFileState=generatedandActiveState=inactiveis reported as NOT OKHow to verify it
show system-health sysready-statusWhich release branch to backport (provide reason below if selected)
Tested branch (Please provide the tested image version)
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)