Skip to content

Instantly share code, notes, and snippets.

@arcolife
Last active July 28, 2017 08:29
Show Gist options
  • Select an option

  • Save arcolife/e1d227acd9127d03e2c538c58cd941ee to your computer and use it in GitHub Desktop.

Select an option

Save arcolife/e1d227acd9127d03e2c538c58cd941ee to your computer and use it in GitHub Desktop.
openshift single pod metrics extraction hack

If you can launch hawkular,

https://github.com/openshift/origin-metrics/blob/master/docs/hawkular_metrics.adoc

tangentially related: https://docs.openshift.com/container-platform/3.5/rest_api/openshift_v1.html

If using Raspberry Pi and concerned about launching hawkular (per se, extra pod resource contraints):

Get the pid..

# if docker installed and can list down containers running on openshift:
docker inspect `docker ps | grep <pod name> | grep ose-pod | awk '{print $NF}'` | grep -i pid

# if not
<I then have no idea how to get PID of pod in openshift>

Get usage:

egrep --color 'VmSwap|VmRSS' /proc/<PID>/status
top -p 4230
# or any other linux standard tool to get info on a PID

#########

Example:

[root@openshift-master hello-python]# docker inspect `docker ps | grep hawkular-cassandra-1-mpjmy | grep ose-pod | awk '{print $NF}'` | grep -i pid
            "Pid": 4230,
            "PidMode": "",
            "PidsLimit": 0,

[root@openshift-master hello-python]# egrep --color 'VmSwap|VmRSS' /proc/4230/status 
VmRSS:	     672 kB
VmSwap:	       0 kB

# or use pidstat or whatever
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment