Created
December 2, 2020 18:28
-
-
Save jovemfelix/919e48139ec0986cf93888340ac1f231 to your computer and use it in GitHub Desktop.
Compute DateTime of Pod's in Openshif
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| v_values=$(oc get pods --all-namespaces --field-selector status.phase==Running -o wide | awk 'FNR > 1 {printf $1;printf ";";printf $2;printf ";";printf $8;printf "\n"}' ) | |
| for v_pod_and_node in $(echo $v_values); do | |
| v_namespace=$(echo $v_pod_and_node | awk -F ";" '{print $1}') | |
| v_pod=$(echo $v_pod_and_node | awk -F ";" '{print $2}') | |
| v_node=$(echo $v_pod_and_node | awk -F ";" '{print $3}') | |
| oc -n $v_namespace rsh $v_pod /bin/sh -i -c 'printf "$(date '+%Y%m%d%H%M%S')"' | |
| printf ";$v_pod;$v_namespace;$v_node\n" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment