-
-
+
-
+
-
+
-
-
+
+
-
- Cluster Health
-
-
-
-
- - {{ clusterData.cluster_health?.health || 0 }}% -
-
-
-
-
-
+
-
- - CPU Utilization -
-
-
-
-
- - {{ metricsData.cpu.data[metricsData.cpu.data.length - 1] || 0 }}% -
-
-
-
-
-
+
-
- - Memory Utilization -
-
-
-
-
-
- - {{ metricsData.memory.data[metricsData.memory.data.length - 1] || 0 }}% -
-
-
+
-
- - Storage Utilization -
-
-
-
-
-
- - {{ metricsData.storage?.data[metricsData.storage?.data.length - 1] || 0 }}% -
-
@@ -245,11 +206,11 @@
-
+
-
-
+
@@ -317,7 +278,7 @@
@@ -329,7 +290,7 @@
@@ -368,6 +329,10 @@ import {
Filler
} from 'chart.js';
import annotationPlugin from 'chartjs-plugin-annotation';
+import CPUChart from './charts/CPUChart.vue';
+import MemoryChart from './charts/MemoryChart.vue';
+import StorageChart from './charts/StorageChart.vue';
+import HealthChart from './charts/HealthChart.vue';
// Register Chart.js components
ChartJS.register(
@@ -397,13 +362,13 @@ const props = defineProps({
const displayMessages = computed(() => {
const messages = [];
-
+
// Check if there are any health messages
if (props.clusterData.cluster_health?.messages) {
// Add all messages from the cluster health data
messages.push(...props.clusterData.cluster_health.messages);
}
-
+
// Sort messages by health delta (highest impact first)
return messages.sort((a, b) => {
// If health_delta is not available, use 0
@@ -433,17 +398,17 @@ const getDeltaClass = (delta, msg) => {
if (msg && msg.id === 'Cluster is in maintenance') {
return 'delta-info';
}
-
+
// Special case for plugin error messages (the ones with 25%)
if (msg && (msg.id === 'NODE_PLUGIN_PSQL_HV3' || msg.id === 'NODE_PLUGIN_ZKPR_HV3')) {
return 'delta-high'; // These should be red
}
-
+
// Special case for "No problems" message
if (msg && msg.id === 'CLUSTER_HEALTHY') {
return 'delta-low';
}
-
+
// Handle numeric deltas
if (delta === undefined || delta === null) return '';
if (delta === 0) return 'delta-low'; // Zero delta - green like healthy messages
@@ -452,59 +417,45 @@ const getDeltaClass = (delta, msg) => {
return 'delta-info';
};
-const healthChartData = computed(() => {
- return {
- labels: props.metricsData.health.labels,
- datasets: [{
- data: props.metricsData.health.data,
- fill: true,
- segment: {
- borderColor: (ctx) => {
- console.log('Context:', ctx);
- console.log('Maintenance data:', props.metricsData.maintenance?.data);
- console.log('Available indices:', ctx.p0?.parsed?.x, ctx.p1?.parsed?.x);
- const maintenanceAtPoint = props.metricsData.maintenance?.data[ctx.p0.parsed.x];
- console.log('Point', ctx.p0.parsed.x, 'Maintenance:', maintenanceAtPoint);
- if (maintenanceAtPoint === true) {
- console.log('Using blue color for maintenance');
- return 'rgba(13, 110, 253, 0.2)';
- }
- const value = ctx.p1.parsed.y;
- console.log('Using health-based color:', value);
- if (value > 90) return 'rgba(40, 167, 69, 0.2)'; // Green
- if (value > 50) return 'rgba(255, 193, 7, 0.2)'; // Yellow
- return 'rgba(220, 53, 69, 0.2)'; // Red
- },
- backgroundColor: (ctx) => {
- const maintenanceAtPoint = props.metricsData.maintenance?.data[ctx.p0.parsed.x];
- if (maintenanceAtPoint === true) {
- return 'rgba(13, 110, 253, 0.1)';
- }
- const value = ctx.p1.parsed.y;
- if (value > 90) return 'rgba(40, 167, 69, 0.1)'; // Green
- if (value > 50) return 'rgba(255, 193, 7, 0.1)'; // Yellow
- return 'rgba(220, 53, 69, 0.1)'; // Red
- }
- },
- borderWidth: 1.5,
- tension: 0.4,
- pointRadius: 0,
- pointHoverRadius: 4,
- pointBackgroundColor: 'rgba(255, 255, 255, 0.8)', // Light background for all points
- pointBorderColor: (ctx) => {
- const maintenanceAtPoint = props.metricsData.maintenance?.data[ctx.dataIndex];
- if (maintenanceAtPoint === true) return 'rgba(13, 110, 253, 0.5)'; // Blue for maintenance
- if (!ctx.raw) return 'rgba(0, 0, 0, 0.2)';
- const value = ctx.raw;
- if (value > 90) return 'rgba(40, 167, 69, 0.5)'; // Green
- if (value > 50) return 'rgba(255, 193, 7, 0.5)'; // Yellow
- return 'rgba(220, 53, 69, 0.5)'; // Red
- },
- pointBorderWidth: 1.5
- }]
- };
-});
+// Simplified chart data for the new chart components
+const healthChartData = computed(() => ({
+ labels: props.metricsData.health.labels,
+ data: props.metricsData.health.data
+}));
+const cpuChartData = computed(() => ({
+ labels: props.metricsData.cpu.labels,
+ data: props.metricsData.cpu.data
+}));
+
+const memoryChartData = computed(() => ({
+ labels: props.metricsData.memory.labels,
+ data: props.metricsData.memory.data
+}));
+
+const storageChartData = computed(() => ({
+ labels: props.metricsData.storage?.labels || [],
+ data: props.metricsData.storage?.data || []
+}));
+
+// Current values for the charts
+const clusterHealth = computed(() =>
+ props.clusterData.cluster_health?.health || 0
+);
+
+const cpuUtilization = computed(() =>
+ props.metricsData.cpu.data[props.metricsData.cpu.data.length - 1] || 0
+);
+
+const memoryUtilization = computed(() =>
+ props.metricsData.memory.data[props.metricsData.memory.data.length - 1] || 0
+);
+
+const storageUtilization = computed(() =>
+ props.metricsData.storage?.data[props.metricsData.storage?.data.length - 1] || 0
+);
+
+// Health chart options for the threshold lines
const healthChartOptions = {
responsive: true,
maintainAspectRatio: false,
@@ -568,108 +519,11 @@ const healthChartOptions = {
}
};
-const cpuChartData = computed(() => ({
- labels: props.metricsData.cpu.labels,
- datasets: [{
- label: 'CPU',
- data: props.metricsData.cpu.data,
- borderColor: 'rgb(75, 192, 192)',
- fill: true,
- backgroundColor: 'rgba(75, 192, 192, 0.1)',
- borderWidth: 1.5,
- tension: 0.4,
- pointRadius: 0,
- pointHoverRadius: 4,
- pointBackgroundColor: 'rgba(255, 255, 255, 0.8)',
- pointBorderColor: 'rgba(75, 192, 192, 0.5)',
- pointBorderWidth: 1.5
- }]
-}));
-
-const memoryChartData = computed(() => ({
- labels: props.metricsData.memory.labels,
- datasets: [{
- label: 'Memory',
- data: props.metricsData.memory.data,
- borderColor: 'rgb(153, 102, 255)',
- fill: true,
- backgroundColor: 'rgba(153, 102, 255, 0.1)',
- borderWidth: 1.5,
- tension: 0.4,
- pointRadius: 0,
- pointHoverRadius: 4,
- pointBackgroundColor: 'rgba(255, 255, 255, 0.8)',
- pointBorderColor: 'rgba(153, 102, 255, 0.5)',
- pointBorderWidth: 1.5
- }]
-}));
-
-const storageChartData = computed(() => ({
- labels: props.metricsData.storage?.labels || [],
- datasets: [{
- label: 'Storage',
- data: props.metricsData.storage?.data || [],
- borderColor: 'rgb(255, 159, 64)',
- fill: true,
- backgroundColor: 'rgba(255, 159, 64, 0.1)',
- borderWidth: 1.5,
- tension: 0.4,
- pointRadius: 0,
- pointHoverRadius: 4,
- pointBackgroundColor: 'rgba(255, 255, 255, 0.8)',
- pointBorderColor: 'rgba(255, 159, 64, 0.5)',
- pointBorderWidth: 1.5
- }]
-}));
-
-const chartOptions = {
- responsive: true,
- maintainAspectRatio: false,
- clip: false,
- resizeDelay: 0,
- responsiveAnimationDuration: 0, /* Disable resize animation */
- plugins: {
- legend: {
- display: false
- },
- tooltip: {
- callbacks: {
- label: (context) => `${context.parsed.y}%`
- }
- }
- },
- scales: {
- x: {
- display: false,
- grid: {
- display: false
- }
- },
- y: {
- display: false,
- grid: {
- display: false
- },
- min: 0,
- max: 100
- }
- },
- animation: false,
- interaction: {
- enabled: true,
- mode: 'nearest',
- intersect: false
- },
- onResize: (chart, size) => {
- chart.resize(); /* Force resize on container change */
- }
-};
-
// Helper function to group objects by state
const groupByState = (items, stateExtractor) => {
const groups = {};
if (!items || !Array.isArray(items)) return groups;
-
+
items.forEach(item => {
const state = stateExtractor(item);
if (!groups[state]) {
@@ -677,7 +531,7 @@ const groupByState = (items, stateExtractor) => {
}
groups[state].push(item);
});
-
+
return groups;
};
@@ -699,7 +553,7 @@ const updateStateHistory = (newStates, historyArray, maxPoints = 20) => {
if (!newStates || Object.keys(newStates).length === 0) {
return;
}
-
+
// Check if there are any actual items in the states
const hasItems = Object.values(newStates).some(items => items && items.length > 0);
if (!hasItems) {
@@ -711,7 +565,7 @@ const updateStateHistory = (newStates, historyArray, maxPoints = 20) => {
timestamp: Date.now(),
states: JSON.parse(JSON.stringify(newStates)) // Deep copy to prevent reference issues
});
-
+
// Limit history length
if (historyArray.length > maxPoints) {
historyArray.shift();
@@ -724,40 +578,40 @@ const processStateHistory = (currentStateGroups, historyArray, timeLabels, color
const allStates = new Map();
const datasets = [];
const stateData = {};
-
+
// Skip processing if no history data yet
if (historyArray.length === 0) {
return [];
}
-
+
// Skip processing if current state groups are empty
if (!currentStateGroups || Object.keys(currentStateGroups).length === 0) {
return [];
}
-
+
// Initialize data structure for all time points
timeLabels.forEach((_, index) => {
stateData[index] = {};
});
-
+
// Process historical data
if (historyArray.length > 0) {
// Map history entries to time points in the chart
const historyStep = historyArray.length / timeLabels.length;
-
+
timeLabels.forEach((_, timeIndex) => {
// Find the corresponding history entry for this time point
const historyIndex = Math.min(
Math.floor(timeIndex * historyStep),
historyArray.length - 1
);
-
+
const historyEntry = historyArray[historyIndex];
if (historyEntry && historyEntry.states) {
// Record states at this time point
Object.entries(historyEntry.states).forEach(([state, items]) => {
stateData[timeIndex][state] = items.length;
-
+
// Track this state
if (!allStates.has(state)) {
allStates.set(state, {
@@ -769,12 +623,12 @@ const processStateHistory = (currentStateGroups, historyArray, timeLabels, color
}
});
}
-
+
// Add current states that might not be in history yet
Object.entries(currentStateGroups).forEach(([state, items]) => {
const lastIndex = timeLabels.length - 1;
stateData[lastIndex][state] = items.length;
-
+
if (!allStates.has(state)) {
allStates.set(state, {
color: colorFunction(state),
@@ -785,16 +639,16 @@ const processStateHistory = (currentStateGroups, historyArray, timeLabels, color
allStates.get(state).currentCount = items.length;
}
});
-
+
// Create datasets for Chart.js
const totalCount = Object.values(currentStateGroups)
.reduce((sum, items) => sum + items.length, 0);
-
+
// Skip if total count is 0
if (totalCount === 0) {
return [];
}
-
+
datasets.push({
label: 'Total',
data: Array(timeLabels.length).fill(totalCount),
@@ -806,14 +660,14 @@ const processStateHistory = (currentStateGroups, historyArray, timeLabels, color
order: 999,
currentCount: totalCount
});
-
+
// Add a line for each state
allStates.forEach((stateInfo, state) => {
// Create data array from historical state data
const data = timeLabels.map((_, index) => {
return stateData[index][state] || 0;
});
-
+
// Skip drawing lines for states with all zero values
if (data.every(value => value === 0)) {
// Still add to legend if current count is not zero
@@ -826,7 +680,7 @@ const processStateHistory = (currentStateGroups, historyArray, timeLabels, color
}
return;
}
-
+
datasets.push({
label: capitalizeState(state),
data: data,
@@ -842,7 +696,7 @@ const processStateHistory = (currentStateGroups, historyArray, timeLabels, color
}
});
});
-
+
return datasets;
};
@@ -863,12 +717,12 @@ const nodeStateColors = (state) => {
// Node states processing
const nodeStatesChartData = computed(() => {
const labels = props.metricsData.health.labels;
-
+
// Only process if we have history data
if (nodeStateHistory.value.length === 0) {
return { labels, datasets: [] };
}
-
+
// Process node states with history
const datasets = processStateHistory(
nodeStateGroups.value,
@@ -876,7 +730,7 @@ const nodeStatesChartData = computed(() => {
labels,
nodeStateColors
);
-
+
return { labels, datasets };
});
@@ -896,12 +750,12 @@ const vmStateColors = (state) => {
// VM states processing
const vmStatesChartData = computed(() => {
const labels = props.metricsData.health.labels;
-
+
// Only process if we have history data
if (vmStateHistory.value.length === 0) {
return { labels, datasets: [] };
}
-
+
// Process VM states with history
const datasets = processStateHistory(
vmStateGroups.value,
@@ -909,7 +763,7 @@ const vmStatesChartData = computed(() => {
labels,
vmStateColors
);
-
+
return { labels, datasets };
});
@@ -929,12 +783,12 @@ const osdStateColors = (state) => {
// OSD states processing
const osdStatesChartData = computed(() => {
const labels = props.metricsData.health.labels;
-
+
// Only process if we have history data
if (osdStateHistory.value.length === 0) {
return { labels, datasets: [] };
}
-
+
// Process OSD states with history
const datasets = processStateHistory(
osdStateGroups.value,
@@ -942,7 +796,7 @@ const osdStatesChartData = computed(() => {
labels,
osdStateColors
);
-
+
return { labels, datasets };
});
@@ -965,8 +819,8 @@ const statesChartOptions = {
// Custom legend labels with counts
const datasets = chart.data.datasets;
return datasets.map(dataset => ({
- text: dataset.currentCount !== undefined ?
- `${dataset.label}: ${dataset.currentCount}` :
+ text: dataset.currentCount !== undefined ?
+ `${dataset.label}: ${dataset.currentCount}` :
dataset.label,
fillStyle: dataset.borderColor,
strokeStyle: dataset.borderColor,
@@ -1019,30 +873,30 @@ watch(() => props.clusterData, (newData) => {
if (!newData.detail) {
return;
}
-
+
// Update node state history
const nodeStates = groupByState(newData.detail?.node, (node) => {
return `${node.daemon_state}, ${node.domain_state}`;
});
-
+
// Only update if we have actual node states
if (Object.keys(nodeStates).length > 0) {
updateStateHistory(nodeStates, nodeStateHistory.value);
}
-
+
// Update VM state history
const vmStates = groupByState(newData.detail?.vm, (vm) => vm.state);
-
+
// Only update if we have actual VM states
if (Object.keys(vmStates).length > 0) {
updateStateHistory(vmStates, vmStateHistory.value);
}
-
+
// Update OSD state history
const osdStates = groupByState(newData.detail?.osd, (osd) => {
return `${osd.up}, ${osd.in}`;
});
-
+
// Only update if we have actual OSD states
if (Object.keys(osdStates).length > 0) {
updateStateHistory(osdStates, osdStateHistory.value);
@@ -1057,23 +911,23 @@ onMounted(() => {
const nodeStates = groupByState(props.clusterData.detail?.node, (node) => {
return `${node.daemon_state}, ${node.domain_state}`;
});
-
+
// Only initialize if we have actual node states
if (Object.keys(nodeStates).length > 0) {
updateStateHistory(nodeStates, nodeStateHistory.value);
}
-
+
const vmStates = groupByState(props.clusterData.detail?.vm, (vm) => vm.state);
-
+
// Only initialize if we have actual VM states
if (Object.keys(vmStates).length > 0) {
updateStateHistory(vmStates, vmStateHistory.value);
}
-
+
const osdStates = groupByState(props.clusterData.detail?.osd, (osd) => {
return `${osd.up}, ${osd.in}`;
});
-
+
// Only initialize if we have actual OSD states
if (Object.keys(osdStates).length > 0) {
updateStateHistory(osdStates, osdStateHistory.value);
@@ -1100,7 +954,7 @@ const showHealthDelta = (msg) => {
if (msg.id === 'CLUSTER_HEALTHY') {
return false;
}
-
+
// Show delta for all other messages that have a delta value
return msg.health_delta !== undefined && msg.health_delta !== null;
};
@@ -1111,7 +965,7 @@ const getMessageId = (msg) => {
if (msg.id === 'CLUSTER_HEALTHY') {
return 'Cluster is healthy with no faults';
}
-
+
// Return the original ID for all other messages
return msg.id || 'Unknown Issue';
};
@@ -1239,12 +1093,12 @@ const getMessageText = (msg) => {
.metrics-row {
grid-template-columns: repeat(4, 1fr);
}
-
+
/* 4x1 for health/utilization graphs in full width */
.graphs-row {
grid-template-columns: repeat(4, 1fr);
}
-
+
/* 3x1 for state graphs in full width */
.states-graphs-row {
grid-template-columns: repeat(3, 1fr);
@@ -1255,12 +1109,12 @@ const getMessageText = (msg) => {
.metrics-row {
grid-template-columns: repeat(2, 1fr); /* 2 columns when between 800px and 1200px */
}
-
+
/* 2x2 for health/utilization graphs in medium width */
.graphs-row {
grid-template-columns: repeat(2, 1fr);
}
-
+
/* 1x3 for state graphs in medium width (vertical stack) */
.states-graphs-row {
grid-template-columns: 1fr;
@@ -1271,12 +1125,12 @@ const getMessageText = (msg) => {
.metrics-row {
grid-template-columns: 1fr; /* 1 column when <= 800px */
}
-
+
/* 1x4 for health/utilization graphs in narrow width */
.graphs-row {
grid-template-columns: 1fr;
}
-
+
/* 1x3 for state graphs in narrow width */
.states-graphs-row {
grid-template-columns: 1fr;
@@ -1394,8 +1248,13 @@ const getMessageText = (msg) => {
.chart-wrapper {
position: relative;
width: 100%;
- height: 100%;
- min-width: 0;
+ height: 160px;
+ min-height: 160px;
+ overflow: hidden;
+ border: none;
+ border-radius: 0;
+ background-color: white;
+ margin: 0;
}
/* Add new style for full-width messages */
diff --git a/pvc-vue/src/components/ConfigPanel.vue b/pvc-vue/src/components/ConfigPanel.vue
index 3c51257..7a53180 100644
--- a/pvc-vue/src/components/ConfigPanel.vue
+++ b/pvc-vue/src/components/ConfigPanel.vue
@@ -1,12 +1,12 @@
-
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
Configuration
diff --git a/pvc-vue/src/components/NodeStatus.vue b/pvc-vue/src/components/NodeStatus.vue index 6f61e2c..58012fb 100644 --- a/pvc-vue/src/components/NodeStatus.vue +++ b/pvc-vue/src/components/NodeStatus.vue @@ -60,7 +60,7 @@ const formatMemory = (node) => { if (!node.memory || typeof node.memory !== 'object') { return { used: 'N/A', total: 'N/A', percent: 'N/A' }; } - + // Convert MB to GB with 2 decimal places const toGB = (mb) => { if (typeof mb !== 'number' || isNaN(mb)) { @@ -68,17 +68,17 @@ const formatMemory = (node) => { } return (mb / 1024).toFixed(2); }; - + // Extract values from the Proxy object const memoryData = Object.assign({}, node.memory); const used = toGB(memoryData.used); const total = toGB(memoryData.total); - + let percent = 'N/A'; if (used !== 'N/A' && total !== 'N/A' && parseFloat(total) > 0) { percent = Math.round((parseFloat(used) / parseFloat(total)) * 100); } - + return { used, total, percent }; }; diff --git a/pvc-vue/src/components/PageTitle.vue b/pvc-vue/src/components/PageTitle.vue index 590bce9..abeea76 100644 --- a/pvc-vue/src/components/PageTitle.vue +++ b/pvc-vue/src/components/PageTitle.vue @@ -37,4 +37,4 @@ defineProps({ display: flex; gap: 0.5rem; } - \ No newline at end of file + \ No newline at end of file diff --git a/pvc-vue/src/components/charts/CPUChart.vue b/pvc-vue/src/components/charts/CPUChart.vue new file mode 100644 index 0000000..3cbe51e --- /dev/null +++ b/pvc-vue/src/components/charts/CPUChart.vue @@ -0,0 +1,202 @@ + +
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pvc-vue/src/components/charts/HealthChart.vue b/pvc-vue/src/components/charts/HealthChart.vue
new file mode 100644
index 0000000..dc1f860
--- /dev/null
+++ b/pvc-vue/src/components/charts/HealthChart.vue
@@ -0,0 +1,291 @@
+
+
+
+ + {{ title }} +
+
+
+
+
+ {{ value }}%
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pvc-vue/src/components/charts/MemoryChart.vue b/pvc-vue/src/components/charts/MemoryChart.vue
new file mode 100644
index 0000000..7e06485
--- /dev/null
+++ b/pvc-vue/src/components/charts/MemoryChart.vue
@@ -0,0 +1,202 @@
+
+
+
+ + {{ title }} +
+
+
+
+
+ {{ value }}%
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pvc-vue/src/components/charts/StorageChart.vue b/pvc-vue/src/components/charts/StorageChart.vue
new file mode 100644
index 0000000..e27aee3
--- /dev/null
+++ b/pvc-vue/src/components/charts/StorageChart.vue
@@ -0,0 +1,202 @@
+
+
+
+ + {{ title }} +
+
+
+
+
+ {{ value }}%
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pvc-vue/src/views/Nodes.vue b/pvc-vue/src/views/Nodes.vue
index a674fc6..82724b7 100644
--- a/pvc-vue/src/views/Nodes.vue
+++ b/pvc-vue/src/views/Nodes.vue
@@ -1,14 +1,14 @@
+
+ + {{ title }} +
+
+
+
+
+ {{ value }}%
+
+
+
+
-
-
+
@@ -170,35 +170,31 @@
@@ -209,7 +205,7 @@
-
-
+
-
-
+
-
-
+
-
@@ -240,7 +236,7 @@
{{ formatMemory(selectedNodeData.memory?.total) }}
@@ -252,7 +248,7 @@
{{ formatMemory(selectedNodeData.memory?.used) }}
@@ -264,7 +260,7 @@
{{ formatMemory(selectedNodeData.memory?.free) }}
@@ -276,7 +272,7 @@
{{ formatMemory(selectedNodeData.memory?.allocated) }}
@@ -298,7 +294,7 @@
Select a node to view details
@@ -309,19 +305,22 @@ \ No newline at end of file + \ No newline at end of file