You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metron.apache.org by nickwallen <gi...@git.apache.org> on 2017/01/12 15:00:07 UTC

[GitHub] incubator-metron pull request #400: METRON-636: Capture memory and cpu detai...

Github user nickwallen commented on a diff in the pull request:

    https://github.com/apache/incubator-metron/pull/400#discussion_r95808285
  
    --- Diff: metron-deployment/scripts/platform-info.sh ---
    @@ -62,3 +62,39 @@ 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 "^/" 
    +    ;;
    +  bsd*)
    +    echo "BSD is not currently supported, unable to detect system resources"
    +    ;;
    --- End diff --
    
    @anandsubbu This message might be a little misleading.  Could a user misinterpret this as meaning that Metron does not support the given OS, versus just the platform-info.sh script does not support it?
    
    You could just remove the conditionals for BSD, Windows and Solaris and let it fall through to something like "Unable to detect system resources for "${OSTYPE}".



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---