#示例修改volumes pool 的pg数到4096;每次增加8个pg.#!/bin/bashnum=8dest_num=4096check_ceph_status(){stat=$(ceph health detail)}check_dest(){now_num=$(ceph osd pool get volumes pg_num |awk'{print $2}')if[[$now_num-eq$dest_num]];thenbreakfi}chage_pool_pgnum(){
check_dest
letnew_num=$now_num+$num
ceph osd pool set volumes pg_num $new_num
ceph osd pool set volumes pgp_num $new_num}action(){
check_ceph_status
if[[$stat=="HEALTH_OK"]];then
chage_pool_pgnum
fi}df_res(){used=$(ceph osd df|sort-nk7|sed-n'$p'|awk'{print $7}')if[[$used>75.00]];thenbreakfi}main(){true> /var/log/updatepg.log
set-eset-xvexec2> /var/log/updatepg
whiletrue;do
df_res
action
sleep60done}
main