UPD: format changes

This commit is contained in:
xpk 2021-01-20 16:08:30 +08:00
parent 178bb707fc
commit bbdf1f1e37
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86

View File

@ -1,18 +1,20 @@
#!/bin/bash #!/bin/bash
. /root/openrc . /root/openrc
echo "Openstack usage generated on $(date)" echo "Openstack usage generated on $(date)"
echo -en "Number of active VMs: "
echo -en "\nNumber of active VMs: "
mysql nova -Nse "select count(1) from instances where vm_state = 'active'" mysql nova -Nse "select count(1) from instances where vm_state = 'active'"
openstack usage list
echo -en "Ceph "
ssh 1063757-ceph1 "ceph -s" | grep usage
echo -en "Detail host usage:\n" echo -en "\n***Usage summary***\n"
openstack usage list -f csv | column -t -s,
echo -en "\n***Ceph info***\n"
ceph df | grep -v "0 B"
ceph osd df tree | grep host | awk '{print $NF,$(NF-4)"% Used"}'
echo -en "\n***Detail host usage***\n"
echo -en "Host CPU% Memory%\n" | column -t echo -en "Host CPU% Memory%\n" | column -t
openstack host list -fvalue -c 'Host Name' | grep compute | sort | while read h; do
openstack host list -fvalue -c 'Host Name' | grep compute | sort | while read h; do openstack host show $h -fcsv | egrep '(total|now)' | tr -d \" | paste - - | awk -F, '{print $1, $7/$3*100"%", $8/$4*100"%"}'; done | column -t openstack host list -fvalue -c 'Host Name' | grep compute | sort | while read h; do openstack host show $h -fcsv | egrep '(total|now)' | tr -d \" | paste - - | awk -F, '{print $1, $7/$3*100"%", $8/$4*100"%"}'; done | column -t
done
echo -en "\n\nGenerated by /root/openstack-simple-report.sh from $(hostname)"
echo -en "Generated by /root/simple-report.sh"