Created
August 15, 2022 00:08
-
-
Save si3mshady/21f1ed9518397fffabbec5480dad54ec to your computer and use it in GitHub Desktop.
AWK practice - filter kubectl output to show counts for running, errorImagePull and imagePullBackup
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
BEGIN { | |
imagePullBackOff=0 | |
running=0 | |
errorImagePull=0 | |
} | |
{ | |
if ( match($3,/ImagePullBackOff/)) { imagePullBackOff++ ; system("echo 1 >> ./imagePullBackOff")} | |
else if ( match($3,/ErrImagePull/)) {errorImagePull++ ; system("echo 1 >> ./errorImagePull")} | |
else if ( match($3,/Running/)) {running++ ; system("echo 1 >> ./running") } | |
} | |
END { | |
print "Total running count", running | |
print "Total errorImagePull count", errorImagePull | |
print "Total imagePullbackOff count", imagePullBackOff | |
} | |
#kubectl get pods | awk -f <filename>.awk | |
#Elliott Arnold 8-14-22. Working w/ Client |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment