On Thu, Oct 22, 2020 at 04:36:17PM +0800, Wang Chenglong wrote:
On Thu, Oct 22, 2020 at 04:13:22PM +0800, Zhang Yu wrote:
Signed-off-by: Zhang Yu 2134782174@qq.com
tests/host-info | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/tests/host-info b/tests/host-info index 46f43f93..c0e17f26 100755 --- a/tests/host-info +++ b/tests/host-info @@ -1,18 +1,20 @@ #!/bin/bash
-get_node() +get_mem() {
- echo "nr_node: $(grep -Eo 'Node [0-9]+,' /proc/zoneinfo | uniq | wc -l)"
- echo "nr_cpu: $(nproc)" memory_total=$(cat /proc/meminfo |grep MemTotal | awk '{print $2}') memory_new=$(awk 'BEGIN{printf "%0.2f", '$memory_total'/1024/1024/16}') memory=$(echo `expr $(echo $memory_new | awk '{print int($0)+1}') * 16`)G echo "memory: $memory"
}
-get_model_name() +get_cpu() {
- echo "model_name: $(lscpu |grep "Model name" | awk '{print $3}')"
- lscpu=$(lscpu)
- echo "nr_node: $(echo "$lscpu" | grep "NUMA node(s)" | awk '{print $3}')"
- echo "nr_cpu: $(echo "$lscpu" | grep "^CPU(s)" | awk '{print $2}')"
- echo "arch: $(echo "$lscpu" | grep "Architecture" | awk '{print $2}')"
- echo "model_name: $(echo "$lscpu" | grep "Model name" | awk '{print $3}')"
How about use EOF for merger? cat <<EOF
^----- append space when reply email. Thanks, Liushaofei
nr_node: $(echo "$lscpu" | grep "NUMA node(s)" | awk '{print $3}') arch: $(echo "$lscpu" | grep "Architecture" | awk '{print $2}') EOF Thanks, Chenglong
}
get_nr_disk() @@ -101,11 +103,11 @@ get_ipmi_ip()
main() {
- get_node
- get_cpu
- get_mem get_nr_disk get_partitions get_mac
- get_model_name get_ipmi_ip
}
-- 2.23.0