[why] Obtain more host information from 'lscpu'
Signed-off-by: Zhang Yu 2134782174@qq.com --- tests/host-info | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/tests/host-info b/tests/host-info index 46f43f93..84f796dc 100755 --- a/tests/host-info +++ b/tests/host-info @@ -1,18 +1,25 @@ #!/bin/bash
-get_node() +get_memory() { - 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}')" + echo $1: $(lscpu | awk -F': *' '/'$2':/{print $2}') +} + +get_cpu_info() +{ + cpu_info=("arch Architecture" "nr_node NUMA\snode(s)" "nr_cpu ^CPU(s)" "model_name Model\sname") + for info in "${cpu_info[@]}" + do + get_cpu $info + done }
get_nr_disk() @@ -101,11 +108,11 @@ get_ipmi_ip()
main() { - get_node + get_memory get_nr_disk get_partitions get_mac - get_model_name + get_cpu_info get_ipmi_ip }
On Wed, Oct 28, 2020 at 08:54:35AM +0800, Zhang Yu wrote:
[why] Obtain more host information from 'lscpu'
you should append "[how]", show some output, this will be more clear.
Signed-off-by: Zhang Yu 2134782174@qq.com
tests/host-info | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/tests/host-info b/tests/host-info index 46f43f93..84f796dc 100755 --- a/tests/host-info +++ b/tests/host-info @@ -1,18 +1,25 @@ #!/bin/bash
add license ? Thanks, Liushaofei
-get_node() +get_memory() {
- 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}')"
- echo $1: $(lscpu | awk -F': *' '/'$2':/{print $2}')
+}
+get_cpu_info() +{
- cpu_info=("arch Architecture" "nr_node NUMA\snode(s)" "nr_cpu ^CPU(s)" "model_name Model\sname")
- for info in "${cpu_info[@]}"
- do
get_cpu $info
- done
}
get_nr_disk() @@ -101,11 +108,11 @@ get_ipmi_ip()
main() {
- get_node
- get_memory get_nr_disk get_partitions get_mac
- get_model_name
- get_cpu_info get_ipmi_ip
}
-- 2.23.0
On Wed, Oct 28, 2020 at 07:40:02PM +0800, Zhang Yu wrote:
On Wed, Oct 28, 2020 at 11:53:22AM +0800, Liu Shaofei wrote:
#!/bin/bash
add license ?
No need to add license, because tests catalogue is dedault gpl.
^----default please 'F3' key check spell before send email. Thanks, Liushaofei
Thanks, Zhangyu
On Wed, Oct 28, 2020 at 11:53:22AM +0800, Liu Shaofei wrote:
On Wed, Oct 28, 2020 at 08:54:35AM +0800, Zhang Yu wrote:
[why] Obtain more host information from 'lscpu'
you should append "[how]", show some output, this will be more clear.
Signed-off-by: Zhang Yu 2134782174@qq.com
tests/host-info | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/tests/host-info b/tests/host-info index 46f43f93..84f796dc 100755 --- a/tests/host-info +++ b/tests/host-info @@ -1,18 +1,25 @@ #!/bin/bash
add license ? Thanks, Liushaofei
When modifying third-party open-source code, retain the original license and do not add other licenses.
Thanks, Baijing
-get_node() +get_memory() {
- 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}')"
- echo $1: $(lscpu | awk -F': *' '/'$2':/{print $2}')
+}
+get_cpu_info() +{
- cpu_info=("arch Architecture" "nr_node NUMA\snode(s)" "nr_cpu ^CPU(s)" "model_name Model\sname")
- for info in "${cpu_info[@]}"
- do
get_cpu $info
- done
}
get_nr_disk() @@ -101,11 +108,11 @@ get_ipmi_ip()
main() {
- get_node
- get_memory get_nr_disk get_partitions get_mac
- get_model_name
- get_cpu_info get_ipmi_ip
}
-- 2.23.0