mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-22 11:13:26 +00:00
chore: clean up logs and disable alert popups for release readiness
This commit is contained in:
+11
-11
@@ -50,7 +50,7 @@ function loadPbsConfig(index = null) {
|
||||
const parsedUrl = new URL(pbsHostUrl);
|
||||
pbsHostname = parsedUrl.hostname;
|
||||
} catch (e) {
|
||||
console.warn(`WARN: Could not parse PBS_HOST URL "${pbsHostUrl}". Using full value as fallback name.`);
|
||||
// console.warn(`WARN: Could not parse PBS_HOST URL "${pbsHostUrl}". Using full value as fallback name.`);
|
||||
}
|
||||
|
||||
const pbsTokenId = process.env[tokenIdVar];
|
||||
@@ -64,7 +64,7 @@ function loadPbsConfig(index = null) {
|
||||
pbsHostUrl.includes(p) || pbsTokenId.includes(p) || pbsTokenSecret.includes(p)
|
||||
);
|
||||
if (pbsPlaceholders.length > 0) {
|
||||
console.warn(`WARN: Skipping PBS configuration ${index || 'primary'} (Token). Placeholder values detected for: ${pbsPlaceholders.join(', ')}`);
|
||||
// console.warn(`WARN: Skipping PBS configuration ${index || 'primary'} (Token). Placeholder values detected for: ${pbsPlaceholders.join(', ')}`);
|
||||
} else {
|
||||
config = {
|
||||
id: `${idPrefix}_token`,
|
||||
@@ -78,10 +78,10 @@ function loadPbsConfig(index = null) {
|
||||
allowSelfSignedCerts: process.env[selfSignedVar] !== 'false',
|
||||
enabled: true
|
||||
};
|
||||
console.log(`INFO: Found PBS configuration ${index || 'primary'} (API Token): ${config.name} (${config.host})`);
|
||||
// console.log(`INFO: Found PBS configuration ${index || 'primary'} (API Token): ${config.name} (${config.host})`);
|
||||
}
|
||||
} else {
|
||||
console.warn(`WARN: Partial PBS configuration found for ${hostVar}. Please set (${tokenIdVar} + ${tokenSecretVar}) along with ${hostVar}.`);
|
||||
// console.warn(`WARN: Partial PBS configuration found for ${hostVar}. Please set (${tokenIdVar} + ${tokenSecretVar}) along with ${hostVar}.`);
|
||||
}
|
||||
|
||||
if (config) {
|
||||
@@ -131,7 +131,7 @@ function loadConfiguration() {
|
||||
// Set the flag if placeholders were detected (but don't throw error)
|
||||
if (placeholderVars.length > 0) {
|
||||
isConfigPlaceholder = true;
|
||||
console.warn(`WARN: Primary Proxmox environment variables seem to contain placeholder values: ${placeholderVars.join(', ')}. Pulse may not function correctly until configured.`);
|
||||
// console.warn(`WARN: Primary Proxmox environment variables seem to contain placeholder values: ${placeholderVars.join(', ')}. Pulse may not function correctly until configured.`);
|
||||
}
|
||||
|
||||
// --- Load All Proxmox Endpoint Configurations ---
|
||||
@@ -145,11 +145,11 @@ function loadConfiguration() {
|
||||
|
||||
// Basic validation for additional endpoints (primary is validated earlier)
|
||||
if (index !== null && (!tokenId || !tokenSecret)) {
|
||||
console.warn(`WARN: Skipping endpoint ${index || idPrefix} (Host: ${host}). Missing token ID or secret.`);
|
||||
// console.warn(`WARN: Skipping endpoint ${index || idPrefix} (Host: ${host}). Missing token ID or secret.`);
|
||||
return null;
|
||||
}
|
||||
if (index !== null && placeholderValues.some(p => host.includes(p) || tokenId.includes(p) || tokenSecret.includes(p))) {
|
||||
console.warn(`WARN: Skipping endpoint ${index || idPrefix} (Host: ${host}). Environment variables seem to contain placeholder values.`);
|
||||
// console.warn(`WARN: Skipping endpoint ${index || idPrefix} (Host: ${host}). Environment variables seem to contain placeholder values.`);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ function loadConfiguration() {
|
||||
}
|
||||
|
||||
if (endpoints.length > 1) {
|
||||
console.log(`INFO: Loaded configuration for ${endpoints.length} Proxmox endpoints.`);
|
||||
// console.log(`INFO: Loaded configuration for ${endpoints.length} Proxmox endpoints.`);
|
||||
}
|
||||
|
||||
// --- Load All PBS Configurations ---
|
||||
@@ -226,9 +226,9 @@ function loadConfiguration() {
|
||||
}
|
||||
|
||||
if (pbsConfigs.length > 0) {
|
||||
console.log(`INFO: Loaded configuration for ${pbsConfigs.length} PBS instances.`);
|
||||
// console.log(`INFO: Loaded configuration for ${pbsConfigs.length} PBS instances.`);
|
||||
} else {
|
||||
console.log("INFO: No PBS instances configured.");
|
||||
// console.log("INFO: No PBS instances configured.");
|
||||
}
|
||||
|
||||
// --- Final Validation ---
|
||||
@@ -238,7 +238,7 @@ function loadConfiguration() {
|
||||
throw new ConfigurationError('\n--- Configuration Error ---\nNo enabled Proxmox VE or PBS endpoints could be configured. Please check your .env file and environment variables.\n');
|
||||
}
|
||||
|
||||
console.log('INFO: Configuration loaded successfully.');
|
||||
// console.log('INFO: Configuration loaded successfully.');
|
||||
// Return the flag along with endpoints and pbsConfigs
|
||||
return { endpoints, pbsConfigs, isConfigPlaceholder };
|
||||
}
|
||||
|
||||
+47
-47
@@ -8,16 +8,16 @@ async function fetchNodeResource(apiClient, endpointId, nodeName, resourcePath,
|
||||
|
||||
if (data) {
|
||||
if (expectArray && !Array.isArray(data)) {
|
||||
console.warn(`[DataFetcher - ${endpointId}-${nodeName}] ${resourceName} data is not an array as expected.`);
|
||||
// console.warn(`[DataFetcher - ${endpointId}-${nodeName}] ${resourceName} data is not an array as expected.`);
|
||||
return expectArray ? [] : null;
|
||||
}
|
||||
return transformFn ? transformFn(data) : data;
|
||||
} else {
|
||||
console.warn(`[DataFetcher - ${endpointId}-${nodeName}] ${resourceName} data missing or invalid format.`);
|
||||
// console.warn(`[DataFetcher - ${endpointId}-${nodeName}] ${resourceName} data missing or invalid format.`);
|
||||
return expectArray ? [] : null;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`[DataFetcher - ${endpointId}-${nodeName}] Error fetching ${resourceName}: ${error.message}`);
|
||||
// console.error(`[DataFetcher - ${endpointId}-${nodeName}] Error fetching ${resourceName}: ${error.message}`);
|
||||
return expectArray ? [] : null; // Allow proceeding even if this resource fails
|
||||
}
|
||||
}
|
||||
@@ -85,11 +85,11 @@ async function fetchDataForPveEndpoint(endpointId, apiClientInstance, config) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.warn(`[DataFetcher - ${endpointName}] No nodes found or unexpected format.`);
|
||||
// console.warn(`[DataFetcher - ${endpointName}] No nodes found or unexpected format.`);
|
||||
endpointType = 'standalone'; // Fallback
|
||||
}
|
||||
} catch (clusterError) {
|
||||
console.error(`[DataFetcher - ${endpointName}] Error fetching /cluster/status: ${clusterError.message}`, clusterError);
|
||||
// console.error(`[DataFetcher - ${endpointName}] Error fetching /cluster/status: ${clusterError.message}`, clusterError);
|
||||
endpointType = 'standalone'; // Fallback
|
||||
// Even on /cluster/status error, try to get node name if it's likely standalone
|
||||
try {
|
||||
@@ -98,7 +98,7 @@ async function fetchDataForPveEndpoint(endpointId, apiClientInstance, config) {
|
||||
standaloneNodeName = nodesListForEndpoint[0].node;
|
||||
}
|
||||
} catch (nodesError) {
|
||||
console.error(`[DataFetcher - ${endpointName}] Also failed to fetch /nodes after /cluster/status error: ${nodesError.message}`);
|
||||
// console.error(`[DataFetcher - ${endpointName}] Also failed to fetch /nodes after /cluster/status error: ${nodesError.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ async function fetchDataForPveEndpoint(endpointId, apiClientInstance, config) {
|
||||
const nodesResponse = await apiClientInstance.get('/nodes');
|
||||
const nodes = nodesResponse.data.data;
|
||||
if (!nodes || !Array.isArray(nodes)) {
|
||||
console.warn(`[DataFetcher - ${endpointName}] No nodes found or unexpected format.`);
|
||||
// console.warn(`[DataFetcher - ${endpointName}] No nodes found or unexpected format.`);
|
||||
return { nodes: [], vms: [], containers: [] };
|
||||
}
|
||||
|
||||
@@ -161,9 +161,9 @@ async function fetchDataForPveEndpoint(endpointId, apiClientInstance, config) {
|
||||
processedNodes.push(finalNode);
|
||||
} else {
|
||||
if (result.status === 'rejected') {
|
||||
console.error(`[DataFetcher - ${endpointName}-${correspondingNodeInfo.node}] Error fetching Node status: ${result.reason?.message || result.reason}`);
|
||||
// console.error(`[DataFetcher - ${endpointName}-${correspondingNodeInfo.node}] Error fetching Node status: ${result.reason?.message || result.reason}`);
|
||||
} else {
|
||||
console.warn(`[DataFetcher - ${endpointName}-${correspondingNodeInfo.node}] Unexpected result status: ${result.status}`);
|
||||
// console.warn(`[DataFetcher - ${endpointName}-${correspondingNodeInfo.node}] Unexpected result status: ${result.status}`);
|
||||
}
|
||||
processedNodes.push(finalNode); // Push node with defaults on failure
|
||||
}
|
||||
@@ -173,7 +173,7 @@ async function fetchDataForPveEndpoint(endpointId, apiClientInstance, config) {
|
||||
|
||||
} catch (error) {
|
||||
const status = error.response?.status ? ` (Status: ${error.response.status})` : '';
|
||||
console.error(`[DataFetcher - ${endpointName}] Error fetching PVE discovery data${status}: ${error.message}`);
|
||||
// console.error(`[DataFetcher - ${endpointName}] Error fetching PVE discovery data${status}: ${error.message}`);
|
||||
// Return empty structure on endpoint-level failure
|
||||
return { nodes: [], vms: [], containers: [] };
|
||||
}
|
||||
@@ -190,11 +190,11 @@ async function fetchPveDiscoveryData(currentApiClients) {
|
||||
let allNodes = [], allVms = [], allContainers = [];
|
||||
|
||||
if (pveEndpointIds.length === 0) {
|
||||
console.log("[DataFetcher] No PVE endpoints configured or initialized.");
|
||||
// console.log("[DataFetcher] No PVE endpoints configured or initialized.");
|
||||
return { nodes: [], vms: [], containers: [] };
|
||||
}
|
||||
|
||||
console.log(`[DataFetcher] Fetching PVE discovery data for ${pveEndpointIds.length} endpoints...`);
|
||||
// console.log(`[DataFetcher] Fetching PVE discovery data for ${pveEndpointIds.length} endpoints...`);
|
||||
|
||||
const pvePromises = pveEndpointIds.map(endpointId => {
|
||||
const { client: apiClientInstance, config } = currentApiClients[endpointId];
|
||||
@@ -231,11 +231,11 @@ async function fetchPbsNodeName({ client, config }) {
|
||||
const nodeName = response.data.data[0].node;
|
||||
return nodeName;
|
||||
} else {
|
||||
console.warn(`WARN: [DataFetcher] Could not automatically detect PBS node name for ${config.name}. Response format unexpected.`);
|
||||
// console.warn(`WARN: [DataFetcher] Could not automatically detect PBS node name for ${config.name}. Response format unexpected.`);
|
||||
return 'localhost';
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`ERROR: [DataFetcher] Failed to fetch PBS nodes list for ${config.name}: ${error.message}`);
|
||||
// console.error(`ERROR: [DataFetcher] Failed to fetch PBS nodes list for ${config.name}: ${error.message}`);
|
||||
return 'localhost';
|
||||
}
|
||||
}
|
||||
@@ -277,11 +277,11 @@ async function fetchPbsDatastoreData({ client, config }) {
|
||||
};
|
||||
});
|
||||
} else {
|
||||
console.warn(`WARN: [DataFetcher] PBS /status/datastore-usage returned empty data for ${config.name}. Falling back.`);
|
||||
// console.warn(`WARN: [DataFetcher] PBS /status/datastore-usage returned empty data for ${config.name}. Falling back.`);
|
||||
throw new Error("Empty data from /status/datastore-usage");
|
||||
}
|
||||
} catch (usageError) {
|
||||
console.warn(`WARN: [DataFetcher] Failed to get datastore usage for ${config.name}, falling back to /config/datastore. Error: ${usageError.message}`);
|
||||
// console.warn(`WARN: [DataFetcher] Failed to get datastore usage for ${config.name}, falling back to /config/datastore. Error: ${usageError.message}`);
|
||||
try {
|
||||
const configResponse = await client.get('/config/datastore');
|
||||
const datastoresConfig = configResponse.data?.data ?? [];
|
||||
@@ -298,7 +298,7 @@ async function fetchPbsDatastoreData({ client, config }) {
|
||||
gcDetails: null
|
||||
}));
|
||||
} catch (configError) {
|
||||
console.error(`ERROR: [DataFetcher] Fallback fetch of PBS datastore config failed for ${config.name}: ${configError.message}`);
|
||||
// console.error(`ERROR: [DataFetcher] Fallback fetch of PBS datastore config failed for ${config.name}: ${configError.message}`);
|
||||
}
|
||||
}
|
||||
return datastores;
|
||||
@@ -316,7 +316,7 @@ async function fetchPbsDatastoreSnapshots({ client, config }, storeName) {
|
||||
return snapshotResponse.data?.data ?? [];
|
||||
} catch (snapshotError) {
|
||||
const status = snapshotError.response?.status ? ` (Status: ${snapshotError.response.status})` : '';
|
||||
console.error(`ERROR: [DataFetcher] Failed to fetch snapshots for datastore ${storeName} on ${config.name}${status}: ${snapshotError.message}`);
|
||||
// console.error(`ERROR: [DataFetcher] Failed to fetch snapshots for datastore ${storeName} on ${config.name}${status}: ${snapshotError.message}`);
|
||||
return []; // Return empty on error
|
||||
}
|
||||
}
|
||||
@@ -329,7 +329,7 @@ async function fetchPbsDatastoreSnapshots({ client, config }, storeName) {
|
||||
*/
|
||||
async function fetchAllPbsTasksForProcessing({ client, config }, nodeName) {
|
||||
if (!nodeName) {
|
||||
console.warn("WARN: [DataFetcher] Cannot fetch PBS data without node name.");
|
||||
// console.warn("WARN: [DataFetcher] Cannot fetch PBS data without node name.");
|
||||
return { tasks: null, error: true };
|
||||
}
|
||||
try {
|
||||
@@ -350,7 +350,7 @@ async function fetchAllPbsTasksForProcessing({ client, config }, nodeName) {
|
||||
deduplicationFactor = datastoreStatusResponse.data.data[0]['deduplication-factor'];
|
||||
}
|
||||
} catch (dedupError) {
|
||||
console.warn(`WARN: [DataFetcher] Could not fetch deduplication factor: ${dedupError.message}`);
|
||||
// console.warn(`WARN: [DataFetcher] Could not fetch deduplication factor: ${dedupError.message}`);
|
||||
}
|
||||
|
||||
// 2. Create synthetic backup job runs from recent snapshots
|
||||
@@ -430,15 +430,15 @@ async function fetchAllPbsTasksForProcessing({ client, config }, nodeName) {
|
||||
});
|
||||
|
||||
} catch (snapshotError) {
|
||||
console.warn(`WARN: [DataFetcher] Could not fetch snapshots for group ${group['backup-type']}/${group['backup-id']}: ${snapshotError.message}`);
|
||||
// console.warn(`WARN: [DataFetcher] Could not fetch snapshots for group ${group['backup-type']}/${group['backup-id']}: ${snapshotError.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`[DataFetcher] Created ${backupRunsByUniqueKey.size} unique backup runs from snapshots for ${config.name}`);
|
||||
// console.log(`[DataFetcher] Created ${backupRunsByUniqueKey.size} unique backup runs from snapshots for ${config.name}`);
|
||||
|
||||
} catch (datastoreError) {
|
||||
console.error(`ERROR: [DataFetcher] Could not fetch datastore backup history: ${datastoreError.message}`);
|
||||
// console.error(`ERROR: [DataFetcher] Could not fetch datastore backup history: ${datastoreError.message}`);
|
||||
return { tasks: null, error: true };
|
||||
}
|
||||
|
||||
@@ -525,7 +525,7 @@ async function fetchAllPbsTasksForProcessing({ client, config }, nodeName) {
|
||||
allBackupTasks.push(...nonBackupAdminTasks);
|
||||
|
||||
} catch (adminError) {
|
||||
console.warn(`WARN: [DataFetcher] Could not fetch administrative tasks: ${adminError.message}`);
|
||||
// console.warn(`WARN: [DataFetcher] Could not fetch administrative tasks: ${adminError.message}`);
|
||||
|
||||
// If admin task fetching fails, add all synthetic backup runs for complete statistics
|
||||
const backupRuns = Array.from(backupRunsByUniqueKey.values());
|
||||
@@ -544,7 +544,7 @@ async function fetchAllPbsTasksForProcessing({ client, config }, nodeName) {
|
||||
|
||||
const deduplicatedTasks = Array.from(finalTasksMap.values());
|
||||
|
||||
console.log(`[DataFetcher] Final task count for ${config.name}: ${allBackupTasks.length} -> ${deduplicatedTasks.length} (removed ${allBackupTasks.length - deduplicatedTasks.length} duplicates)`);
|
||||
// console.log(`[DataFetcher] Final task count for ${config.name}: ${allBackupTasks.length} -> ${deduplicatedTasks.length} (removed ${allBackupTasks.length - deduplicatedTasks.length} duplicates)`);
|
||||
|
||||
return {
|
||||
tasks: deduplicatedTasks,
|
||||
@@ -553,7 +553,7 @@ async function fetchAllPbsTasksForProcessing({ client, config }, nodeName) {
|
||||
};
|
||||
|
||||
} catch (error) {
|
||||
console.error(`ERROR: [DataFetcher] Failed to fetch PBS backup data: ${error.message}`);
|
||||
// console.error(`ERROR: [DataFetcher] Failed to fetch PBS backup data: ${error.message}`);
|
||||
return { tasks: null, error: true };
|
||||
}
|
||||
}
|
||||
@@ -568,7 +568,7 @@ async function fetchPbsData(currentPbsApiClients) {
|
||||
const pbsDataResults = [];
|
||||
|
||||
if (pbsClientIds.length === 0) {
|
||||
console.log("[DataFetcher] No PBS instances configured or initialized.");
|
||||
// console.log("[DataFetcher] No PBS instances configured or initialized.");
|
||||
return pbsDataResults;
|
||||
}
|
||||
|
||||
@@ -609,17 +609,17 @@ async function fetchPbsData(currentPbsApiClients) {
|
||||
const processedTasks = processPbsTasks(allTasksResult.tasks); // Assumes processPbsTasks is imported
|
||||
instanceData = { ...instanceData, ...processedTasks }; // Merge task summaries
|
||||
} else {
|
||||
console.warn(`WARN: [DataFetcher - ${instanceName}] No tasks to process or task fetching failed.`);
|
||||
// console.warn(`WARN: [DataFetcher - ${instanceName}] No tasks to process or task fetching failed.`);
|
||||
}
|
||||
|
||||
instanceData.status = 'ok';
|
||||
instanceData.nodeName = nodeName; // Ensure nodeName is set
|
||||
} else {
|
||||
console.warn(`WARN: [DataFetcher - ${instanceName}] Node name '${nodeName}' is invalid or 'localhost'.`);
|
||||
// console.warn(`WARN: [DataFetcher - ${instanceName}] Node name '${nodeName}' is invalid or 'localhost'.`);
|
||||
throw new Error(`Could not determine node name for PBS instance ${instanceName}`);
|
||||
}
|
||||
} catch (pbsError) {
|
||||
console.error(`ERROR: [DataFetcher - ${instanceName}] PBS fetch failed: ${pbsError.message}`);
|
||||
// console.error(`ERROR: [DataFetcher - ${instanceName}] PBS fetch failed: ${pbsError.message}`);
|
||||
instanceData.status = 'error';
|
||||
}
|
||||
return instanceData;
|
||||
@@ -630,7 +630,7 @@ async function fetchPbsData(currentPbsApiClients) {
|
||||
if (result.status === 'fulfilled') {
|
||||
pbsDataResults.push(result.value);
|
||||
} else {
|
||||
console.error(`ERROR: [DataFetcher] Unhandled rejection fetching PBS data: ${result.reason}`);
|
||||
// console.error(`ERROR: [DataFetcher] Unhandled rejection fetching PBS data: ${result.reason}`);
|
||||
}
|
||||
});
|
||||
return pbsDataResults;
|
||||
@@ -644,7 +644,7 @@ async function fetchPbsData(currentPbsApiClients) {
|
||||
* @returns {Promise<Object>} - { nodes, vms, containers, pbs: pbsDataArray }
|
||||
*/
|
||||
async function fetchDiscoveryData(currentApiClients, currentPbsApiClients, _fetchPbsDataInternal = fetchPbsData) {
|
||||
console.log("[DataFetcher] Starting full discovery cycle...");
|
||||
// console.log("[DataFetcher] Starting full discovery cycle...");
|
||||
|
||||
// Fetch PVE and PBS data in parallel
|
||||
const [pveResult, pbsResult] = await Promise.all([
|
||||
@@ -656,7 +656,7 @@ async function fetchDiscoveryData(currentApiClients, currentPbsApiClients, _fetc
|
||||
// Add a catch block to handle potential rejections from Promise.all itself
|
||||
// This might happen if one of the main fetch functions throws an unhandled error
|
||||
// *before* returning a promise (less likely with current async/await structure but safer)
|
||||
console.error("[DataFetcher] Error during discovery cycle Promise.all:", error);
|
||||
// console.error("[DataFetcher] Error during discovery cycle Promise.all:", error);
|
||||
// Return default structure on catastrophic failure
|
||||
return [{ nodes: [], vms: [], containers: [] }, []];
|
||||
});
|
||||
@@ -668,7 +668,7 @@ async function fetchDiscoveryData(currentApiClients, currentPbsApiClients, _fetc
|
||||
pbs: pbsResult || [] // pbsResult is already the array we need
|
||||
};
|
||||
|
||||
console.log(`[DataFetcher] Discovery cycle completed. Found: ${aggregatedResult.nodes.length} PVE nodes, ${aggregatedResult.vms.length} VMs, ${aggregatedResult.containers.length} CTs, ${aggregatedResult.pbs.length} PBS instances.`);
|
||||
// console.log(`[DataFetcher] Discovery cycle completed. Found: ${aggregatedResult.nodes.length} PVE nodes, ${aggregatedResult.vms.length} VMs, ${aggregatedResult.containers.length} CTs, ${aggregatedResult.pbs.length} PBS instances.`);
|
||||
|
||||
return aggregatedResult;
|
||||
}
|
||||
@@ -681,7 +681,7 @@ async function fetchDiscoveryData(currentApiClients, currentPbsApiClients, _fetc
|
||||
* @returns {Promise<Array>} - Array of metric data objects.
|
||||
*/
|
||||
async function fetchMetricsData(runningVms, runningContainers, currentApiClients) {
|
||||
console.log(`[DataFetcher] Starting metrics fetch for ${runningVms.length} VMs, ${runningContainers.length} Containers...`);
|
||||
// console.log(`[DataFetcher] Starting metrics fetch for ${runningVms.length} VMs, ${runningContainers.length} Containers...`);
|
||||
const allMetrics = [];
|
||||
const metricPromises = [];
|
||||
const guestsByEndpointNode = {};
|
||||
@@ -701,7 +701,7 @@ async function fetchMetricsData(runningVms, runningContainers, currentApiClients
|
||||
// Iterate through endpoints and nodes (existing logic)
|
||||
for (const endpointId in guestsByEndpointNode) {
|
||||
if (!currentApiClients[endpointId]) {
|
||||
console.warn(`WARN: [DataFetcher] No API client found for endpoint: ${endpointId}`);
|
||||
// console.warn(`WARN: [DataFetcher] No API client found for endpoint: ${endpointId}`);
|
||||
continue;
|
||||
}
|
||||
const { client: apiClientInstance, config: endpointConfig } = currentApiClients[endpointId];
|
||||
@@ -765,19 +765,19 @@ async function fetchMetricsData(runningVms, runningContainers, currentApiClients
|
||||
} else {
|
||||
currentMetrics.guest_mem_actual_used_bytes = guestMemoryDetails.total - guestMemoryDetails.free; // Fallback if only total & free
|
||||
}
|
||||
console.log(`[Metrics Cycle - ${endpointName}] VM ${vmid} (${guestName}): Guest agent memory fetched: Actual Used: ${((currentMetrics.guest_mem_actual_used_bytes || 0) / (1024*1024)).toFixed(0)}MB`);
|
||||
// console.log(`[Metrics Cycle - ${endpointName}] VM ${vmid} (${guestName}): Guest agent memory fetched: Actual Used: ${((currentMetrics.guest_mem_actual_used_bytes || 0) / (1024*1024)).toFixed(0)}MB`);
|
||||
} else {
|
||||
console.warn(`[Metrics Cycle - ${endpointName}] VM ${vmid} (${guestName}): Guest agent memory command 'get-memory-block-info' response format not as expected. Data:`, agentMemInfoResponse.data.data);
|
||||
// console.warn(`[Metrics Cycle - ${endpointName}] VM ${vmid} (${guestName}): Guest agent memory command 'get-memory-block-info' response format not as expected. Data:`, agentMemInfoResponse.data.data);
|
||||
}
|
||||
} else {
|
||||
console.warn(`[Metrics Cycle - ${endpointName}] VM ${vmid} (${guestName}): Guest agent memory command 'get-memory-block-info' did not return expected data structure. Response:`, agentMemInfoResponse.data);
|
||||
// console.warn(`[Metrics Cycle - ${endpointName}] VM ${vmid} (${guestName}): Guest agent memory command 'get-memory-block-info' did not return expected data structure. Response:`, agentMemInfoResponse.data);
|
||||
}
|
||||
} catch (agentError) {
|
||||
if (agentError.response && agentError.response.status === 500 && agentError.response.data && agentError.response.data.data && agentError.response.data.data.exitcode === -2) {
|
||||
// Expected error if agent is not running or command not supported.
|
||||
console.log(`[Metrics Cycle - ${endpointName}] VM ${vmid} (${guestName}): QEMU Guest Agent not responsive or command 'get-memory-block-info' not available/supported. Error: ${agentError.message}`);
|
||||
// console.log(`[Metrics Cycle - ${endpointName}] VM ${vmid} (${guestName}): QEMU Guest Agent not responsive or command 'get-memory-block-info' not available/supported. Error: ${agentError.message}`);
|
||||
} else {
|
||||
console.warn(`[Metrics Cycle - ${endpointName}] VM ${vmid} (${guestName}): Error fetching guest agent memory info: ${agentError.message}. Status: ${agentError.response?.status}`);
|
||||
// console.warn(`[Metrics Cycle - ${endpointName}] VM ${vmid} (${guestName}): Error fetching guest agent memory info: ${agentError.message}. Status: ${agentError.response?.status}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -798,9 +798,9 @@ async function fetchMetricsData(runningVms, runningContainers, currentApiClients
|
||||
} catch (err) {
|
||||
const status = err.response?.status ? ` (Status: ${err.response.status})` : '';
|
||||
if (err.response && err.response.status === 400) {
|
||||
console.warn(`[Metrics Cycle - ${endpointName}] Guest ${type} ${vmid} (${guestName}) on node ${nodeName} might be stopped or inaccessible (Status: 400). Skipping metrics.`);
|
||||
// console.warn(`[Metrics Cycle - ${endpointName}] Guest ${type} ${vmid} (${guestName}) on node ${nodeName} might be stopped or inaccessible (Status: 400). Skipping metrics.`);
|
||||
} else {
|
||||
console.error(`[Metrics Cycle - ${endpointName}] Failed to get metrics for ${type} ${vmid} (${guestName}) on node ${nodeName}${status}: ${err.message}`);
|
||||
// console.error(`[Metrics Cycle - ${endpointName}] Failed to get metrics for ${type} ${vmid} (${guestName}) on node ${nodeName}${status}: ${err.message}`);
|
||||
}
|
||||
return null; // Return null on error for this specific guest
|
||||
}
|
||||
@@ -821,7 +821,7 @@ async function fetchMetricsData(runningVms, runningContainers, currentApiClients
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`[DataFetcher] Completed metrics fetch. Got data for ${allMetrics.length} guests.`);
|
||||
// console.log(`[DataFetcher] Completed metrics fetch. Got data for ${allMetrics.length} guests.`);
|
||||
return allMetrics;
|
||||
}
|
||||
|
||||
@@ -859,7 +859,7 @@ async function fetchPbsNodeStatus({ client, config }, nodeName) {
|
||||
kversion: statusData.kversion || null
|
||||
};
|
||||
} catch (error) {
|
||||
console.warn(`WARN: [DataFetcher] Failed to fetch PBS node status for ${config.name}: ${error.message}`);
|
||||
// console.warn(`WARN: [DataFetcher] Failed to fetch PBS node status for ${config.name}: ${error.message}`);
|
||||
return {
|
||||
cpu: null,
|
||||
memory: { total: null, used: null, free: null },
|
||||
@@ -889,7 +889,7 @@ async function fetchPbsVersionInfo({ client, config }) {
|
||||
subscriptionInfo = subscriptionResponse.data?.data || null;
|
||||
} catch (subError) {
|
||||
// Subscription endpoint might not be accessible or might not exist
|
||||
console.warn(`WARN: [DataFetcher] Could not fetch subscription info for ${config.name}: ${subError.message}`);
|
||||
// console.warn(`WARN: [DataFetcher] Could not fetch subscription info for ${config.name}: ${subError.message}`);
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -899,7 +899,7 @@ async function fetchPbsVersionInfo({ client, config }) {
|
||||
subscription: subscriptionInfo
|
||||
};
|
||||
} catch (error) {
|
||||
console.warn(`WARN: [DataFetcher] Failed to fetch PBS version info for ${config.name}: ${error.message}`);
|
||||
// console.warn(`WARN: [DataFetcher] Failed to fetch PBS version info for ${config.name}: ${error.message}`);
|
||||
return {
|
||||
version: null,
|
||||
release: null,
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ function processPbsTasks(allTasks) {
|
||||
});
|
||||
|
||||
if (unmappedTypes.size > 0) {
|
||||
console.warn('WARN: [pbsUtils] Unmapped PBS task types found:', Array.from(unmappedTypes));
|
||||
// console.warn('WARN: [pbsUtils] Unmapped PBS task types found:', Array.from(unmappedTypes));
|
||||
}
|
||||
|
||||
const createDetailedTask = (task) => ({
|
||||
|
||||
@@ -429,7 +429,7 @@ PulseApp.alerts = (() => {
|
||||
// Only show notifications for critical alerts or escalated alerts to reduce noise
|
||||
const shouldShowNotification = alert.severity === 'critical' || alert.escalated;
|
||||
if (shouldShowNotification) {
|
||||
showNotification(alert, alert.severity);
|
||||
// showNotification(alert, alert.severity);
|
||||
}
|
||||
|
||||
if (alertDropdown && !alertDropdown.classList.contains('hidden')) {
|
||||
@@ -453,7 +453,7 @@ PulseApp.alerts = (() => {
|
||||
// Only show resolved notifications for previously critical/escalated alerts
|
||||
const shouldShowNotification = alert.severity === 'critical' || alert.escalated;
|
||||
if (shouldShowNotification) {
|
||||
showNotification(alert, 'resolved');
|
||||
// showNotification(alert, 'resolved');
|
||||
}
|
||||
|
||||
if (alertDropdown && !alertDropdown.classList.contains('hidden')) {
|
||||
@@ -617,7 +617,7 @@ PulseApp.alerts = (() => {
|
||||
} catch (error) {
|
||||
console.error('[Alerts] Failed to acknowledge alert:', error);
|
||||
// Only show notification for actual errors
|
||||
showNotification({ message: `Failed to acknowledge alert: ${error.message}` }, 'warning');
|
||||
// showNotification({ message: `Failed to acknowledge alert: ${error.message}` }, 'warning');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -684,7 +684,7 @@ PulseApp.alerts = (() => {
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[Alerts] Failed to suppress alert:', error);
|
||||
showNotification({ message: `Failed to suppress alert: ${error.message}` }, 'warning');
|
||||
// showNotification({ message: `Failed to suppress alert: ${error.message}` }, 'warning');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -769,9 +769,9 @@ PulseApp.alerts = (() => {
|
||||
|
||||
// Only show notifications for errors - success is visual (alerts disappear/change)
|
||||
if (errorCount > 0) {
|
||||
showNotification({
|
||||
message: `${errorCount} alerts failed to acknowledge`
|
||||
}, 'warning');
|
||||
// showNotification({
|
||||
// message: `${errorCount} alerts failed to acknowledge`
|
||||
// }, 'warning');
|
||||
}
|
||||
// No "success" notification needed - user can see alerts are acknowledged
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user