diff --git a/hbd/client/plugins/nagios_runner.py b/hbd/client/plugins/nagios_runner.py index d2b0c22..12fdaf1 100644 --- a/hbd/client/plugins/nagios_runner.py +++ b/hbd/client/plugins/nagios_runner.py @@ -24,6 +24,7 @@ nagios_runner: import asyncio import os import re +import shlex from typing import Any, Dict, List, Optional, Tuple from hbd.client.plugin import MonitorPlugin @@ -101,7 +102,13 @@ class NagiosRunnerPlugin(MonitorPlugin): command = cmd_config.get("command", "") if not command: continue - exe = command.split()[0] + try: + tokens = shlex.split(command) + except ValueError: + continue # malformed command string; skip validation + if not tokens: + continue + exe = tokens[0] if os.path.isabs(exe): if not os.path.isfile(exe): self.logger.warning(