fix(monitoring): hostname, tooltip timestamps, default range (v0.5.1)
- Bug 1: Read hostname from /host/etc/hostname instead of os.Hostname() which returns the container ID inside Docker. Added volume mount. - Bug 2: Tooltip callback used parsed.x (category index) instead of label (actual timestamp), showing 1970 dates. - Bug 3+4: Default range changed from 24h to 1h so charts show data immediately on new deployments with limited history. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -27,6 +27,8 @@ services:
|
||||
- /sys:/host/sys:ro
|
||||
# Host OS info — for monitoring page system info
|
||||
- /etc/os-release:/host/etc/os-release:ro
|
||||
# Host hostname — for monitoring page (os.Hostname() returns container ID)
|
||||
- /etc/hostname:/host/etc/hostname:ro
|
||||
environment:
|
||||
- TZ=Europe/Budapest
|
||||
labels:
|
||||
|
||||
@@ -16,8 +16,12 @@ import (
|
||||
func GetStaticInfo() StaticSystemInfo {
|
||||
info := StaticSystemInfo{}
|
||||
|
||||
// Hostname
|
||||
info.Hostname, _ = os.Hostname()
|
||||
// Hostname — try host mount first, fall back to os.Hostname()
|
||||
if data, err := os.ReadFile("/host/etc/hostname"); err == nil {
|
||||
info.Hostname = strings.TrimSpace(string(data))
|
||||
} else {
|
||||
info.Hostname, _ = os.Hostname()
|
||||
}
|
||||
|
||||
// OS — try host mount first, fall back to container's
|
||||
info.OS = readOSRelease("/host/etc/os-release")
|
||||
|
||||
@@ -41,9 +41,9 @@
|
||||
<div class="monitor-card-header">
|
||||
<h3>Rendszer metrikák</h3>
|
||||
<div class="time-range-bar" id="system-range-bar">
|
||||
<button class="filter-btn" data-range="1h">1 óra</button>
|
||||
<button class="filter-btn active" data-range="1h">1 óra</button>
|
||||
<button class="filter-btn" data-range="6h">6 óra</button>
|
||||
<button class="filter-btn active" data-range="24h">24 óra</button>
|
||||
<button class="filter-btn" data-range="24h">24 óra</button>
|
||||
<button class="filter-btn" data-range="7d">7 nap</button>
|
||||
<button class="filter-btn" data-range="30d">30 nap</button>
|
||||
</div>
|
||||
@@ -94,9 +94,9 @@
|
||||
<div class="monitor-card-header">
|
||||
<h3 id="container-detail-title">–</h3>
|
||||
<div class="time-range-bar" id="container-range-bar">
|
||||
<button class="filter-btn" data-range="1h">1 óra</button>
|
||||
<button class="filter-btn active" data-range="1h">1 óra</button>
|
||||
<button class="filter-btn" data-range="6h">6 óra</button>
|
||||
<button class="filter-btn active" data-range="24h">24 óra</button>
|
||||
<button class="filter-btn" data-range="24h">24 óra</button>
|
||||
<button class="filter-btn" data-range="7d">7 nap</button>
|
||||
</div>
|
||||
<button class="btn btn-outline btn-sm" onclick="closeContainerDetail()">Bezárás</button>
|
||||
@@ -168,7 +168,7 @@
|
||||
callbacks: {
|
||||
title: function(items) {
|
||||
if (!items.length) return '';
|
||||
return formatTimestamp(items[0].parsed.x || items[0].label);
|
||||
return formatTimestamp(items[0].label);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,7 +212,7 @@
|
||||
}
|
||||
|
||||
// --- System charts ---
|
||||
let systemRange = '24h';
|
||||
let systemRange = '1h';
|
||||
let chartCPU, chartMem, chartTemp, chartLoad;
|
||||
|
||||
function initSystemCharts() {
|
||||
@@ -363,7 +363,7 @@
|
||||
// --- Container detail ---
|
||||
let detailChartCPU, detailChartMem;
|
||||
let detailContainer = '';
|
||||
let detailRange = '24h';
|
||||
let detailRange = '1h';
|
||||
|
||||
function initDetailCharts() {
|
||||
const mkChart = (id, color, yLabel) => {
|
||||
|
||||
Reference in New Issue
Block a user