diff --git a/create_ticket_api.php b/create_ticket_api.php index c8c009b..808dcf6 100644 --- a/create_ticket_api.php +++ b/create_ticket_api.php @@ -94,6 +94,8 @@ function generateTicketHash($data) { // Detect issue category (not specific attribute values) $issueCategory = ''; + $isClusterWide = false; // Flag for cluster-wide issues (exclude hostname from hash) + if (stripos($data['title'], 'SMART issues') !== false) { $issueCategory = 'smart'; } elseif (stripos($data['title'], 'LXC') !== false || stripos($data['title'], 'storage usage') !== false) { @@ -104,18 +106,33 @@ function generateTicketHash($data) { $issueCategory = 'cpu'; } elseif (stripos($data['title'], 'network') !== false) { $issueCategory = 'network'; + } elseif (stripos($data['title'], 'Ceph') !== false || stripos($data['title'], '[ceph]') !== false) { + $issueCategory = 'ceph'; + // Ceph cluster-wide issues should deduplicate across all nodes + // Check if this is a cluster-wide issue (not node-specific like OSD down on this node) + if (stripos($data['title'], '[cluster-wide]') !== false || + stripos($data['title'], 'HEALTH_ERR') !== false || + stripos($data['title'], 'HEALTH_WARN') !== false || + stripos($data['title'], 'cluster usage') !== false) { + $isClusterWide = true; + } } // Build stable components with only static data $stableComponents = [ - 'hostname' => $hostname, 'issue_category' => $issueCategory, // Generic category, not specific errors 'environment_tags' => array_filter( explode('][', $data['title']), - fn($tag) => in_array($tag, ['production', 'development', 'staging', 'single-node']) + fn($tag) => in_array($tag, ['production', 'development', 'staging', 'single-node', 'cluster-wide']) ) ]; + // Only include hostname for non-cluster-wide issues + // This allows cluster-wide issues to deduplicate across all nodes + if (!$isClusterWide) { + $stableComponents['hostname'] = $hostname; + } + // Only include device info for drive-specific tickets if ($isDriveTicket) { $stableComponents['device'] = $deviceMatches[0];