|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | +<head> |
| 4 | + <meta charset="UTF-8"> |
| 5 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 6 | + <title>NGINX Prometheus Exporter Demo</title> |
| 7 | + <style> |
| 8 | + body { |
| 9 | + font-family: Arial, sans-serif; |
| 10 | + max-width: 800px; |
| 11 | + margin: 0 auto; |
| 12 | + padding: 20px; |
| 13 | + line-height: 1.6; |
| 14 | + color: #333; |
| 15 | + } |
| 16 | + .header { |
| 17 | + text-align: center; |
| 18 | + background-color: #f4f4f4; |
| 19 | + padding: 20px; |
| 20 | + border-radius: 8px; |
| 21 | + margin-bottom: 20px; |
| 22 | + } |
| 23 | + .services { |
| 24 | + display: grid; |
| 25 | + grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); |
| 26 | + gap: 20px; |
| 27 | + margin-top: 20px; |
| 28 | + } |
| 29 | + .service-card { |
| 30 | + background-color: #f9f9f9; |
| 31 | + padding: 20px; |
| 32 | + border-radius: 8px; |
| 33 | + border: 1px solid #ddd; |
| 34 | + } |
| 35 | + .service-card h3 { |
| 36 | + color: #0066cc; |
| 37 | + margin-top: 0; |
| 38 | + } |
| 39 | + .service-card a { |
| 40 | + color: #0066cc; |
| 41 | + text-decoration: none; |
| 42 | + } |
| 43 | + .service-card a:hover { |
| 44 | + text-decoration: underline; |
| 45 | + } |
| 46 | + .load-test { |
| 47 | + background-color: #e8f4f8; |
| 48 | + padding: 15px; |
| 49 | + border-radius: 5px; |
| 50 | + margin-top: 20px; |
| 51 | + } |
| 52 | + .load-test button { |
| 53 | + background-color: #0066cc; |
| 54 | + color: white; |
| 55 | + border: none; |
| 56 | + padding: 10px 20px; |
| 57 | + border-radius: 5px; |
| 58 | + cursor: pointer; |
| 59 | + margin-right: 10px; |
| 60 | + } |
| 61 | + .load-test button:hover { |
| 62 | + background-color: #0052a3; |
| 63 | + } |
| 64 | + .footer { |
| 65 | + text-align: center; |
| 66 | + margin-top: 40px; |
| 67 | + padding: 20px; |
| 68 | + background-color: #f4f4f4; |
| 69 | + border-radius: 8px; |
| 70 | + } |
| 71 | + </style> |
| 72 | +</head> |
| 73 | +<body> |
| 74 | + <div class="header"> |
| 75 | + <h1>🔧 NGINX Prometheus Exporter Demo</h1> |
| 76 | + <p>This is a demo environment showcasing NGINX monitoring with Prometheus and Grafana</p> |
| 77 | + </div> |
| 78 | + |
| 79 | + <div class="services"> |
| 80 | + <div class="service-card"> |
| 81 | + <h3>📊 Prometheus</h3> |
| 82 | + <p>Time-series database collecting metrics from NGINX</p> |
| 83 | + <a href="http://localhost:9090" target="_blank">Open Prometheus →</a> |
| 84 | + </div> |
| 85 | + |
| 86 | + <div class="service-card"> |
| 87 | + <h3>📈 Grafana</h3> |
| 88 | + <p>Visualization dashboard for NGINX metrics</p> |
| 89 | + <p><strong>Login:</strong> admin / admin123</p> |
| 90 | + <a href="http://localhost:3000" target="_blank">Open Grafana →</a> |
| 91 | + </div> |
| 92 | + |
| 93 | + <div class="service-card"> |
| 94 | + <h3>🔍 NGINX Exporter</h3> |
| 95 | + <p>Prometheus exporter for NGINX metrics</p> |
| 96 | + <a href="http://localhost:9113/metrics" target="_blank">View Metrics →</a> |
| 97 | + </div> |
| 98 | + |
| 99 | + <div class="service-card"> |
| 100 | + <h3>⚙️ NGINX Status</h3> |
| 101 | + <p>Raw NGINX stub_status information</p> |
| 102 | + <a href="http://localhost:8081/stub_status" target="_blank">View Status →</a> |
| 103 | + </div> |
| 104 | + </div> |
| 105 | + |
| 106 | + <div class="load-test"> |
| 107 | + <h3>🚀 Load Testing</h3> |
| 108 | + <p>Generate some traffic to see metrics in action:</p> |
| 109 | + <button onclick="sendRequests()">Send 100 Requests</button> |
| 110 | + <button onclick="sendSlowRequests()">Send Slow Requests</button> |
| 111 | + <button onclick="sendAPIRequests()">Send API Requests</button> |
| 112 | + <div id="results"></div> |
| 113 | + </div> |
| 114 | + |
| 115 | + <div class="footer"> |
| 116 | + <p>🐳 This demo is powered by Docker Compose</p> |
| 117 | + <p>Check the <a href="https://github.com/nginx/nginx-prometheus-exporter" target="_blank">NGINX Prometheus Exporter repository</a> for more information</p> |
| 118 | + </div> |
| 119 | + |
| 120 | + <script> |
| 121 | + function sendRequests() { |
| 122 | + const results = document.getElementById('results'); |
| 123 | + results.innerHTML = '<p>Sending 100 requests...</p>'; |
| 124 | + |
| 125 | + let completed = 0; |
| 126 | + for (let i = 0; i < 100; i++) { |
| 127 | + fetch('/?load-test=' + i) |
| 128 | + .then(() => { |
| 129 | + completed++; |
| 130 | + if (completed === 100) { |
| 131 | + results.innerHTML = '<p>✅ Completed 100 requests! Check Prometheus/Grafana for updated metrics.</p>'; |
| 132 | + } |
| 133 | + }) |
| 134 | + .catch(() => { |
| 135 | + completed++; |
| 136 | + if (completed === 100) { |
| 137 | + results.innerHTML = '<p>⚠️ Completed requests (some may have failed). Check metrics for details.</p>'; |
| 138 | + } |
| 139 | + }); |
| 140 | + } |
| 141 | + } |
| 142 | + |
| 143 | + function sendSlowRequests() { |
| 144 | + const results = document.getElementById('results'); |
| 145 | + results.innerHTML = '<p>Sending slow requests...</p>'; |
| 146 | + |
| 147 | + let completed = 0; |
| 148 | + for (let i = 0; i < 20; i++) { |
| 149 | + setTimeout(() => { |
| 150 | + fetch('/?slow-test=' + i) |
| 151 | + .then(() => { |
| 152 | + completed++; |
| 153 | + if (completed === 20) { |
| 154 | + results.innerHTML = '<p>✅ Completed 20 slow requests! Check response time metrics.</p>'; |
| 155 | + } |
| 156 | + }) |
| 157 | + .catch(() => { |
| 158 | + completed++; |
| 159 | + if (completed === 20) { |
| 160 | + results.innerHTML = '<p>⚠️ Completed slow requests (some may have failed).</p>'; |
| 161 | + } |
| 162 | + }); |
| 163 | + }, i * 100); |
| 164 | + } |
| 165 | + } |
| 166 | + |
| 167 | + function sendAPIRequests() { |
| 168 | + const results = document.getElementById('results'); |
| 169 | + results.innerHTML = '<p>Sending API requests...</p>'; |
| 170 | + |
| 171 | + let completed = 0; |
| 172 | + for (let i = 0; i < 50; i++) { |
| 173 | + fetch('/api/test' + i) |
| 174 | + .then(() => { |
| 175 | + completed++; |
| 176 | + if (completed === 50) { |
| 177 | + results.innerHTML = '<p>✅ Completed 50 API requests! Check metrics for API endpoint stats.</p>'; |
| 178 | + } |
| 179 | + }) |
| 180 | + .catch(() => { |
| 181 | + completed++; |
| 182 | + if (completed === 50) { |
| 183 | + results.innerHTML = '<p>⚠️ Completed API requests (some may have failed).</p>'; |
| 184 | + } |
| 185 | + }); |
| 186 | + } |
| 187 | + } |
| 188 | + </script> |
| 189 | +</body> |
| 190 | +</html> |
0 commit comments