diff --git a/ui/src/config/section/infra.js b/ui/src/config/section/infra.js
index c371ff9f29e..41b08fc6f51 100644
--- a/ui/src/config/section/infra.js
+++ b/ui/src/config/section/infra.js
@@ -26,6 +26,7 @@ import secondaryStorages from '@/config/section/infra/secondaryStorages'
import systemVms from '@/config/section/infra/systemVms'
import routers from '@/config/section/infra/routers'
import ilbvms from '@/config/section/infra/ilbvms'
+import managementServers from '@/config/section/infra/managementServers'
export default {
name: 'infra',
@@ -51,6 +52,7 @@ export default {
systemVms,
routers,
ilbvms,
+ managementServers,
{
name: 'cpusocket',
title: 'label.cpu.sockets',
@@ -60,11 +62,12 @@ export default {
component: () => import('@/views/infra/CpuSockets.vue')
},
{
- name: 'managementserver',
- title: 'label.management.servers',
- icon: 'RocketOutlined',
- permission: ['listManagementServers'],
- columns: ['name', 'state', 'version']
+ name: 'metric',
+ title: 'label.db.usage.metrics',
+ icon: 'bar-chart-outlined',
+ docHelp: 'adminguide/management.html#metrics',
+ permission: ['listDbMetrics', 'listUsageServerMetrics'],
+ component: () => import('@/views/infra/Metrics.vue')
},
{
name: 'alert',
diff --git a/ui/src/config/section/infra/managementServers.js b/ui/src/config/section/infra/managementServers.js
new file mode 100644
index 00000000000..b79c9a03ce4
--- /dev/null
+++ b/ui/src/config/section/infra/managementServers.js
@@ -0,0 +1,41 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import store from '@/store'
+import { shallowRef, defineAsyncComponent } from 'vue'
+
+export default {
+ name: 'managementserver',
+ title: 'label.management.servers',
+ icon: 'CloudServerOutlined',
+ permission: ['listManagementServersMetrics'],
+ columns: () => {
+ const fields = ['name', 'state', 'version']
+ const metricsFields = ['collectiontime', 'availableprocessors', 'cpuload', 'systemmemoryused', 'heapmemoryused', 'agentcount']
+ if (store.getters.metrics) {
+ fields.push(...metricsFields)
+ }
+ return fields
+ },
+ details: ['collectiontime', 'usageislocal', 'dbislocal', 'lastserverstart', 'lastserverstop', 'lastboottime', 'version', 'loginfo', 'systemtotalcpucycles', 'systemloadaverages', 'systemcycleusage', 'systemmemorytotal', 'systemmemoryfree', 'systemmemoryused', 'systemmemoryvirtualsize', 'availableprocessors', 'javadistribution', 'javaversion', 'osdistribution', 'kernelversion', 'agentcount', 'sessions', 'heapmemoryused', 'heapmemorytotal', 'threadsblockedcount', 'threadsdeamoncount', 'threadsnewcount', 'threadsrunnablecount', 'threadsterminatedcount', 'threadstotalcount', 'threadswaitingcount'],
+ tabs: [
+ {
+ name: 'details',
+ component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue')))
+ }
+ ]
+}
diff --git a/ui/src/core/lazy_lib/icons_use.js b/ui/src/core/lazy_lib/icons_use.js
index 252350bfa80..e02578d99ab 100644
--- a/ui/src/core/lazy_lib/icons_use.js
+++ b/ui/src/core/lazy_lib/icons_use.js
@@ -24,6 +24,7 @@ import {
ArrowsAltOutlined,
AuditOutlined,
BankOutlined,
+ BarChartOutlined,
BarcodeOutlined,
BarsOutlined,
BellOutlined,
@@ -48,10 +49,12 @@ import {
CloseOutlined,
CloudDownloadOutlined,
CloudOutlined,
+ CloudServerOutlined,
CloudUploadOutlined,
ClusterOutlined,
CodeOutlined,
CompassOutlined,
+ ControlOutlined,
CopyOutlined,
CreditCardOutlined,
DashboardOutlined,
@@ -167,6 +170,7 @@ export default {
app.component('ArrowsAltOutlined', ArrowsAltOutlined)
app.component('AuditOutlined', AuditOutlined)
app.component('BankOutlined', BankOutlined)
+ app.component('BarChartOutlined', BarChartOutlined)
app.component('BarcodeOutlined', BarcodeOutlined)
app.component('BarsOutlined', BarsOutlined)
app.component('BellOutlined', BellOutlined)
@@ -191,9 +195,11 @@ export default {
app.component('CloseOutlined', CloseOutlined)
app.component('CloudDownloadOutlined', CloudDownloadOutlined)
app.component('CloudOutlined', CloudOutlined)
+ app.component('CloudServerOutlined', CloudServerOutlined)
app.component('CloudUploadOutlined', CloudUploadOutlined)
app.component('ClusterOutlined', ClusterOutlined)
app.component('CodeOutlined', CodeOutlined)
+ app.component('ControlOutlined', ControlOutlined)
app.component('CompassOutlined', CompassOutlined)
app.component('CopyOutlined', CopyOutlined)
app.component('CreditCardOutlined', CreditCardOutlined)
diff --git a/ui/src/views/AutogenView.vue b/ui/src/views/AutogenView.vue
index 30ab08174c0..7bcdcd65fef 100644
--- a/ui/src/views/AutogenView.vue
+++ b/ui/src/views/AutogenView.vue
@@ -33,7 +33,7 @@
{{ $t('label.refresh') }}
+
+
+
+
+
+ {{ $t('label.refresh') }}
+ {{ $t('label.refresh') }}
+
+
+
+
+
+
+
+
+
+ {{ $t('label.desc.db.stats') }}
+
+
+
+
+
+
+
+ {{ $t('label.desc.usage.stats') }}
+
+
+
+
{{ $t('label.usage.explanation') }}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/utils/src/main/java/com/cloud/utils/LogUtils.java b/utils/src/main/java/com/cloud/utils/LogUtils.java
index d86766ccc02..a7e325794ce 100644
--- a/utils/src/main/java/com/cloud/utils/LogUtils.java
+++ b/utils/src/main/java/com/cloud/utils/LogUtils.java
@@ -20,26 +20,56 @@
package com.cloud.utils;
import java.io.File;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+import org.apache.log4j.Appender;
+import org.apache.log4j.FileAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.xml.DOMConfigurator;
public class LogUtils {
- public static final Logger s_logger = Logger.getLogger(LogUtils.class);
+ public static final Logger LOGGER = Logger.getLogger(LogUtils.class);
+
+ private static String configFileLocation = null;
public static void initLog4j(String log4jConfigFileName) {
assert (log4jConfigFileName != null);
File file = PropertiesUtil.findConfigFile(log4jConfigFileName);
if (file != null) {
- s_logger.info("log4j configuration found at " + file.getAbsolutePath());
- DOMConfigurator.configureAndWatch(file.getAbsolutePath());
+ configFileLocation = file.getAbsolutePath();
+ DOMConfigurator.configureAndWatch(configFileLocation);
} else {
String nameWithoutExtension = log4jConfigFileName.substring(0, log4jConfigFileName.lastIndexOf('.'));
file = PropertiesUtil.findConfigFile(nameWithoutExtension + ".properties");
if (file != null) {
- s_logger.info("log4j configuration found at " + file.getAbsolutePath());
- DOMConfigurator.configureAndWatch(file.getAbsolutePath());
+ configFileLocation = file.getAbsolutePath();
+ DOMConfigurator.configureAndWatch(configFileLocation);
}
}
+ if (configFileLocation != null) {
+ LOGGER.info("log4j configuration found at " + configFileLocation);
+ }
+ }
+ public static Set getLogFileNames() {
+ Set fileNames = new HashSet<>();
+ Enumeration appenders = LOGGER.getRootLogger().getAllAppenders();
+ int appenderCount=0;
+ while (appenders.hasMoreElements()) {
+ ++appenderCount;
+ Appender currAppender = (Appender) appenders.nextElement();
+ if (currAppender instanceof FileAppender) {
+ String fileName =((FileAppender) currAppender).getFile();
+ fileNames.add(fileName);
+ LOGGER.debug(String.format("file for %s : %s", currAppender.getName(), fileName));
+ } else if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(String.format("not counting %s as a file.", currAppender.getName()));
+ }
+ }
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(String.format("out of %d appenders, %d are log files", appenderCount, fileNames.size()));
+ }
+ return fileNames;
}
}