Skip to content

Commit

Permalink
fixes systemd section parsing for old agents
Browse files Browse the repository at this point in the history
sometimes a systemd unit has no description
  • Loading branch information
gurubert committed Dec 20, 2023
1 parent 4e19bb2 commit 58164d6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmk/base/plugins/agent_based/systemd_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,10 @@ def try_parse(
name, unit_type = name_unit
temp = name[: name.find("@") + 1] if "@" in name else name
enabled = enabled_status.get(f"{temp}{unit_type.suffix}", "unknown")
remains = " ".join(row[1:])
loaded_status, active_status, current_state, descr = remains.split(" ", 3)
remains = (" ".join(row[1:])).split(" ", 3)
if len(remains) == 3:
remains.append("")
loaded_status, active_status, current_state, descr = remains
time_since_change = (
status_details[name].time_since_change if name in status_details else None
)
Expand Down

0 comments on commit 58164d6

Please sign in to comment.