systemd: allow timer monitoring with SERVICE_PATTERNS (#1820)

This commit is contained in:
henrygd
2026-03-17 15:11:44 -04:00
parent 704cb86de8
commit 48ddc96a0d
2 changed files with 8 additions and 1 deletions

View File

@@ -301,7 +301,7 @@ func getServicePatterns() []string {
if pattern == "" {
continue
}
if !strings.HasSuffix(pattern, ".service") {
if !strings.HasSuffix(pattern, "timer") && !strings.HasSuffix(pattern, ".service") {
pattern += ".service"
}
patterns = append(patterns, pattern)

View File

@@ -156,6 +156,13 @@ func TestGetServicePatterns(t *testing.T) {
expected: []string{"*nginx*.service", "*apache*.service"},
cleanupEnvVars: true,
},
{
name: "opt into timer monitoring",
prefixedEnv: "nginx.service,docker,apache.timer",
unprefixedEnv: "",
expected: []string{"nginx.service", "docker.service", "apache.timer"},
cleanupEnvVars: true,
},
}
for _, tt := range tests {