Last active
March 19, 2017 04:19
-
-
Save DavidWittman/d3a68b15c27944cf646b5a33fa60cfaf to your computer and use it in GitHub Desktop.
Revisions
-
DavidWittman revised this gist
Mar 19, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ List the number of primary shards per data node in Elasticsearch: ``` bash curl -s localhost:9200/_cat/shards?h=node,prirep | awk ' $2 == "p" { result[$1] += 1; total += 1 } -
DavidWittman revised this gist
Mar 18, 2017 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,10 +4,11 @@ List the number of primary shards per data node in Elasticsearch: curl localhost:9200/_cat/shards?h=node,prirep | awk ' $2 == "p" { result[$1] += 1; total += 1 } END { for (var in result) printf "%s\t%s (%0.2f%%)\n",var,result[var],result[var]/total*100 }' ``` It's not exactly a one-liner but I tried to make the AWK somewhat legible. -
DavidWittman created this gist
Mar 18, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ List the number of primary shards per data node in Elasticsearch: ``` bash curl localhost:9200/_cat/shards?h=node,prirep | awk ' $2 == "p" { result[$1] += 1; total += 1 } END { for (var in result) printf "%s\t%s (%0.2f%%)\n",var,result[var],result[var]/total*100 }' ``` It's not exactly a one-liner but i tried to make the AWK somewhat legible.