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.
Thanks for the script!
I found a couple of issues when testing and wanted to share the tweaks we made.
On some distros the "systemctl list-units" output contains an additional column to the left that can contain bullet points. This results in space and/or bullet characters being encoded as part of the OID. Adding "--plain" to the systemctl command prevents these bullets from being printed and interpreted as part of the service name.
Without "--plain" on Ubuntu 22.04
With "--plain" on Ubuntu 22.04
We also found that the sub-state for some services could be "auto-restart", which failed to match the existing regex because of the dash character. I've tweaked it to accept a dash.
We've tested the changes on AlmaLinux 8.8, CentOS 7, Debian 12, Kali Linux, Rocky Linux 9.2, openSUSE Leap 15.5, Ubuntu 18.04, and Ubuntu 22.04.