Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 5521 - UI - Update plugins for new split PAM and LDAP pass thru auth #5586

Merged
merged 1 commit into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions src/cockpit/389-console/src/lib/monitor/serverMonitor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,29 @@ export class ServerMonitor extends React.Component {
});
}

convertMemory(mem_str) {
mem_str = mem_str.replace(",", ".")
if (mem_str.endsWith('m')) {
// Convert MB to KB
let mem = mem_str.slice(0, -1);
return parseInt(Math.round(mem * 1024));
} else if (mem_str.endsWith('g')) {
// Convert GB to KB
let mem = mem_str.slice(0, -1);
return parseInt(Math.round(mem * 1024 * 1024));
} else if (mem_str.endsWith('t')) {
// Convert TB to KB
let mem = mem_str.slice(0, -1);
return parseInt(Math.round(mem * 1024 * 1024 * 1024));
} else if (mem_str.endsWith('p')) {
// Convert PB to KB
let mem = mem_str.slice(0, -1);
return parseInt(Math.round(mem * 1024 * 1024 * 1024 * 1024));
} else {
return mem_str;
}
}

refreshCharts() {
const cmd = "ps -ef | grep -v grep | grep dirsrv/slapd-" + this.props.serverId;
let cpu = 0;
Expand All @@ -135,8 +158,8 @@ export class ServerMonitor extends React.Component {
.script(cpu_cmd, [], { superuser: true, err: "message" })
.done(top_output => {
const top_parts = top_output.trim().split(/\s+/);
virt_mem = top_parts[4];
res_mem = top_parts[5];
virt_mem = this.convertMemory(top_parts[4]);
res_mem = this.convertMemory(top_parts[5]);
cpu = parseInt(top_parts[8]);
const mem_cmd = "awk '/MemTotal/{print $2}' /proc/meminfo";
// log_cmd("refreshCharts", "Get total memory", [mem_cmd]);
Expand Down
Loading