193 lines
6.7 KiB
HTML
193 lines
6.7 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="refresh" content="30">
|
|
<title>{{ node_name }} - Node Monitor</title>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.7.0/chart.min.js"></script>
|
|
<style>
|
|
body {
|
|
background-color: #2e2e2e;
|
|
color: #ffffff;
|
|
font-family: Arial, sans-serif;
|
|
margin: 20px;
|
|
}
|
|
.container {
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
}
|
|
h1, h2 {
|
|
color: #ffffff;
|
|
}
|
|
.back-link a {
|
|
color: #00a0fc;
|
|
text-decoration: none;
|
|
}
|
|
.back-link a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
.node-card {
|
|
background: #3a3a3a;
|
|
border-radius: 8px;
|
|
padding: 20px;
|
|
margin-bottom: 20px;
|
|
}
|
|
.node-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 15px;
|
|
}
|
|
.node-info {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 20px;
|
|
}
|
|
.info-item {
|
|
background: #444;
|
|
padding: 15px;
|
|
border-radius: 6px;
|
|
}
|
|
.info-label {
|
|
font-weight: bold;
|
|
color: #aaa;
|
|
font-size: 0.9em;
|
|
}
|
|
.info-value {
|
|
font-size: 1.2em;
|
|
color: #ffffff;
|
|
}
|
|
.status-badge {
|
|
padding: 5px 10px;
|
|
border-radius: 4px;
|
|
font-weight: bold;
|
|
color: white;
|
|
}
|
|
.status-active { background-color: #28a745; }
|
|
.status-inactive { background-color: #dc3545; }
|
|
.status-pending { background-color: #ffc107; }
|
|
.chart-container {
|
|
background: #444;
|
|
padding: 15px;
|
|
border-radius: 6px;
|
|
height: 300px;
|
|
margin-top: 20px;
|
|
}
|
|
.progress-bar {
|
|
height: 8px;
|
|
background-color: #555;
|
|
border-radius: 4px;
|
|
overflow: hidden;
|
|
}
|
|
.progress-fill {
|
|
height: 100%;
|
|
border-radius: 4px;
|
|
}
|
|
.cpu-fill { background-color: #007bff; }
|
|
.memory-fill { background-color: #28a745; }
|
|
.disk-fill { background-color: #ffc107; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>Node Details: {{ node_name }}</h1>
|
|
<div class="back-link">
|
|
<a href="/app/">← Back to Overview</a>
|
|
</div>
|
|
<div class="node-card">
|
|
<div class="node-header">
|
|
<h2>{{ node_name }}</h2>
|
|
<div class="status-badge status-{{ node.status }}">{{ node.status|upper }}</div>
|
|
</div>
|
|
<div class="node-info">
|
|
<div class="info-item">
|
|
<div class="info-label">Hostname</div>
|
|
<div class="info-value">{{ node.hostname or 'N/A' }}</div>
|
|
</div>
|
|
<div class="info-item">
|
|
<div class="info-label">IP Address</div>
|
|
<div class="info-value">{{ node.ip_address or 'N/A' }}</div>
|
|
</div>
|
|
<div class="info-item">
|
|
<div class="info-label">OS Type</div>
|
|
<div class="info-value">{{ node.os_type or 'N/A' }}</div>
|
|
</div>
|
|
<div class="info-item">
|
|
<div class="info-label">Last Updated</div>
|
|
<div class="info-value">{{ node.last_updated or 'N/A' }}</div>
|
|
</div>
|
|
<div class="info-item">
|
|
<div class="info-label">CPU Usage</div>
|
|
<div class="info-value">{{ node.cpu_percent|round(2) if node.cpu_percent else 'N/A' }}%</div>
|
|
<div class="progress-bar">
|
|
<div class="progress-fill cpu-fill" style="width: {{ node.cpu_percent|default(0) }}%;"></div>
|
|
</div>
|
|
</div>
|
|
<div class="info-item">
|
|
<div class="info-label">Memory Usage</div>
|
|
<div class="info-value">{{ node.memory_percent|round(1) if node.memory_percent else 'N/A' }}%</div>
|
|
<div class="progress-bar">
|
|
<div class="progress-fill memory-fill" style="width: {{ node.memory_percent|default(0) }}%;"></div>
|
|
</div>
|
|
</div>
|
|
<div class="info-item">
|
|
<div class="info-label">Disk Usage</div>
|
|
<div class="info-value">{{ node.disk_percent|round(1) if node.disk_percent else 'N/A' }}%</div>
|
|
<div class="progress-bar">
|
|
<div class="progress-fill disk-fill" style="width: {{ node.disk_percent|default(0) }}%;"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="chart-container">
|
|
<canvas id="performanceChart"></canvas>
|
|
</div>
|
|
<div class="back-link" style="margin-top: 20px;">
|
|
<a href="/app/">← Back to Overview</a>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
const ctx = document.getElementById('performanceChart').getContext('2d');
|
|
const performanceChart = new Chart(ctx, {
|
|
type: 'line',
|
|
data: {
|
|
labels: [{% for ts in history_timestamps %}'{{ ts }}',{% endfor %}],
|
|
datasets: [{
|
|
label: 'CPU Usage (%)',
|
|
data: [{% for val in history_cpu %}{{ val if val is not none else 'null' }},{% endfor %}],
|
|
borderColor: '#007bff',
|
|
tension: 0.3
|
|
}, {
|
|
label: 'Memory Usage (%)',
|
|
data: [{% for val in history_memory %}{{ val if val is not none else 'null' }},{% endfor %}],
|
|
borderColor: '#28a745',
|
|
tension: 0.3
|
|
}, {
|
|
label: 'Disk Usage (%)',
|
|
data: [{% for val in history_disk %}{{ val if val is not none else 'null' }},{% endfor %}],
|
|
borderColor: '#ffc107',
|
|
tension: 0.3
|
|
}]
|
|
},
|
|
options: {
|
|
responsive: true,
|
|
maintainAspectRatio: false,
|
|
scales: {
|
|
x: { ticks: { color: '#aaa' }, grid: { color: 'rgba(255, 255, 255, 0.1)' } },
|
|
y: {
|
|
min: 0,
|
|
max: 400,
|
|
ticks: { color: '#aaa' },
|
|
grid: { color: 'rgba(255, 255, 255, 0.1)' }
|
|
}
|
|
},
|
|
plugins: {
|
|
legend: { labels: { color: '#fff' } }
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|