Elasticsearch Dashboard

Elasticsearch Dashboard

Cluster Overview

Cluster Health

Green

Number of Nodes

3

Number of Indices

15

Total Data Size

500 GB

Node Status

Node Name IP Address Status CPU Usage (%) RAM Usage (GB) Disk Usage (GB)

Indices Overview

Index Name Status Primary Shards Replica Shards Document Count Size (GB)

${dashboardData.overview.totalDataSize} GB

`; // Add Node Status table let nodeTableHtml = `

Node Status

`; dashboardData.nodes.forEach((node, index) => { const rowBg = index % 2 === 0 ? '#ffffff' : '#f7fafc'; nodeTableHtml += ` `; }); nodeTableHtml += `
Node Name IP Address Status CPU Usage (%) RAM Usage (GB) Disk Usage (GB)
${node.name} ${node.ip} ${node.status} ${node.cpu}% ${node.ram} GB ${node.disk} GB
`; pdfContentDiv.innerHTML += nodeTableHtml; // Add Indices Overview table let indexTableHtml = `

Indices Overview

`; dashboardData.indices.forEach((index, i) => { const rowBg = i % 2 === 0 ? '#ffffff' : '#f7fafc'; indexTableHtml += ` `; }); indexTableHtml += `
Index Name Status Primary Shards Replica Shards Document Count Size (GB)
${index.name} ${index.status} ${index.primaryShards} ${index.replicaShards} ${index.docCount.toLocaleString()} ${index.size} GB
`; pdfContentDiv.innerHTML += indexTableHtml; // Append the temporary div to the body to render it for html2canvas document.body.appendChild(pdfContentDiv); // Use html2canvas to capture the content as an image const canvas = await html2canvas(pdfContentDiv, { scale: 2, // Increase scale for better resolution in PDF useCORS: true, // Required if you have external images/resources logging: false // Disable logging for cleaner console }); // Remove the temporary div document.body.removeChild(pdfContentDiv); const imgData = canvas.toDataURL('image/png'); const pdf = new window.jspdf.jsPDF({ orientation: 'portrait', unit: 'px', format: [canvas.width, canvas.height] // Use canvas dimensions for PDF }); pdf.addImage(imgData, 'PNG', 0, 0, canvas.width, canvas.height); pdf.save('Elasticsearch_Dashboard_Report.pdf'); } // --- Event Listeners --- if (dashboardTabBtn) dashboardTabBtn.onclick = function() { switchTab('dashboard'); }; if (dataConfigTabBtn) dataConfigTabBtn.onclick = function() { switchTab('dataConfig'); }; if (saveConfigBtn) saveConfigBtn.onclick = saveConfiguration; if (addNodeBtn) addNodeBtn.onclick = addNode; if (addIndexBtn) addIndexBtn.onclick = addIndex; if (nextBtn) nextBtn.onclick = navigateNext; if (prevBtn) prevBtn.onclick = navigatePrevious; if (downloadPdfBtn) downloadPdfBtn.onclick = downloadPDF; // --- Initial Render --- renderDashboard(); // Render dashboard on initial load switchTab('dashboard'); // Ensure dashboard tab is active by default });
Scroll to Top