From 178bb707fcc459b2be22e1302a44c39575e1dde4 Mon Sep 17 00:00:00 2001 From: x p k Date: Wed, 20 Jan 2021 15:34:54 +0800 Subject: [PATCH] NEW: openstack report --- openstack/openstack-simple-report.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 openstack/openstack-simple-report.sh diff --git a/openstack/openstack-simple-report.sh b/openstack/openstack-simple-report.sh new file mode 100644 index 0000000..dc0811a --- /dev/null +++ b/openstack/openstack-simple-report.sh @@ -0,0 +1,18 @@ +#!/bin/bash +. /root/openrc +echo "Openstack usage generated on $(date)" +echo -en "Number of active VMs: " +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 "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 +done + + +echo -en "Generated by /root/simple-report.sh" +