fix: service name not shown pynag

This commit is contained in:
2023-03-14 11:51:32 +01:00
parent 500a6bd70a
commit 23ae78c6ff

View File

@@ -32,7 +32,8 @@ class SystemdStatus(nagiosplugin.Resource):
if pres: if pres:
result = "" result = ""
for line in io.StringIO(pres.decode('utf-8')): for line in io.StringIO(pres.decode('utf-8')):
result = "%s %s" % (result, line.split(' ')[0]) # format is DOT_SPECIA_CHAR name service failed ..
result = "%s %s" % (result, line.split(' ')[1])
return [nagiosplugin.Metric('systemd', (False, result), context='systemd')] return [nagiosplugin.Metric('systemd', (False, result), context='systemd')]