Skip to content

Instantly share code, notes, and snippets.

@wica128
Created May 22, 2020 08:37
Show Gist options
  • Save wica128/9d0f530b13e1cfdc73096e41743ac1a0 to your computer and use it in GitHub Desktop.
Save wica128/9d0f530b13e1cfdc73096e41743ac1a0 to your computer and use it in GitHub Desktop.
Search in Cepg for defect OSD.
#!/bin/bash
printf "PGID\tOSD\tPRIM\tERROR\n"
for pg in $(ceph pg dump pgs --format=json-pretty 2> /dev/null|jq -r '.[]|select (.state|test("inconsistent"))| .pgid'); do
res=$(rados list-inconsistent-obj $pg --format=json-pretty| jq -r '.inconsistents[].shards[]|select(.errors |length > 0)| [.osd,.primary,.errors[]]|@tsv')
printf "%s\t%s\t%s\t%s\n" $pg $res
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment