fix(qualys/agents): check service multi-format - SysV init francais (en cours d'execution / (pid X)) en plus de systemd active (running)

This commit is contained in:
Pierre & Lumière 2026-04-28 01:45:48 +02:00
parent f0043eb481
commit eecb61c720

View File

@ -979,8 +979,20 @@ def audit_qualys_agent_only(hostname):
result["check_connectivity"] = "Connectivité OK" in s_conn
result["check_disk"] = " 100%" not in s_disk
result["check_service"] = "active (running)" in s_status or \
("running" in s_status and "active" in s_status)
# Multi-format : systemd ("active (running)"), SysV anglais ("is running" / "(pid"),
# SysV français RHEL 5/6 ("en cours d'exécution")
is_running = (
"active (running)" in s_status
or "(pid " in s_status
or "is running" in s_status
or "en cours d'exécution" in s_status
or "en cours d'execution" in s_status # sans accent
)
is_stopped = any(k in s_status for k in [
"inactive (dead)", "stopped", "not running",
"n'est pas en cours", "is not running"
])
result["check_service"] = is_running and not is_stopped
result["check_installed"] = bool(re.search(r"qualys-cloud-agent[-\s]\d", s_ver))
# Ligne saturee si disque KO