Configure toprc with additional fields P, NU, CGNAME

This configures top using toprc configuration file for
sysadmin and root. This enables fields: P, NU, CGNAME,
and shows full command arguments by default.

This improves the System Engineering debugability of the
system since we can easier see where a task is running.
We see what logical cpu a task is currently running with
'P' last cpu used and 'NU' numa node, and see what systemd
cgroup name with 'CGNAME'. This also helps diagnose tasks
running in pods since they belong to well named cgroups.

Partial-Bug: 2084714

TEST PLAN:
- PASS: Fresh install AIO-SX, AIO-DX, Standard, Storage, DC
- PASS: run 'top' as sysadmin and root user, verify
  we see 'P', 'NU', 'CGNAME' and command arguments.

Change-Id: I50d8f25336a980bcdcba4d94ea727fee9726a527
Signed-off-by: Jim Gauld <James.Gauld@windriver.com>
This commit is contained in:
Jim Gauld 2024-11-14 19:36:54 -05:00
parent 3e0d07fc35
commit f5b83fe391
2 changed files with 62 additions and 7 deletions

View File

@ -84,16 +84,55 @@ class platform::collectd
mode => '0600',
}
# Crontab entry for rss daily Memory log.
# Crontab entry for monitoring rss daily Memory log.
cron { 'memory-logs':
ensure => 'present',
command => '/usr/bin/date >> /var/log/rss-memory.log; /usr/bin/ps -e -o ppid,pid,nlwp,rss:10,vsz:10,comm,cmd --sort=-rss >> /var/log/rss-memory.log', # lint:ignore:140chars
environment => 'PATH=/bin:/usr/bin:/usr/sbin',
minute => '00',
hour => '1',
user => 'root',
ensure => 'present',
environment => 'PATH=/bin:/usr/bin:/usr/sbin',
minute => '00',
hour => '1',
user => 'root',
command => @(EOL/L),
date --rfc-3339=s >> /var/log/rss-memory.log; \
ps -e -o ppid,pid,nlwp,rss:10,vsz:10,comm,cmd --sort=-rss \
>> /var/log/rss-memory.log
|- EOL
}
# Install custom toprc for root user;
# gives fields: P, NU, CGNAME, and command args
file { [ '/root/.config', '/root/.config/procps' ]:
ensure => 'directory',
owner => 'root',
group => 'root',
mode => '0700',
}
-> file { '/root/.config/procps/toprc':
ensure => 'present',
replace => true,
content => template('platform/toprc.erb'),
owner => 'root',
group => 'root',
mode => '0644',
}
# Install custom toprc for sysadmin user
# gives fields: P, NU, CGNAME, and command args
file { [ '/home/sysadmin/.config', '/home/sysadmin/.config/procps' ]:
ensure => 'directory',
owner => 'sysadmin',
group => 'sys_protected',
mode => '0700',
}
-> file { '/home/sysadmin/.config/procps/toprc':
ensure => 'present',
replace => true,
content => template('platform/toprc.erb'),
owner => 'sysadmin',
group => 'sys_protected',
mode => '0644',
}
}
class platform::collectd::runtime {
include ::platform::collectd
}

View File

@ -0,0 +1,16 @@
top's Config File (Linux processes with windows)
Id:j, Mode_altscr=0, Mode_irixps=1, Delay_time=3.0, Curwin=0
Def fieldscur=¥¨³´»½ÀÄ·º¹¶ÞÝÅ&')*+,-./01258<>?ABCFGHIJKLMNOPQRSTUVWXYZ[\_`abcdefghijklmnopqrstuvwxyz
winflags=193972, sortindx=18, maxtasks=0, graph_cpus=0, graph_mems=0, double_up=0, combine_cpus=0
summclr=1, msgsclr=1, headclr=3, taskclr=1
Job fieldscur=¥¦¹·º(³´Ä»½@<§Å)*+,-./012568>?ABCFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz
winflags=193844, sortindx=0, maxtasks=0, graph_cpus=0, graph_mems=0, double_up=0, combine_cpus=0
summclr=6, msgsclr=6, headclr=7, taskclr=6
Mem fieldscur=¥º»<½¾¿ÀÁMBNÃD34·Å&'()*+,-./0125689FGHIJKLOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz
winflags=193844, sortindx=21, maxtasks=0, graph_cpus=0, graph_mems=0, double_up=0, combine_cpus=0
summclr=5, msgsclr=5, headclr=4, taskclr=5
Usr fieldscur=¥¦§¨ª°¹·ºÄÅ)+,-./1234568;<=>?@ABCFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz
winflags=193844, sortindx=3, maxtasks=0, graph_cpus=0, graph_mems=0, double_up=0, combine_cpus=0
summclr=3, msgsclr=3, headclr=2, taskclr=3
Fixed_widest=0, Summ_mscale=1, Task_mscale=0, Zero_suppress=0