Skip to content

Commit

Permalink
Issue 5521 - UI - Update plugins for new split PAM and LDAP pass thru…
Browse files Browse the repository at this point in the history
… auth

Description:  Previously PAM and LDAP pass thru auth plugins were merged.  This change
separates them into their own plugins in the UI.

Also improved memory reporting in monitor tab.

relates: #5521

Reviewed by: spichugi(Thanks!)
  • Loading branch information
mreynolds389 committed Jan 5, 2023
1 parent 81c34ad commit 35f2f89
Show file tree
Hide file tree
Showing 6 changed files with 1,084 additions and 974 deletions.
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

0 comments on commit 35f2f89

Please sign in to comment.