From 8c7211d311a19a3f96d9ec88087520c695ad31fd Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Sat, 17 Jan 2026 15:53:45 -0500 Subject: [PATCH] Add Ceph cluster-wide ticket deduplication support Update generateTicketHash() to exclude hostname from hash for cluster-wide Ceph issues, enabling proper deduplication across all nodes in the cluster. Cluster-wide issues detected by: - [cluster-wide] tag in title - HEALTH_ERR or HEALTH_WARN in title - "cluster usage" in title This prevents all nodes from creating duplicate tickets for the same cluster-wide issue (e.g., Ceph HEALTH_WARN). Co-Authored-By: Claude Opus 4.5 --- create_ticket_api.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) 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];