Skip to content

Include generated services in Sysmonitor#25561

Merged
liat-grozovik merged 1 commit intosonic-net:masterfrom
william8545:fix-system-health-status
Mar 15, 2026
Merged

Include generated services in Sysmonitor#25561
liat-grozovik merged 1 commit intosonic-net:masterfrom
william8545:fix-system-health-status

Conversation

@william8545
Copy link
Contributor

@william8545 william8545 commented Feb 18, 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.

Work item tracking
  • Microsoft ADO (number only):

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

Which release branch to backport (provide reason below if selected)

  • 202305
  • 202311
  • 202405
  • 202411
  • 202505
  • 202511

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)

Signed-off-by: William Tsai <willtsai@nvidia.com>
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Feb 18, 2026

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: william8545 / name: William Tsai (9317671)

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@william8545 william8545 marked this pull request as ready for review February 18, 2026 20:07
@william8545 william8545 requested a review from lguohan as a code owner February 18, 2026 20:07
@william8545
Copy link
Contributor Author

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Commenter does not have sufficient privileges for PR 25561 in repo sonic-net/sonic-buildimage

@william8545
Copy link
Contributor Author

/azpw run Azure.sonic-buildimage

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@dgsudharsan
Copy link
Collaborator

@saiarcot895 Can you please review and signoff?

@liat-grozovik
Copy link
Collaborator

@saiarcot895 kindly reminder for the review feedback. As this is needed for 202511 appreciate if you can prioritize that

@liat-grozovik liat-grozovik merged commit 269ab58 into sonic-net:master Mar 15, 2026
26 checks passed
@mssonicbld
Copy link
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants