From 7bec53ba597159cea2a41d94cf579c5e300502e1 Mon Sep 17 00:00:00 2001 From: Michael Pietsch Date: Fri, 3 Sep 2021 11:01:25 +0200 Subject: [PATCH] =?UTF-8?q?fix=20for=20prefixed=20=E2=97=8F=20in=20systemd?= =?UTF-8?q?=20output?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/pynagsystemd.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/pynagsystemd.py b/bin/pynagsystemd.py index 33fb64b..07fbbf8 100755 --- a/bin/pynagsystemd.py +++ b/bin/pynagsystemd.py @@ -8,6 +8,7 @@ import io import subprocess import argparse +import re import nagiosplugin @@ -30,7 +31,11 @@ def probe(self): raise nagiosplugin.CheckError(stderr) if stdout: + pattern = re.compile('^●\s*(?P.+)') for line in io.StringIO(stdout.decode('utf-8')): + match = pattern.match(line) + if match: + line = match.group('info') split_line = line.split() unit = split_line[0] active = split_line[2]