How do I run top and ps commands inside middlware pod on OCP?

Solution Unverified - Updated -


  • How do I identify high CPU utilization by Java threads on OCP?
  • Container images such as jboss-webserver-5/jws56-openjdk11-openshift-rhel8 and jboss-eap-7/eap74-openjdk11-openshift-rhel8, which are based on ubi8, do not have procps-ng package as follows:

    [lab@master ~]$ oc rsh <mw-pod-name>
    sh-4.4$ top -b -n 1 -H -p <java-pid>
    sh: top: command not found
    sh-4.4$ ps
    sh: ps: command not found
  • CPU metrics such as container_cpu_user_seconds_total and container_cpu_system_seconds_total as cAdvisor metrics are collected by OpenShift Monitoring, but these metrics are in units of containers, and no cpu-usage metrics per thread in cAdvisor.

  • Scraping interval of cpu utilization that can be referred in OpenShift monitoring stack is 30 seconds, but I need to check cpu utilization at finer intervals to identify burst load for a couple of seconds.
  • Is Ephemeral Containers supported in OpenShift?


  • Red Hat OpenShift Container Platform (OCP)
    • 4.x
    • 3.x
  • Middleware containers based on ubi8

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content