diff --git a/create_ticket_api.php b/create_ticket_api.php index 0809d1e..290f972 100644 --- a/create_ticket_api.php +++ b/create_ticket_api.php @@ -159,6 +159,23 @@ function generateTicketHash($data) } } elseif (stripos($title, 'HEALTH_ERR') !== false) { $issueSubtype = 'health_err'; + } else { + // Any other warning gets its own ticket. Previously every other + // HEALTH_WARN shared one empty subtype, so unrelated warnings + // (noout, nearfull, insecure keys, ...) collapsed onto a single + // ticket and overwrote its title in turn every run (#112). + // Prefer Ceph's own health-check code when the reporter sends + // it; otherwise key on the warning text with counts stripped. + $checkCode = isset($data['check_code']) && is_string($data['check_code']) ? $data['check_code'] : ''; + if ($checkCode !== '' && preg_match('/^[A-Z0-9_]{1,64}$/', $checkCode)) { + $issueSubtype = 'check_' . strtolower($checkCode); + } elseif (preg_match('/HEALTH_WARN:\s*([^\[]+)/i', $title, $warnMatch)) { + $warnText = strtolower(explode(':', $warnMatch[1])[0]); + $warnText = trim(preg_replace('/[^a-z]+/', '_', $warnText), '_'); + if ($warnText !== '') { + $issueSubtype = 'warn_' . $warnText; + } + } } }