export ETCDCTL_API=3
etcdctl \
--endpoints="https://etcd1:2379,https://etcd2:2379,https://etcd3:2379" \
--cacert=/path/to/ca.crt \
--cert=/path/to/client.crt \
--key=/path/to/client.key \
endpoint status --write-out=json |
jq -r '
def mib: . / 1048576;
["ENDPOINT", "DB_MiB", "IN_USE_MiB", "FRAGMENTED_MiB", "FRAGMENTED_%"],
(
.[] |
.Status.dbSize as $total |
.Status.dbSizeInUse as $used |
[
.Endpoint,
(($total | mib) * 100 | round / 100),
(($used | mib) * 100 | round / 100),
((($total - $used) | mib) * 100 | round / 100),
((($total - $used) * 10000 / $total) | round / 100)
]
) |
@tsv
' | column -t





0 comments:
Post a Comment