Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-4615

Add hostInfo command to show host info like distribution/server architecture, memory, etc.

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.1.1
    • Affects Version/s: None
    • Component/s: Admin
    • Labels:
      None
    • Environment:
      Any mongo* instance

      Server should be able to determine what os/distro/platform it is running on.
      To get a better picture of what is going on "under the hood", as well as be able to provide platform-specific guidance in regards to particular operating systems/distributions, we should have a method of reporting back these bits of information.
      Possibly collect them via mms_agent and report them back so we can then inspect and act on the details.

      Here's a few methods for collecting relevant information from the linux command line, and you can see there are differences. Possibly have a decision-making process to determine which method should be used to collect the rest?

      # -----------------
      # Centos System:
      $ cat /proc/version
      Linux version 2.6.32-220.2.1.el6.x86_64 (mockbuild@c6-x8664-build.centos.org) (gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC) ) #1 SMP Fri Dec 23 02:21:33 CST 2011
      
      $ uname -a
      Linux myserver.biz 2.6.32-220.2.1.el6.x86_64 #1 SMP Fri Dec 23 02:21:33 CST 2011 x86_64 x86_64 x86_64 GNU/Linux
      
      $ uname -rs
      Linux 2.6.32-220.2.1.el6.x86_64
      
      $ lsb_release -a
      LSB Version:     :core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
      Distributor ID:     CentOS
      Description:     CentOS release 6.2 (Final)
      Release:     6.2
      Codename:     Final
      
      $ cat /etc/*-release
      CentOS release 6.2 (Final)
      CentOS release 6.2 (Final)
      CentOS release 6.2 (Final)
      
      $ ll /etc/*-release
      -rw-r--r--. 1 root root 27 Dec  8 22:05 /etc/centos-release
      lrwxrwxrwx. 1 root root 14 Dec 23 16:21 /etc/redhat-release -> centos-release
      lrwxrwxrwx. 1 root root 14 Dec 23 16:21 /etc/system-release -> centos-release
      
      $ cat /etc/issue
      CentOS release 6.2 (Final)
      Kernel \r on an \m
      
      # -----------------
      # On an Amazon AMI instance (modeled after Fedora):
      $ cat /proc/version
      Linux version 2.6.35.14-97.44.amzn1.x86_64 (mockbuild@build-31006.build) (gcc version 4.4.5 20110214 (Red Hat 4.4.5-6) (GCC) ) #1 SMP Mon Oct 24 16:03:08 UTC 2011
      
      $ uname -a
      Linux myserver.com 2.6.35.14-97.44.amzn1.x86_64 #1 SMP Mon Oct 24 16:03:08 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
      
      $ uname -rs
      Linux 2.6.35.14-97.44.amzn1.x86_64
      
      $ lsb_release -a
      -bash: lsb_release: command not found
      
      $ cat /etc/*-release
      Amazon Linux AMI release 2011.09
      
      $ ll /etc/*-release
      -rw-r--r-- 1 root root 33 Oct 27 21:24 /etc/system-release
      
      $ cat /etc/issue
      Amazon Linux AMI release 2011.09
      Kernel \r on an \m
      
      # -----------------
      # Ubunutu Maverick 10.10:
      $ cat /proc/version
      Linux version 2.6.35-22-server (buildd@allspice) (gcc version 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu4) ) #33-Ubuntu SMP Sun Sep 19 20:48:58 UTC 2010
      
      $ uname -a
      Linux myserver.net 2.6.35-22-server #33-Ubuntu SMP Sun Sep 19 20:48:58 UTC 2010 x86_64 GNU/Linux
      
      $ uname -rs
      Linux 2.6.35-22-server
      
      $ lsb_release -a
      No LSB modules are available.
      Distributor ID:     Ubuntu
      Description:     Ubuntu maverick (development branch)
      Release:     10.10
      Codename:     maverick
      
      $ cat /etc/*-release
      DISTRIB_ID=Ubuntu
      DISTRIB_RELEASE=10.10
      DISTRIB_CODENAME=maverick
      DISTRIB_DESCRIPTION="Ubuntu maverick (development branch)"
      
      $ ll /etc/*-release
      -rw-r--r-- 1 root root 125 2010-05-04 12:41 /etc/lsb-release
      
      $ cat /etc/issue
      Ubuntu maverick (development branch) \n \l
      
      # -----------------
      # On OSX 10.7.2:
      $ cat /proc/version
      cat: /proc/version: No such file or directory
      
      $ uname -a
      Darwin fledgling.local 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug  9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64
      
      $ uname -rs
      Darwin 11.2.0
      
      $ lsb_release -a
      -bash: lsb_release: command not found
      
      $ cat /etc/*-release
      cat: /etc/*-release: No such file or directory
      
      $ ll /etc/*-release
      ls: /etc/*-release: No such file or directory
      
      $ cat /etc/issue
      cat: /etc/issue: No such file or directory
      
      

      So it seems like on a *nix system, running a `uname` will provide whether it is Darwin vs Linux, and then other tests could be run to grab relevant information.

      Things I'd care about knowing:
      Distro (CentOS, RHEL, Debian, Ubuntu)
      Distro Version (6.2, 5.7, 10.04, etc)
      Architecture (i386 vs x64_86)
      Kernel version (2.6.18, 2.6.32, etc)

      Windows has a different method, using the `systeminfo` command line tool, like so:

      C:\>systeminfo | findstr /C:"OS"
      OS Name:                   Microsoft Windows Server 2008 R2 Enterprise
      OS Version:                6.1.7600 N/A Build 7600
      OS Manufacturer:           Microsoft Corporation
      OS Configuration:          Standalone Server
      OS Build Type:             Multiprocessor Free
      BIOS Version:              IBM -[BWE117AUS-1.05]-, 7/28/2005
      

      This returns too much, including the BIOS, so using a better find like this: `findstr /B /C:"OS Name" /C:"OS Version"` should get the relevant information.

            Assignee:
            benjamin.becker Ben Becker
            Reporter:
            miketheman Michael A. Fiedler
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: