METRON-636 Capture memory and cpu details as a part of platform-info script 
(anandsubbu via nickwallen) closes apache/incubator-metron#400


Project: http://git-wip-us.apache.org/repos/asf/incubator-metron/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-metron/commit/0e8abc48
Tree: http://git-wip-us.apache.org/repos/asf/incubator-metron/tree/0e8abc48
Diff: http://git-wip-us.apache.org/repos/asf/incubator-metron/diff/0e8abc48

Branch: refs/heads/Metron_0.3.1
Commit: 0e8abc48e5f6b29fb382371ad26bb165cf6e5f25
Parents: 9e15cb6
Author: anandsubbu <anandsu...@gmail.com>
Authored: Wed Feb 22 09:01:12 2017 -0500
Committer: Nick Allen <n...@nickallen.org>
Committed: Wed Feb 22 09:01:12 2017 -0500

----------------------------------------------------------------------
 metron-deployment/scripts/platform-info.sh | 27 +++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/0e8abc48/metron-deployment/scripts/platform-info.sh
----------------------------------------------------------------------
diff --git a/metron-deployment/scripts/platform-info.sh 
b/metron-deployment/scripts/platform-info.sh
index be53e86..79ebcac 100755
--- a/metron-deployment/scripts/platform-info.sh
+++ b/metron-deployment/scripts/platform-info.sh
@@ -62,3 +62,30 @@ mvn --version
 # operating system
 echo "--"
 uname -a
+
+# system resources
+echo "--"
+case "${OSTYPE}" in
+  linux*)
+    cat /proc/meminfo  | grep -i MemTotal | awk '{print "Total System Memory = 
" $2/1024 " MB"}'
+    cat /proc/cpuinfo | egrep 'model\ name' | uniq | cut -d: -f2 | awk '{print 
"Processor Model:" $0}'
+    cat /proc/cpuinfo | egrep 'cpu\ MHz' | uniq | cut -d: -f2 | awk '{print 
"Processor Speed:" $0 " MHz"}'
+    cat /proc/cpuinfo | grep -i '^processor' | wc -l | awk '{print "Total 
Physical Processors: " $0}'
+    cat /proc/cpuinfo | grep -i cores | cut -d: -f2 | awk '{corecount+=$1} END 
{print "Total cores: " corecount}'
+    echo "Disk information:"
+    df -h | grep "^/" 
+    ;;
+  darwin*)
+    sysctl hw.memsize | awk '{print "Total System Memory = " $2/1048576 " MB"}'
+    sysctl machdep.cpu | grep 'machdep.cpu.brand_string' | cut -d: -f2 | cut 
-d\@ -f1 | awk '{print "Processor Model:" $0}'
+    sysctl machdep.cpu | grep 'machdep.cpu.brand_string' | cut -d: -f2 | cut 
-d\@ -f2 | awk '{print "Processor Speed:" $0}'
+    sysctl hw.physicalcpu | cut -d: -f2 | awk '{print "Total Physical 
Processors:" $0}'
+    sysctl machdep.cpu | grep 'machdep.cpu.core_count' | cut -d: -f2 | cut 
-d\@ -f2 | awk '{print "Total cores:" $0}'
+    echo "Disk information:"
+    df -h | grep "^/" 
+    ;;
+  *)
+    echo "Unable to detect system resources for ${OSTYPE}"
+    ;;
+esac
+

Reply via email to