Skip to content

Commit

Permalink
fix: Get resource usage without root
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Nov 26, 2024
1 parent 909a004 commit 22e774b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/modules/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export async function getDiskUsage(
// Returns a list of all processes and their memory usage
async function getProcessesMemory() {
// Get a snapshot of system CPU and memory usage
const ps = await $`ps -Ao pid,pss --no-header`
const ps = await $`docker exec --privileged -it $HOSTNAME ps -Ao pid,pss --no-header`

// Format snapshot data
const processes = ps.stdout.split('\n').map((line) => {
Expand Down Expand Up @@ -188,7 +188,7 @@ export async function getMemoryUsage(umbreld: Umbreld): Promise<{
// Returns a list of all processes and their cpu usage
async function getProcessesCpu() {
// Get a snapshot of system CPU and memory usage
const top = await $`top --batch-mode --iterations 1`
const top = await $`docker exec --privileged -it $HOSTNAME top --batch-mode --iterations 1`

// Get lines
const lines = top.stdout.split('\n').map((line) => line.trim().split(/\s+/))
Expand Down

0 comments on commit 22e774b

Please sign in to comment.