Repository navigation
feat(logsource): find_units() finds the units of a service by their unit files - #503
Merged
Merged
Conversation
…nit files Seven *-logfile plugins of the monitoring plugins carried their own copy of the same lookup: which of a few unit names a host has a unit file for, in the directories systemd reads unit files from, nothing at all where systemd does not run the host (monitoring-plugins#1544), and an alias counted once. Two of the copies had grown a feature of their own: postfix-logfile looks an instance up by its template, php-fpm-logfile passes a glob. find_units() does all of it. Unlike the copies, a unit is also returned once where the administrator overrides its file in /etc/systemd/system with a full copy; before, the two files yielded the name twice, which read_many() then read once. Tests cover the order of the candidates, a missing unit file, a host without systemd, aliases, an override in /etc, a glob and an instance.
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.
Seven *-logfile plugins of the monitoring plugins carried their own copy
of the same lookup: which of a few unit names a host has a unit file
for, in the directories systemd reads unit files from, nothing at all
where systemd does not run the host (monitoring-plugins#1544), and an
alias counted once. Two of the copies had grown a feature of their own:
postfix-logfile looks an instance up by its template, php-fpm-logfile
passes a glob. find_units() does all of it.
Unlike the copies, a unit is also returned once where the administrator
overrides its file in /etc/systemd/system with a full copy; before, the
two files yielded the name twice, which read_many() then read once.
Tests cover the order of the candidates, a missing unit file, a host
without systemd, aliases, an override in /etc, a glob and an instance.
Checks: tests/logsource/unit-test/run (228 tests) and tox py39 to py314 passed locally.