useful_scripts/check_innodb.sh

19 lines
578 B
Bash
Raw Normal View History

#!/bin/bash
2023-06-19 13:45:13 +00:00
check_controller()
{
controller=$1
2023-06-19 13:45:13 +00:00
model="${controller}:cpe-focal"
2023-06-19 13:45:13 +00:00
RW_MYSQL_UNIT=$(juju status -m ${model} --format json | jq -r '[.applications."mysql-innodb-cluster".units | to_entries[]| select(.value."workload-status".message | contains("R/W")) | .key] | .[0]')
juju run-action -m ${model} ${RW_MYSQL_UNIT} --wait cluster-status --format json | jq -rc '.[].results."cluster-status"' | jq
}
if [[ -z "$1" ]] ; then
check_controller "$(juju controllers --format json | jq -r .\"current-controller\")"
else
check_controller "${1}"
fi