useful_scripts/check_avail_pci.sh
Arif Ali bb166ecc96
Update to latest scripts
* do_innodb_resolution.sh: mostly now works, the timing between
  update-status and the add-instance may need to be tweaked still
* vault.sh: use juju status json to grab the IPs for the vault units
* check_juju.sh: add debug to the default status
* check_avail_pci.sh: add hypervisor_name to the output to make it
  easier to grab multiple nodes
* get_passwords.sh: add extra password for collection
2024-01-09 14:19:47 +00:00

22 lines
626 B
Bash
Executable File

#!/bin/bash
NODE=$1
usage() {
echo "Usage: ${0} [node-name]" 1>&2
exit 0
}
get_pci(){
RO_MYSQL_UNIT=$(juju status --format json | jq -r '[.applications."mysql-innodb-cluster".units | to_entries[]| select(.value."workload-status".message | contains("R/O")) | .key] | .[0]')
PASSWORD=$(juju run --unit mysql-innodb-cluster/leader leader-get mysql.passwd)
juju ssh $RO_MYSQL_UNIT "sudo mysql -u root -p$PASSWORD -e \"select pci_stats,hypervisor_hostname from nova.compute_nodes where hypervisor_hostname like '%$NODE%' and deleted_at is NULL\G;\""
}
if [ $# -ne 1 ]; then
usage
else
get_pci
fi