ceph打印出每秒的IO和pg狀態


前言

在ceph 的jewel版本以及之前的版本,通過ceph -w命令是可以拿到每秒鍾ceph集群的io狀態的,現在的版本是ceph -s一秒秒手動去刷,ceph -w也不監控io的狀態了,有的時候需要看io是否平滑,或者恢復還剩多少,能夠比較直觀的去看

實際上通過簡單的腳本就可以實現之前差不多的效果

每秒查看狀態

[root@lab201 ~]# sh ceph-s.sh 
Wed Sep  9 10:44:57 CST 2020	192 pgs: 192 active+clean; 1.30GiB data, 13.3GiB used, 287GiB / 300GiB avail; 93.3KiB/s rd, 0B/s wr, 155op/s
Wed Sep  9 10:44:58 CST 2020	192 pgs: 192 active+clean; 1.30GiB data, 13.3GiB used, 287GiB / 300GiB avail; 91.7KiB/s rd, 0B/s wr, 152op/s
Wed Sep  9 10:45:00 CST 2020	192 pgs: 192 active+clean; 1.30GiB data, 13.3GiB used, 287GiB / 300GiB avail; 94.6KiB/s rd, 0B/s wr, 157op/s
Wed Sep  9 10:45:01 CST 2020	192 pgs: 192 active+clean; 1.30GiB data, 13.3GiB used, 287GiB / 300GiB avail; 94.6KiB/s rd, 0B/s wr, 157op/s
Wed Sep  9 10:45:02 CST 2020	192 pgs: 192 active+clean; 1.30GiB data, 13.3GiB used, 287GiB / 300GiB avail; 88.3KiB/s rd, 0B/s wr, 147op/s
Wed Sep  9 10:45:03 CST 2020	192 pgs: 192 active+clean; 1.30GiB data, 13.3GiB used, 287GiB / 300GiB avail; 88.3KiB/s rd, 0B/s wr, 147op/s
Wed Sep  9 10:45:04 CST 2020	192 pgs: 192 active+clean; 1.30GiB data, 13.3GiB used, 287GiB / 300GiB avail; 69.6KiB/s rd, 0B/s wr, 115op/s
Wed Sep  9 10:45:06 CST 2020	192 pgs: 192 active+clean; 1.30GiB data, 13.3GiB used, 287GiB / 300GiB avail; 92.6KiB/s rd, 0B/s wr, 154op/s
Wed Sep  9 10:45:07 CST 2020	192 pgs: 192 active+clean; 1.30GiB data, 13.3GiB used, 287GiB / 300GiB avail; 92.6KiB/s rd, 0B/s wr, 154op/s
Wed Sep  9 10:45:08 CST 2020	192 pgs: 192 active+clean; 1.30GiB data, 13.3GiB used, 287GiB / 300GiB avail; 90.0KiB/s rd, 0B/s wr, 150op/s
Wed Sep  9 10:45:09 CST 2020	192 pgs: 192 active+clean; 1.30GiB data, 13.3GiB used, 287GiB / 300GiB avail; 90.0KiB/s rd, 0B/s wr, 150op/s
Wed Sep  9 10:45:10 CST 2020	192 pgs: 192 active+clean; 1.30GiB data, 13.3GiB used, 287GiB / 300GiB avail; 90.1KiB/s rd, 0B/s wr, 150op/s
Wed Sep  9 10:45:12 CST 2020	192 pgs: 192 active+clean; 1.30GiB data, 13.3GiB used, 287GiB / 300GiB avail; 92.8KiB/s rd, 0B/s wr, 154op/s
Wed Sep  9 10:45:13 CST 2020	192 pgs: 192 active+clean; 1.30GiB data, 13.3GiB used, 287GiB / 300GiB avail; 92.8KiB/s rd, 0B/s wr, 154op/s

需要有時間,需要每秒的狀態方便比對,如上所示

腳本

[root@lab201 ~]# cat ceph-s.sh 
#!/bin/bash
LANG=C
PATH=/sbin:/usr/sbin:/bin:/usr/bin
interval=1
length=86400
for i in $(seq 1 $(expr ${length} / ${interval}));do
date=`date`
echo -n "$date	"
ceph pg stat
sleep ${interval}
done

可以自行調整中間的間隔

變更記錄

Why Who When
創建 武漢-運維-磨渣 2020-09-09


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM