Skip to content

feat(logsource): find_units() finds the units of a service by their unit files - #503

Merged
markuslf merged 1 commit into
mainfrom
feat/logsource-find-units
Nov 24, 2026
Merged

markuslf merged 1 commit into
mainfrom
feat/logsource-find-units

Conversation

@markuslf

Copy link
Copy Markdown
Member

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.

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant