Changes to Discovery Commands

The following sections show the discovery command changes between BMC Discovery versions.

The following changes are not shown:

  • Entirely new discovery platforms
  • Changes to comments only
  • Commands which have been removed and not replaced
  • Changes to echo only statements

Discovery command changes from 11.1 to 11.2

 Click here to show the discovery command changes from 11.1 to 11.2

Solaris

getHostInfo

The following code:

if [ $os_ver -ge 11 ]; then
     pkg list -H --no-refresh system/kernel | awk '{print "kernel:", $2; exit}'
else
    showrev 2>/dev/null | nawk -F: '/^Kernel version/ {gsub("^ *", "", $2); print "kernel:", $2; exit}'
fi
echo 'model:' `uname -i 2>/dev/null`
/usr/sbin/prtconf 2>/dev/null | nawk '/^Memory size:/ {print "ram: " $3 "MB"}'

is replaced with:

if [ $os_ver -ge 11 ]; then
     pkg list -H --no-refresh system/kernel | awk '{print "kernel:", $(NF-1); exit}'
else
    showrev 2>/dev/null | nawk -F: '/^Kernel version/ {gsub("^ *", "", $2); print "kernel:", $2; exit}'
fi
echo 'model:' `uname -i 2>/dev/null`

echo 'begin prtconf:'
/usr/sbin/prtconf 2>/dev/null | egrep "System Configuration:|Memory size:"
echo 'end prtconf'

getProcessList: ps: cmd changed:

The following code:

if [ $os_ver -ge 10 -a  -x /usr/bin/zonename ]; then
    zone=`/usr/bin/zonename 2>/dev/null`
    ps -eo pid,ppid,uid,user,zone,args 2>/dev/null | nawk "\$5~/^($zone|ZONE)$/ {print}"
else
    ps -eo pid,ppid,uid,user,args 2>/dev/null
fi
if [ $os_ver -ge 11 ]; then
    PRIV_PS /usr/bin/ps axww 2>/dev/null

is replaced with:

if [ $os_ver -ge 10 -a  -x /usr/bin/zonename ]; then
    zone=`/usr/bin/zonename 2>/dev/null`
    /usr/bin/ps -eo pid,ppid,uid,user,zone,args 2>/dev/null | nawk "\$5~/^($zone|ZONE)$/ {print}"
else
    /usr/bin/ps -eo pid,ppid,uid,user,args 2>/dev/null
fi
if [ $os_ver -ge 11 ]; then
    PRIV_PS /usr/bin/ps axww 2>/dev/null

getFileSystems

The following code:

    cat /etc/xtab
fi
echo end xtab:
echo begin smbclient:
smbclient -N -L localhost
echo end smbclient:

is replaced with:

    cat /etc/xtab
fi
echo end xtab:
echo begin sharetab:
if [ -r /etc/dfs/sharetab ]; then
    cat /etc/dfs/sharetab
fi
echo end sharetab:
echo begin smbclient:
smbclient -N -L localhost
echo end smbclient:

getNetworkConnectionList

The following code:

netstat -an -f inet 2>/dev/null | grep -v '^ *\*\.\*'
netstat -an -f inet6 2>/dev/null | grep -v '^ *\*\.\*'

is replaced with:

os_ver=`uname -r | cut -d. -f2`
if [ $os_ver -gt 11 -o \( $os_ver -eq 11 -a `uname -v | cut -d. -f2` -ge 2 \) ]; then
    netstat -anu -f inet 2>/dev/null | grep -v '^ *\*\.\*'
    netstat -anu -f inet6 2>/dev/null | grep -v '^ *\*\.\*'
else
    netstat -an -f inet 2>/dev/null | grep -v '^ *\*\.\*'
    netstat -an -f inet6 2>/dev/null | grep -v '^ *\*\.\*'
fi

Tru64

getProcessList

The following code:

ps -eo pid,ppid,uid,user,args 2>/dev/null

is replaced with:

ps -eo pid,ppid,uid,user,args 2>/dev/null | cat

VMware ESXi

initialise

The following code:

# replace the following PRIV_XXX functions with one that has the path to a
# program to run the commands as super user, e.g. sudo. For example
# PRIV_LSOF() {
#   /usr/bin/sudo "$@"
# }

# lsof requires superuser privileges to display information on processes
# other than those running as the current user
PRIV_LSOF() {
  "$@"
}

# This function supports running privileged commands from patterns
PRIV_RUNCMD() {

is replaced with:

# replace the following PRIV_XXX functions with one that has the path to a
# program to run the commands as super user, e.g. sudo. For example
# PRIV_CAT() {
#   /usr/bin/sudo cat "$@"
# }

# This function supports running privileged commands from patterns
PRIV_RUNCMD() {

Linux

getHostInfo

The following code:

if [ -d /sys/class/dmi/id ]; then
    echo "candidate_model[]: " `cat /sys/class/dmi/id/product_name 2>/dev/null`
    echo "candidate_serial[]: " `PRIV_CAT /sys/class/dmi/id/product_serial 2>/dev/null`
    echo "candidate_uuid[]: " `PRIV_CAT /sys/class/dmi/id/product_uuid 2>/dev/null`
    echo "candidate_vendor[]: " `cat /sys/class/dmi/id/sys_vendor 2>/dev/null`
fi

is replaced with:

if [ -d /sys/class/dmi/id ]; then
    model=`cat /sys/class/dmi/id/product_name 2>/dev/null`
    vendor=`cat /sys/class/dmi/id/sys_vendor 2>/dev/null`
    if [ -r /etc/system-release ]; then
        grep Amazon /etc/system-release >/dev/null 2>&1
        if [ $? -eq 0 ]; then
            model="Amazon Virtual Machine"
            vendor="Amazon"
        fi
    fi
    echo "candidate_model[]: " "$model"
    echo "candidate_serial[]: " `PRIV_CAT /sys/class/dmi/id/product_serial 2>/dev/null`
    echo "candidate_uuid[]: " `PRIV_CAT /sys/class/dmi/id/product_uuid 2>/dev/null`
    echo "candidate_vendor[]: " "$vendor"
fi

# Trying to get the Amazon EC2 instance ID, if any.
aws_instance_id=""
if [ -x /opt/aws/bin/ec2-metadata ]; then
    aws_instance_id=`/opt/aws/bin/ec2-metadata -i 2>/dev/null | awk '{print $2; }'`
fi
if [ -z "$aws_instance_id" -a -f /usr/bin/curl ]; then
    # This web request is not chargeable.
# See: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html
    aws_instance_id=`curl http://instance-data/latest/meta-data/instance-id 2>/dev/null`
fi
if [ "$aws_instance_id" != "" ]; then
    echo "aws_instance_id: " "$aws_instance_id"
fi

getDeviceInfo

The following code:

    if [ "$os" = "(none)" ]; then
        os=""
    elif [ "$os" != "" ]; then
        # Check to see if its a variant of Red Hat
        rpm -q oracle-logos > /dev/null 2>&1
        if [ $? -eq 0 ]; then
            # Oracle variant
            os="Oracle $os"
        fi
    fi
fi

is replaced with:

    if [ "$os" = "(none)" ]; then
        os=""
    elif [ "$os" != "" ]; then
        if [ -f /etc/redhat-release ]; then
            # Check to see if its a variant of Red Hat
            # Early 4/5 version have /etc/enterprise-release without mentioning
            # Oracle in the name.
            if [ -f /etc/enterprise-release ]; then
                os="Oracle $os"
            elif [ -f /etc/oracle-release ]; then
                os=`cat /etc/oracle-release`
            fi
        fi
    fi
fi

The following code:

    # Check to see if its a variant of Red Hat
    rpm -q oracle-logos > /dev/null 2>&1
    if [ $? -eq 0 ]; then
        # Oracle variant
    fi
fi

is replaced with:

    # Check to see if its a variant of Red Hat
    # Early 4/5 version have /etc/enterprise-release rather then
    # /etc/oracle-release without mentioning Oracle.
    if [ -f /etc/enterprise-release ]; then
        os="Oracle $os"
    elif [ -f /etc/oracle-release ]; then
        os=`cat /etc/oracle-release`
    fi
fi

The following code:

if [ "$os" = "" -a -r /etc/os-release ]; then
    # Use os-release for SuSE (if SuSE-release wasn't present, above)
    os_id=`grep ID= /etc/os-release | cut -f2 '-d"'`
    if [ "$os_id" = "" ]; then
        os_id=`grep ID= /etc/os-release | cut -f2 -d=`
    fi
    if [ "$os_id" = "sles" -o "$os_id" = "opensuse" ]; then
        os=`grep PRETTY_NAME /etc/os-release | cut -f2 '-d"'`
    fi
fi

is replaced with:

if [ "$os" = "" -a -r /etc/os-release ]; then
    # Use os-release for SuSE (if SuSE-release wasn't present, above)
    os_id=`egrep ^ID= /etc/os-release | cut -f2 '-d"'`
    if [ "$os_id" = "" ]; then
        os_id=`egrep ^ID= /etc/os-release | cut -f2 -d=`
    fi
    if [ "$os_id" = "sles" -o "$os_id" = "opensuse" ]; then
        os=`egrep ^PRETTY_NAME /etc/os-release | cut -f2 '-d"'`
    fi
fi
if [ "$os" = "" -a -r /etc/system-release ]; then
    os=`cat /etc/system-release`
fi

HPUX

getFileSystems

The following code:

fi
echo end xtab:
echo begin smbclient:
smbclient -N -L localhost
echo end smbclient:

is replaced with:

fi
echo end xtab:
echo begin sharetab:
if [ -r /etc/dfs/sharetab ]; then
    cat /etc/dfs/sharetab
fi
echo end sharetab:
echo begin smbclient:
smbclient -N -L localhost
echo end smbclient:

VMware ESX

getHostInfo

The following code:

if [ -d /sys/class/dmi/id ]; then
    echo "candidate_model[]: " `cat /sys/class/dmi/id/product_name 2>/dev/null`
    echo "candidate_serial[]: " `PRIV_CAT /sys/class/dmi/id/product_serial 2>/dev/null`
    echo "candidate_uuid[]: " `PRIV_CAT /sys/class/dmi/id/product_uuid 2>/dev/null`
    echo "candidate_vendor[]: " `cat /sys/class/dmi/id/sys_vendor 2>/dev/null`
fi

is replaced with:

if [ -d /sys/class/dmi/id ]; then
    model=`cat /sys/class/dmi/id/product_name 2>/dev/null`
    vendor=`cat /sys/class/dmi/id/sys_vendor 2>/dev/null`
    if [ -r /etc/system-release ]; then
        grep Amazon /etc/system-release >/dev/null 2>&1
        if [ $? -eq 0 ]; then
            model="Amazon Virtual Machine"
            vendor="Amazon"
        fi
    fi
    echo "candidate_model[]: " "$model"
    echo "candidate_serial[]: " `PRIV_CAT /sys/class/dmi/id/product_serial 2>/dev/null`
    echo "candidate_uuid[]: " `PRIV_CAT /sys/class/dmi/id/product_uuid 2>/dev/null`
    echo "candidate_vendor[]: " "$vendor"
fi

# Trying to get the Amazon EC2 instance ID, if any.
aws_instance_id=""
if [ -x /opt/aws/bin/ec2-metadata ]; then
    aws_instance_id=`/opt/aws/bin/ec2-metadata -i 2>/dev/null | awk '{print $2; }'`
fi
if [ -z "$aws_instance_id" -a -f /usr/bin/curl ]; then
    # This web request is not chargeable.
# See: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html
    aws_instance_id=`curl http://instance-data/latest/meta-data/instance-id 2>/dev/null`
fi
if [ "$aws_instance_id" != "" ]; then
    echo "aws_instance_id: " "$aws_instance_id"
fi

getDeviceInfo

The following code:

    if [ "$os" = "(none)" ]; then
        os=""
    elif [ "$os" != "" ]; then
        # Check to see if its a variant of Red Hat
        rpm -q oracle-logos > /dev/null 2>&1
        if [ $? -eq 0 ]; then
            # Oracle variant
            os="Oracle $os"
        fi
    fi
fi

is replaced with:

    if [ "$os" = "(none)" ]; then
        os=""
    elif [ "$os" != "" ]; then
        if [ -f /etc/redhat-release ]; then
            # Check to see if its a variant of Red Hat
            # Early 4/5 version have /etc/enterprise-release without mentioning
            # Oracle in the name.
            if [ -f /etc/enterprise-release ]; then
                os="Oracle $os"
            elif [ -f /etc/oracle-release ]; then
                os=`cat /etc/oracle-release`
            fi
        fi
    fi
fi

The following code:

 
    # Check to see if its a variant of Red Hat
    rpm -q oracle-logos > /dev/null 2>&1
    if [ $? -eq 0 ]; then
        # Oracle variant
    fi
fi

is replaced with:

    # Check to see if its a variant of Red Hat
    # Early 4/5 version have /etc/enterprise-release rather then
    # /etc/oracle-release without mentioning Oracle.
    if [ -f /etc/enterprise-release ]; then
        os="Oracle $os"
    elif [ -f /etc/oracle-release ]; then
        os=`cat /etc/oracle-release`
    fi
fi

The following code:

if [ "$os" = "" -a -r /etc/os-release ]; then
    # Use os-release for SuSE (if SuSE-release wasn't present, above)
    os_id=`grep ID= /etc/os-release | cut -f2 '-d"'`
    if [ "$os_id" = "" ]; then
        os_id=`grep ID= /etc/os-release | cut -f2 -d=`
    fi
    if [ "$os_id" = "sles" -o "$os_id" = "opensuse" ]; then
        os=`grep PRETTY_NAME /etc/os-release | cut -f2 '-d"'`
    fi
fi
if [ "$os" = "" ]; then
    os=`uname -sr 2>/dev/null`

is replaced with:

if [ "$os" = "" -a -r /etc/os-release ]; then
    # Use os-release for SuSE (if SuSE-release wasn't present, above)
    os_id=`egrep ^ID= /etc/os-release | cut -f2 '-d"'`
    if [ "$os_id" = "" ]; then
        os_id=`egrep ^ID= /etc/os-release | cut -f2 -d=`
    fi
    if [ "$os_id" = "sles" -o "$os_id" = "opensuse" ]; then
        os=`egrep ^PRETTY_NAME /etc/os-release | cut -f2 '-d"'`
    fi
fi
if [ "$os" = "" -a -r /etc/system-release ]; then
    os=`cat /etc/system-release`
fi
if [ "$os" = "" ]; then
    os=`uname -sr 2>/dev/null`

Discovery command changes from 11.0 to 11.1

 Click here to show the discovery command changes from 11.0 to 11.1



Solaris

getProcessList

The following code:

os_ver=`uname -r | cut -d. -f2`
if [ $os_ver -ge 10 -a  -x /usr/bin/zonename ]; then
    zone=`/usr/bin/zonename 2>/dev/null`
    ps -eo pid,ppid,uid,user,zone,args 2>/dev/null | awk "\$5~/^($zone|ZONE)$/ {print}"
else
    ps -eo pid,ppid,uid,user,args 2>/dev/null
fi

is replaced with:

os_ver=`uname -r | cut -d. -f2`
if [ $os_ver -ge 10 -a  -x /usr/bin/zonename ]; then
    zone=`/usr/bin/zonename 2>/dev/null`
    ps -eo pid,ppid,uid,user,zone,args 2>/dev/null | nawk "\$5~/^($zone|ZONE)$/ {print}"
else
    ps -eo pid,ppid,uid,user,args 2>/dev/null
fi

getDeviceInfo

The following code:

fi
echo 'domain:' `domainname 2>/dev/null`
if [ -r /etc/release ]; then
    if grep Update /etc/release; then
        echo 'os:' `head -1 /etc/release 2>/dev/null`',' `grep Update /etc/release 2>/dev/null`
    else
        echo 'os:' `head -1 /etc/release 2>/dev/null`
    fi
else
    echo 'os:' `uname -sr 2>/dev/null`
fi
echo 'os_arch:' `isainfo -k 2>/dev/null`

is replaced with:

fi
echo 'domain:' `domainname 2>/dev/null`
os=""
os_ver=`uname -r | cut -d. -f2`
if [ $os_ver -ge 11 ]; then
    os=`pkg info entire 2>/dev/null | grep "Version:" | awk 'NR > 1 {print $1}' RS='(' FS=')'`
    if [ "$os" = "" ]; then
        os=`pkg info entire | awk '/Branch:/ {print $2}' | nawk -F. '{printf "Oracle Solaris 11.%s.%s.%s.%s", $3, $4, $6, $7;}'`
    fi
fi
if [ "$os" = "" -a -r /etc/release ]; then
    os=`head -1 /etc/release 2>/dev/null`
    update=`grep Update /etc/release 2>/dev/null`
    if [ ! -z "$update" ]; then
        os="$os, $update"
    fi
fi
if [ "$os" = "" ]; then
    os=`uname -sr 2>/dev/null`
fi
echo 'os:' $os
echo 'os_arch:' `isainfo -k 2>/dev/null`

AIX

The PATH environment variable is changed from:

  • /bin:/usr/bin:/usr/sbin

to:

  • /etc:/bin:/usr/bin:/usr/sbin

getMACAddresses

The following code:

  if [ $status = "Available" ]; then
    echo Begin-interface: $adapter
    lscfg -vl $adapter 2>/dev/null
    echo $? > /dev/null # Prevent terminal issues
    echo End-interface: $adapter
  fi

is replaced with:

  if [ $status = "Available" ]; then
    echo Begin-interface: $adapter
    PRIV_LSCFG lscfg -vl $adapter 2>/dev/null
    echo $? > /dev/null # Prevent terminal issues
    echo End-interface: $adapter
  fi

getHostInfo

The following code:

# Get candidate serial using lscfg -vp in case the above commands do not return any serial value
lscfg -vp 2>/dev/null | grep -p "System VPD:" | grep "Cabinet Serial No" | sed -e 's/.*Serial No\.*\(.*\)/candidate_serial[]: \1/'
lsattr -E -l sys0 -a realmem 2>/dev/null | awk '{print "ram: " $2 "KB";}'
if [ -x /usr/sbin/hostid ]; then

is replaced with:

# Get candidate serial using lscfg -vp in case the above commands do not return any serial value
PRIV_LSCFG lscfg -vp 2>/dev/null | grep -p "System VPD:" | grep "Cabinet Serial No" | sed -e 's/.*Serial No\.*\(.*\)/candidate_serial[]: \1/'
lsattr -E -l sys0 -a realmem 2>/dev/null | awk '{print "ram: " $2 "KB";}'
if [ -x /usr/sbin/hostid ]; then

getNetworkInterfaces

The following code:

  if [ $status = "Available" ]; then
    echo Begin-interface: $adapter
    lscfg -vl $adapter 2>/dev/null
    echo $? > /dev/null # Prevent terminal issues
    echo End-interface: $adapter
  fi

is replaced with:

  if [ $status = "Available" ]; then
    echo Begin-interface: $adapter
    PRIV_LSCFG lscfg -vl $adapter 2>/dev/null
    echo $? > /dev/null # Prevent terminal issues
    echo End-interface: $adapter
  fi

initialise

The following code is added:

# VIO 2.x requires superuser privileges to run lscfg
PRIV_LSCFG() {
    vio_level=0
    if [ -r /usr/ios/cli/ios.level ]; then
        vio_level=`cat /usr/ios/cli/ios.level | cut -f1 -d.`
    fi

    if [ $vio_level -ge 2 ]; then
        # Need privilege elevation
        "$@"
    else
        "$@"
    fi
}

getHBAList

The following code:

    adapter_type=`echo $i | cut -f3 -d: | sed -e 's/,/./'`
    if [ $adapter_status = "Available" ]; then
        echo begin lscfg-vl-$adapter_name:
        lscfg -vl $adapter_name
        echo $? > /dev/null # Prevent terminal issues
        echo end lscfg-vl-$adapter_name:
        echo begin lslpp-$adapter_name:

is replaced with:

    adapter_type=`echo $i | cut -f3 -d: | sed -e 's/,/./'`
    if [ $adapter_status = "Available" ]; then
        echo begin lscfg-vl-$adapter_name:
        PRIV_LSCFG lscfg -vl $adapter_name
        echo $? > /dev/null # Prevent terminal issues
        echo end lscfg-vl-$adapter_name:
        echo begin lslpp-$adapter_name:

Mac OS X

getFileSystems

The following code is added:

echo begin diskutil-list-plist:
diskutil list -plist
echo end diskutil-list-plist:

POWER HMC

getHostInfo

The following code:

echo 'model:' `lshmc -v | grep '^\*TM' | cut -f2- -d' '`
echo 'serial:' `lshmc -v | grep '^\*SE' | cut -f2 -d' '`
echo bios_level: `lshmc -b | grep bios= | cut -f2 -d=`
monhmc -r mem -n 0 | cut -f1 -d, | sed -e 's/Mem/logical_ram/' -e 's/total//'

is replaced with:

echo 'model:' `lshmc -v | grep '^\*TM' | cut -f2- -d' '`
echo 'serial:' `lshmc -v | grep '^\*SE' | cut -f2 -d' '`
echo 'vendor:' `lshmc -v | grep '^\*MN' | cut -f2 -d' '`
echo bios_level: `lshmc -b | grep bios= | cut -f2 -d=`
monhmc -r mem -n 0 | cut -f1 -d, | sed -e 's/Mem/logical_ram/' -e 's/total//'

Linux

getDeviceInfo

The following code:

os=""
# SuSE lsb_release does not provide service pack so prefer SuSE-release file.
if [ "$os" = "" -a -r /etc/SuSE-release ]; then
    os=`cat /etc/SuSE-release`
fi
if [ "$os" = "" -a -x /usr/bin/lsb_release ]; then

is replaced with:

os=""
# SuSE lsb_release does not provide service pack so prefer SuSE-release file
# However, this file is being deprecated so we will fallback to os-release
# (see below)
if [ "$os" = "" -a -r /etc/SuSE-release ]; then
    os=`cat /etc/SuSE-release | egrep -v '^#'`
fi
if [ "$os" = "" -a -x /usr/bin/lsb_release ]; then

The following code is added:

if [ "$os" = "" -a -r /etc/os-release ]; then
    # Use os-release for SuSE (if SuSE-release wasn't present, above)
    os_id=`grep ID= /etc/os-release | cut -f2 '-d"'`
    if [ "$os_id" = "" ]; then
        os_id=`grep ID= /etc/os-release | cut -f2 -d=`
    fi
    if [ "$os_id" = "sles" -o "$os_id" = "opensuse" ]; then
        os=`grep PRETTY_NAME /etc/os-release | cut -f2 '-d"'`
    fi
fi

VMware ESX

getDeviceInfo

The following code:

os=""
# SuSE lsb_release does not provide service pack so prefer SuSE-release file.
if [ "$os" = "" -a -r /etc/SuSE-release ]; then
    os=`cat /etc/SuSE-release`
fi
if [ "$os" = "" -a -x /usr/bin/lsb_release ]; then

is replaced with:

os=""
# SuSE lsb_release does not provide service pack so prefer SuSE-release file
# However, this file is being deprecated so we will fallback to os-release
# (see below)
if [ "$os" = "" -a -r /etc/SuSE-release ]; then
    os=`cat /etc/SuSE-release | egrep -v '^#'`
fi
if [ "$os" = "" -a -x /usr/bin/lsb_release ]; then

The following code is added:

if [ "$os" = "" -a -r /etc/os-release ]; then
    # Use os-release for SuSE (if SuSE-release wasn't present, above)
    os_id=`grep ID= /etc/os-release | cut -f2 '-d"'`
    if [ "$os_id" = "" ]; then
        os_id=`grep ID= /etc/os-release | cut -f2 -d=`
    fi
    if [ "$os_id" = "sles" -o "$os_id" = "opensuse" ]; then
        os=`grep PRETTY_NAME /etc/os-release | cut -f2 '-d"'`
    fi
fi

Discovery command changes from 10.2 to 11.0

 Click here to show the discovery command changes from 10.2 to 11.0


The vast majority of the discovery command changes from 10.2 to 11.0 involve the removal of processor discovery commands. Processor discovery is now handled by patterns.


Solaris

getHostInfo

The following code:

fi
echo 'model:' `uname -i 2>/dev/null`
/usr/sbin/prtconf 2>/dev/null | nawk '/^Memory size:/ {print "ram: " $3 "MB"}'

# Run kstat cpu_info to get full CPU information, if possible
echo 'begin kstat_cpu_info:'
kstat cpu_info 2>/dev/null
echo 'end kstat_cpu_info:'

if [ `uname -p` = i386 ]; then
    if [ -x /usr/sbin/smbios ]; then

is replaced with:

fi
echo 'model:' `uname -i 2>/dev/null`
/usr/sbin/prtconf 2>/dev/null | nawk '/^Memory size:/ {print "ram: " $3 "MB"}'

if [ `uname -p` = i386 ]; then
    if [ -x /usr/sbin/smbios ]; then

AIX

getHostInfo

The following code:

# which description is "LINE FEED MISSING IN LPARSTAT -I COMMAND OUTPUT"
echo
echo 'end lparstat'

# Extract CPU info from lparstat
num_logical_processors=`egrep '^Online Virtual CPUs' /tmp/tideway.$$ | cut -f2 -d:`

rm -f /tmp/tideway.$$

wparid=0

is replaced with:

# which description is "LINE FEED MISSING IN LPARSTAT -I COMMAND OUTPUT"
echo
echo 'end lparstat'
rm -f /tmp/tideway.$$

wparid=0

The following code:

        else
          lsattr -E -l sys0 -a systemid 2>/dev/null | awk '{print "candidate_serial[]: " substr($2,7);}'
        fi
        
        # Use this processor value if lparstat failed
        if [ "$num_logical_processors" = "" ]; then
            num_logical_processors=`egrep '^Number Of Processors:' /tmp/tideway.$$ | cut -f2 -d:`
        fi
        
        # Work around prtconf bug again
        cputype=`egrep '^(Machine Serial Number: Not Available)?Processor Type:' /tmp/tideway.$$ | sed -e 's/Machine Serial Number: Not Available//' | cut -f2 -d: | sed -e 's/_/ /'`
        
        cpuspeed=`egrep '^Processor Clock Speed:' /tmp/tideway.$$ | cut -f2 -d:`
    fi
    rm -f /tmp/tideway.$$
else
    lsattr -E -l sys0 -a modelname 2>/dev/null | awk '{print "model: " $2;}'
    lsattr -E -l sys0 -a systemid 2>/dev/null | awk '{print "candidate_serial[]: " substr($2,7);}'
    # Use this processor value if lparstat failed
    if [ "$num_logical_processors" = "" ]; then
        num_logical_processors=`lscfg -lproc\* 2>/dev/null | wc -l`
    fi
    cputype=`lsattr -E -l proc0 -a type 2>/dev/null | awk '{print $2;}' | sed -e 's/_/ /'`
    hz=`lsattr -E -l proc0 -a frequency 2>/dev/null | awk '{print $2;}'`
    cpuspeed=`expr $hz / 1000000 2>/dev/null`
    cpuspeed="$cpuspeed MHz"
fi

# Get candidate serial using lscfg -vp in case the above commands do not return any serial value
lscfg -vp 2>/dev/null | grep -p "System VPD:" | grep "Cabinet Serial No" | sed -e 's/.*Serial No\.*\(.*\)/candidate_serial[]: \1/'

if [ $wparid -eq 0 ]; then
    # Get SMT information
    smt_enabled=`lsattr -E -l proc0 -a smt_enabled 2>/dev/null | awk '{print $2;}'`
    echo "cpu_threading_enabled:" $smt_enabled
fi

if [ "$num_logical_processors" != "" ]; then
    echo "num_logical_processors:" $num_logical_processors
fi
if [ "$cputype" != "" -a "$cpuspeed" != "" ]; then
    echo "processor_type:" $cputype $cpuspeed
    echo "processor_speed:" $cpuspeed
fi

lsattr -E -l sys0 -a realmem 2>/dev/null | awk '{print "ram: " $2 "KB";}'
if [ -x /usr/sbin/hostid ]; then

is replaced with:

        else
          lsattr -E -l sys0 -a systemid 2>/dev/null | awk '{print "candidate_serial[]: " substr($2,7);}'
        fi
    fi
    rm -f /tmp/tideway.$$
else
    lsattr -E -l sys0 -a modelname 2>/dev/null | awk '{print "model: " $2;}'
    lsattr -E -l sys0 -a systemid 2>/dev/null | awk '{print "candidate_serial[]: " substr($2,7);}'
fi

# Get candidate serial using lscfg -vp in case the above commands do not return any serial value
lscfg -vp 2>/dev/null | grep -p "System VPD:" | grep "Cabinet Serial No" | sed -e 's/.*Serial No\.*\(.*\)/candidate_serial[]: \1/'

lsattr -E -l sys0 -a realmem 2>/dev/null | awk '{print "ram: " $2 "KB";}'
if [ -x /usr/sbin/hostid ]; then

Mac OS X

getHostInfo

The following code:

 
system_profiler SPHardwareDataType SPSoftwareDataType > /tmp/tideway-hw-$$ 2>/dev/null
grep "Kernel Version: " /tmp/tideway-hw-$$ | sed 's/^.*: \(.*\)$/kernel: \1/'
cpucount=`grep "Number Of CPUs: " /tmp/tideway-hw-$$ | sed 's/^.*: \(.*\)$/\1/'`
if [ "$cpucount" = "" ]; then
    cpucount=`grep "Number Of Processors: " /tmp/tideway-hw-$$ | sed 's/^.*: \(.*\)$/\1/'`
    if [ "$cpucount" = "" ]; then
        # On some OS versions, system_profiler will not report the number of
        # processors unless it is > 1 so if we have no value reported, there is
        # only one CPU
        cpucount=1
    fi
    cputype=`grep "Processor Name: " /tmp/tideway-hw-$$ | sed 's/^.*: \(.*\)$/\1/'`
    cpuspeed=`grep "Processor Speed: " /tmp/tideway-hw-$$ | sed 's/^.*: \(.*\)$/\1/'`
else
    cputype=`grep "CPU Type: " /tmp/tideway-hw-$$ | sed 's/^.*: \(.*\)$/\1/'`
    cpuspeed=`grep "CPU Speed: " /tmp/tideway-hw-$$ | sed 's/^.*: \(.*\)$/\1/'`
fi
cores=`grep "Number Of Cores: " /tmp/tideway-hw-$$ | sed 's/^.*: \(.*\)$/\1/'`
if [ "$cores" != "" ]; then
    echo "num_logical_processors: $cores"
    echo "cores_per_processor:" `expr $cores / $cpucount`
fi
echo "num_processors: $cpucount"
echo "processor_type: $cputype $cpuspeed"
echo "processor_speed: $cpuspeed"
grep "^[[:blank:]]*Memory: " /tmp/tideway-hw-$$ | sed 's/^.*: \(.*\)$/ram: \1/'
grep "Machine Model: " /tmp/tideway-hw-$$ | sed 's/^.*: \(.*\)$/model: \1/'
grep "Serial Number: " /tmp/tideway-hw-$$ | sed 's/^.*: \(.*\)$/serial: \1/'

is replaced with:

 
system_profiler SPHardwareDataType SPSoftwareDataType > /tmp/tideway-hw-$$ 2>/dev/null
grep "Kernel Version: " /tmp/tideway-hw-$$ | sed 's/^.*: \(.*\)$/kernel: \1/'
grep "^[[:blank:]]*Memory: " /tmp/tideway-hw-$$ | sed 's/^.*: \(.*\)$/ram: \1/'
grep "Machine Model: " /tmp/tideway-hw-$$ | sed 's/^.*: \(.*\)$/model: \1/'
grep "Serial Number: " /tmp/tideway-hw-$$ | sed 's/^.*: \(.*\)$/serial: \1/'

IRIX

getHostInfo

The following code:

echo model: `sysconf | egrep '^HW_NAME' | sed -e 's/HW_NAME//'`
echo hostid: `sysconf | egrep '^HOSTID' | sed -e 's/HOSTID//'`
echo serial: `sysconf | egrep '^HW_SERIAL' | sed -e 's/HW_SERIAL//'`

num_procs=`sysconf | egrep '^NUM_PROCESSORS' | sed -e 's/NUM_PROCESSORS//'`
echo num_processors: $num_procs
echo num_logical_processors: $num_procs
hinv -t cpu | head -n 1 | sed -e 's/^CPU/processor_type/'
echo processor_speed: `hinv -c processor | head -n 1 | awk '{print $2;}'`

echo ram: `hinv -t memory | grep "Main memory size" | awk '{print $4;}'` MB

is replaced with:

echo model: `sysconf | egrep '^HW_NAME' | sed -e 's/HW_NAME//'`
echo hostid: `sysconf | egrep '^HOSTID' | sed -e 's/HOSTID//'`
echo serial: `sysconf | egrep '^HW_SERIAL' | sed -e 's/HW_SERIAL//'`
echo ram: `hinv -t memory | grep "Main memory size" | awk '{print $4;}'` MB

Tru64

getHostInfo

The following code:

echo 'model:' `PRIV_HWMGR hwmgr get attr -cat platform -a name 2>/dev/null | grep name | cut -f2- -d='`
echo 'ram:' `vmstat -P 2>/dev/null | grep "^Total Physical Memory" | cut -f2 -d=`
echo "serial:" `/sbin/consvar -g sys_serial_num 2>/dev/null | cut -f2- -d=`
echo 'begin tru64_psrinfo:'
psrinfo -v
echo 'end tru64_psrinfo'

is replaced with:

echo 'model:' `PRIV_HWMGR hwmgr get attr -cat platform -a name 2>/dev/null | grep name | cut -f2- -d='`
echo 'ram:' `vmstat -P 2>/dev/null | grep "^Total Physical Memory" | cut -f2 -d=`
echo "serial:" `/sbin/consvar -g sys_serial_num 2>/dev/null | cut -f2- -d=`

OpenVMS

getHostInfo

The following code:

WRITE SYS$OUTPUT "arch: ", F$GETSYI("ARCH_NAME")
WRITE SYS$OUTPUT "model: ", F$GETSYI("HW_NAME")
WRITE SYS$OUTPUT "logical_ram: ", F$GETSYI("MEMSIZE")/(1048576/F$GETSYI("PAGE_SIZE")), "MB"
WRITE SYS$OUTPUT "begin show-cpu:"
PIPE SHOW CPU /FULL | SEARCH SYS$INPUT /NOHIGHLIGHT "COThd:","Type","Speed"
WRITE SYS$OUTPUT "end show-cpu:"
WRITE SYS$OUTPUT "begin openvms_uptime_string:"
SHOW SYSTEM /NOPROCESSES
WRITE SYS$OUTPUT "end openvms_uptime_string"

is replaced with:

WRITE SYS$OUTPUT "arch: ", F$GETSYI("ARCH_NAME")
WRITE SYS$OUTPUT "model: ", F$GETSYI("HW_NAME")
WRITE SYS$OUTPUT "logical_ram: ", F$GETSYI("MEMSIZE")/(1048576/F$GETSYI("PAGE_SIZE")), "MB"
WRITE SYS$OUTPUT "begin openvms_uptime_string:"
SHOW SYSTEM /NOPROCESSES
WRITE SYS$OUTPUT "end openvms_uptime_string"

UnixWare

getHostInfo

The following code:

echo 'kernel:' `uname os_base 2>/dev/null` `uname kernel_stamp 2>/dev/null`
echo 'serial:' `uname hw_serial 2>/dev/null`
echo 'num_processors:' `uname num_cpu 2>/dev/null`
echo 'processor_type:' `uname machine 2>/dev/null`
echo 'ram:' `memsize -t -fm | awk '{printf("%sMB\n",$1);}'`
echo 'user_limit:' `uname user_limit 2>/dev/null`

is replaced with:

echo 'kernel:' `uname os_base 2>/dev/null` `uname kernel_stamp 2>/dev/null`
echo 'serial:' `uname hw_serial 2>/dev/null`
echo 'ram:' `memsize -t -fm | awk '{printf("%sMB\n",$1);}'`
echo 'user_limit:' `uname user_limit 2>/dev/null`

Linux

getHostInfo

The following code is removed:

# First, gather information about the processor.
cpuspeed=`egrep '^(cpu MHz|cpu clock|clock)' /proc/cpuinfo | cut -f2 -d: | sed -e 's/\.[0-9]*//' -e 's/Mhz//i' -e 's/ //g' | head -n 1`

cputype=`egrep '^cpu[^a-z]*:' /proc/cpuinfo | sort -u | cut -f2 -d: | sed -e 's/^ //' |  head -n 1`
if [ "${cputype}" = "" ]; then
    cputype=`egrep '^model name' /proc/cpuinfo | sort -u | cut -f2 -d: | sed -e 's/^ //' |  head -n 1`
fi
if [ "${cputype}" = "" ]; then
    cputype=`egrep '^arch' /proc/cpuinfo | sort -u | cut -f2 -d: | sed -e 's/^ //' |  head -n 1`
fi
if [ "${cputype}" = "" ]; then
    cputype=`egrep '^(cpu model|family|vendor_id|machine|Processor)' /proc/cpuinfo | sort -u | cut -f2 -d: | sed -e 's/^ //' |  head -n 1`
fi

# This value is the number of logical processors available
logical=`egrep '^[pP]rocessor' /proc/cpuinfo | sort -u | wc -l`

physical=0
cores=0
threads_per_core=0

if [ "`echo $cputype | cut -c-2`" = "PA" ]; then
    # check if it is a PA-RISC processor
    cpufamily=`egrep '^(cpu family)' /proc/cpuinfo | sort -u | cut -f2 -d: | sed -e 's/^ //' |  head -n 1`
    if [ "`echo $cpufamily | cut -c-7`" = "PA-RISC" ]; then
        cputype="${cpufamily} ${cputype}"
        model=`egrep '^(model name)' /proc/cpuinfo | sort -u | cut -f2 -d: | sed -e 's/^ //' |  head -n 1`
        
        if [ "${model}" != "" ]; then
            echo 'candidate_model[]:' ${model}
        fi
    fi
fi

if  [ "${cputype}" = "Alpha" ]; then
    # Alpha doesn't have one entry per processor.
    cpumodel=`egrep '^(cpu model)' /proc/cpuinfo | sort -u | cut -f2 -d: | sed -e 's/^ //' |  head -n 1`
    cputype="${cputype} ${cpumodel}"
    cores=1
    threads_per_core=1
    physical=`egrep '^(cpus detected)' /proc/cpuinfo | sort -u | cut -f2 -d: | sed -e 's/^ //' |  head -n 1`
    if [ "$physical" = "" ]; then
        physical=1
    fi
    logical=${physical}
    model=`egrep '^(platform string)' /proc/cpuinfo | sort -u | cut -f2 -d: | sed -e 's/^ //' |  head -n 1`
    serial=`egrep '^(system serial number)' /proc/cpuinfo | sort -u | cut -f2 -d: | sed -e 's/^ //' |  head -n 1`
    if [ "${serial}" != "" ]; then
        echo 'candidate_serial[]:' ${serial}
    fi
    
    if [ "${model}" != "" ]; then
        echo 'candidate_model[]:' ${model}
    fi
    
    cpuspeed=`egrep '^(cycle frequency \[Hz\])' /proc/cpuinfo | cut -f2 -d: | sed -e 's/\.[0-9]*//' -e 's/Mhz//i' -e 's/ //g' | head -n 1`
    if [ "${cpuspeed}" != "" ]; then
        cpuspeed=`expr ${cpuspeed} / 1000000`
    fi

elif [ ${logical} -eq 1 ]; then
    # The common case of one logical processor, no need to do
    # anything more fancyful
    #
    physical=1
    cores=1
    threads_per_core=1

elif [ ${logical} -ge 2 ]; then
    # The "siblings" attribute, when present, if fairly reliable. It
    # indicates how many logical processors are running on each
    # physical. Each of those 'sibling' could be a core or a thread
    # or a combination of both.
    siblings=`egrep '^siblings' /proc/cpuinfo | head -n 1 | awk '{print $3}' | tr -d '[:space:]'`
    if [ "${siblings}" = "" ]; then
        siblings=0
    fi
    
    # Some processors are described as dual or quad core in their description.
    # Use this as a hint to confirm the number of cores reported by the OS
    # or use outright if the OS has no clue.
    isDualCore=`echo ${cputype} | egrep -i 'dual.?(core|cpu)'`
    isQuadCore=`echo ${cputype} | egrep -i 'quad.?(core|cpu)'`
    if [ "${isDualCore}" != "" ]; then
        cores_hint=2
    elif [ "${isQuadCore}" != "" ]; then
        cores_hint=4
    else
        isOpteron=`echo ${cputype} | egrep -i 'amd +opteron *\(tm\) +processor.*[0-9][0-9][0-9]'`
        
        if [ "${isOpteron}" != "" ]; then
            # time to try some common CPU detection.
            opteron_number=`expr match "${cputype}" '.*\(.[0-9][0-9][0-9]\)'`
            if [ ${opteron_number} -lt 1000 ]; then
                # Right now numbers below x60 are 1 core
                # Over x60 are dual core
                if [ `echo ${opteron_number} | cut -c2` -lt 6 ]; then
                    cores_hint=1
                    siblings=1
                else
                    cores_hint=2
                    siblings=2
                fi
            else
                # 4 digit processor code. The second digit is the most significant
                opteron_cores=`echo ${opteron_number} | cut -c2`
                if [ ${opteron_cores} -eq 1 ]; then
                    if [ `echo ${opteron_number} | cut -c1` -eq 4 ]; then
                        if [ `echo ${opteron_number} | cut -c3` -lt 6 ]; then
                            # 41xx where xx is lower than 60 are 4 cores
                            cores_hint=4
                            siblings=4
                        else
                            # 41xx where xx is higher than 60 are 6 cores                    
                            cores_hint=6
                            siblings=6
                        fi
                    elif [ `echo ${opteron_number} | cut -c1` -eq 6 ]; then
                        if [ `echo ${opteron_number} | cut -c3` -lt 6 ]; then
                            # 61xx where xx is lower than 60 are 8 cores
                            cores_hint=8
                            siblings=8
                        else
                            # 61xx where xx is higher than 60 are 12 cores                    
                            cores_hint=12
                            siblings=12
                        fi
                    fi
                elif [ ${opteron_cores} -eq 2 ]; then
                    # x2xx are all dual-core
                    cores_hint=2
                    siblings=2
                elif [ ${opteron_cores} -eq 3 ]; then
                    # x3xx are all quad core
                    cores_hint=4
                    siblings=4
                elif [ ${opteron_cores} -eq 4 ]; then
                    # x4xx are 6 cores.
                    cores_hint=6
                    siblings=6
                fi
            fi
        else
            cores_hint=0
        fi
    fi

    # Use "cpu cores" if available. Note that "core id" is not exploitable
    # as the system sometimes assigns a core id to each core on the system
    # and sometimes reuse the same id on two cores on separate processors.
    cores=`egrep '^cpu cores' /proc/cpuinfo | head -n 1 | awk '{print $4}' | tr -d '[:space:]'`
    if [ "${cores}" = "" ]; then
        cores=${cores_hint}
    elif [ ${cores_hint} -ne 0 ]; then
        if [ ${cores_hint} -ne ${cores} ]; then
            cores=0
        fi
    fi
    
    # Do some fixing.
    if [ ${cores} -gt ${siblings} ]; then
        # Taking a risk here, but multicore hyperthreaded cpus are
        # not that common 
        siblings=${cores}
    fi
    
    # If we do not have access to sibling it is not possible to figure out
    # the number of physical processors from the OS

    if [ ${cores} -eq ${logical} ]; then
        # A special case, we got the number of cores, but not the siblings
        # In that case if the number of cores is the same as the number of
        # logical CPU it is safe to assume one physical package.
        physical=1
        threads_per_core=1
        
    elif [ ${siblings} -ne 0 ]; then
        # Check if the number of physical CPUs can be determined. Unfortunately
        # old version of linux sometimes use the same physical ID for separate
        # processors. So this value is retrieved only if we can confirm it via the 
        # siblings
        physical=`egrep '^(physical id)|(Physical processor ID)' /proc/cpuinfo | cut -f2 -d: | sed -e 's/^ //' | sort -u | wc -l`
    
        calculated=`expr ${logical} / ${siblings}`
        
        if [ ${calculated} -ne ${physical} ]; then
            # conflicting information. Better not to take a position rather
            # than being wrong
            if [ ${cores} -eq 0 ]; then
                physical=0
            else
                physical=${calculated}
            fi
        fi
        
        # There is no easy way to find out the number of threads running in each
        # processor. Relying on the htt flag is not an option as this flag is
        # set on processors on which we know there is not hyperthreading at all.
        # So this value is set only if we get good data on cores and siblings.
        if [ ${cores} -ne 0 ]; then
            threads_per_core=`expr ${siblings} / ${cores}`
        fi

    fi
    
fi

# Please do not remove the next line.
# It is used as an anchor for the test suite.
print=1

The following code:

    uuid=""
    PRIV_ESXCFG /usr/sbin/esxcfg-info --hardware > ${file} 2>/dev/null
    if [ $? -eq 0 ]; then
        physical=`grep "Num Packages\." ${file} | sed -e "s/[^0-9]//g"`
        logical=`grep "Num Cores." ${file} | head -n 1 | sed -e "s/[^0-9]//g"`
        cores=`expr ${logical} / ${physical}`
        total_threads=`grep "Num Threads\." ${file} | sed -e "s/[^0-9]//g"`
        threads_per_core=`expr ${total_threads} / ${logical}`
        cpuspeed=`egrep -i "cpu ?speed\." ${file} | head -n 1 | sed 's/[^0-9]*//g' | awk '{printf( " @ %.1f GHz\n", $1/1024**3)}'`
        tmp=`echo ${cputype} | sed 's/ @.*$//'`
        cputype="${tmp} ${cpuspeed}"
        ram=`grep "Physical Mem\." ${file} | sed 's/[^0-9]*//g'`B
        # For esx/esxi, we should NOT use memory from dmesg or /proc/meminfo 
        # because the values are incorrect
        logical_ram=""
        uuid=`grep "BIOS UUID\." ${file}`
    else
        print=0
    fi
    rm -f ${file}

is replaced with:

    uuid=""
    PRIV_ESXCFG /usr/sbin/esxcfg-info --hardware > ${file} 2>/dev/null
    if [ $? -eq 0 ]; then
        ram=`grep "Physical Mem\." ${file} | sed 's/[^0-9]*//g'`B
        # For esx/esxi, we should NOT use memory from dmesg or /proc/meminfo 
        # because the values are incorrect
        logical_ram=""
        uuid=`grep "BIOS UUID\." ${file}`
    fi
    rm -f ${file}

The following code:

if [ -f /opt/xensource/bin/xe ]; then
    print=0
    # /proc/cpuinfo reports incorrectly for Xen domains, use "xe"
    # However, this can only tell us the logical processor count, not
    # physical, core count or threads per core
    XE=/opt/xensource/bin/xe
    cores=0
    threads_per_core=0
    physical=0
    cpu_list=`PRIV_XE $XE host-cpu-list 2>/dev/null`
    if [ $? -eq 0 ]; then

        logical=`echo "$cpu_list" | grep uuid | wc -l`
        uuid=`echo "$cpu_list" | grep uuid | head -n 1 | cut -f2 -d: | awk '{print $1;}'`
        cputype=`PRIV_XE $XE host-cpu-param-get uuid=$uuid param-name=modelname`
        cpuspeed=`PRIV_XE $XE host-cpu-param-get uuid=$uuid param-name=speed`

        # /proc/meminfo reports incorrectly for Xen domains, use "xe"
        uuid=`PRIV_XE $XE host-list | grep uuid | head -n 1 | cut -f2 -d: | awk '{print $1;}'`
        logical_ram=`PRIV_XE $XE host-param-get uuid=$uuid param-name=memory-total`
        print=1
    fi
fi

echo 'kernel:' `uname -r`

if [ ${print} -eq 1 ]; then
    # Report processor/memory info
    if [ ${logical} -ne 0 ]; then
        echo 'num_logical_processors:' ${logical}
    fi
    if [ ${cores} -ne 0 ]; then
        echo 'cores_per_processor:' ${cores}
    fi
    if [ ${threads_per_core} -ne 0 ]; then
        echo 'threads_per_core:' ${threads_per_core}
    fi
    if [ ${physical} -ne 0 ]; then
        echo 'num_processors:' ${physical}
    fi
    if [ "${cputype}" != "" ]; then
        echo 'processor_type:' ${cputype}
    fi
    if [ "${cpuspeed}" != "" ]; then
        echo 'processor_speed:' ${cpuspeed}
    fi
    if [ "${ram}" != "" ]; then
        echo 'ram:' ${ram}
    fi
    if [ "${logical_ram}" != "" ]; then
        echo 'logical_ram:' ${logical_ram}
    fi
fi

# Get uptime in days and seconds

is replaced with:

if [ -f /opt/xensource/bin/xe ]; then
    # /proc/meminfo reports incorrectly for Xen domains, use "xe"
    uuid=`PRIV_XE $XE host-list | grep uuid | head -n 1 | cut -f2 -d: | awk '{print $1;}'`
    if [ $? -eq 0 ]; then
    fi
fi

echo 'kernel:' `uname -r`

if [ "${ram}" != "" ]; then
    echo 'ram:' ${ram}
fi
if [ "${logical_ram}" != "" ]; then
    echo 'logical_ram:' ${logical_ram}
fi

# Get uptime in days and seconds
initialise

The following code is added:

# bash 4 added command_not_found_handle called when a command is unavailable.
# PackageKit-command-not-found RHEL and Fedora ask to install the package
# making discovery stall. Undefine function to stop this.
unset command_not_found_handle


# Stop alias commands changing behaviour.
getDeviceInfo

The following code:

echo 'dns_domain: ' $dns_domain

nis_domain=`domainname 2>/dev/null`
if [ "$nis_domain" == "" ]; then
  nis_domain=`hostname -y 2>/dev/null`
fi
echo 'domain: ' $nis_domain | sed -e 's/(none)//'

is replaced with:

echo 'dns_domain: ' $dns_domain

nis_domain=`domainname 2>/dev/null`
if [ "$nis_domain" = "" ]; then
  nis_domain=`hostname -y 2>/dev/null`
fi
echo 'domain: ' $nis_domain | sed -e 's/(none)//'

HPUX

getHostInfo

The following code:

    echo 'begin machinfo:'
    if [ $OSVER -ge 1131 ]; then
        /usr/contrib/bin/machinfo -v
        echo 'cpu_threading_enabled: ' `kctune lcpu_attr 2>/dev/null | tail -1 | awk '{print $2;}'`
    else
        /usr/contrib/bin/machinfo
    fi
    echo 'end machinfo:'
else
    cores=0
    logical_ram=""
    ram=""
    if [ -x /usr/sbin/parstatus ]; then
        par_id=`/usr/sbin/parstatus -w 2> /dev/null | grep "The local partition number is" | sed 's/.*The local partition number is \([0-9]*\)\..*/\1/'`
        if [ "$par_id" ]; then
            echo par_id: $par_id
            cpumem=`/usr/sbin/parstatus -C -M |awk -v PAR_ID=$par_id 'BEGIN{ FS=":" };{ if ($NF==PAR_ID) { split($4,cpuarray,"/"); split($5,memarray,"/"); cpu+=cpuarray[1]; mem+=int(memarray[1])} };END{ printf "%d %d\n",cpu,mem }'`
            cores=`echo "$cpumem" |awk '{print $1}'`
            logical_ram=`echo "$cpumem" |awk '{print $2}'`
            logical_ram=`echo "$logical_ram" '* 1048576 * 1024' | bc`
            echo logical_ram: $logical_ram
        fi
    fi
    if [ $cores -eq 0 ]; then
        cores=`/usr/sbin/ioscan -kC processor 2>/dev/null | grep processor | wc -l`
    fi
    if [ "$OSVER" -ge 1100 ]; then
        chip_type=$((`getconf CPU_CHIP_TYPE` >> 5))
    fi
    
    if [ "$chip_type" = "20" ]; then
        cores_per_processor=2
    else
        cores_per_processor=1
    fi
    echo cores_per_processor: $cores_per_processor
    echo num_logical_processors: $cores

    echo "begin hpux_cpu_info:"
    echo "cpu_count:" `expr $cores / $cores_per_processor`
    echo "cpu_version:" `getconf CPU_VERSION`
    if [ "$chip_type" ]; then
        echo "cpu_chip_type:" $chip_type
    fi
    echo 'cpu_model:' `model 2>/dev/null`
    echo "end hpux_cpu_info"
    

    ram=`echo "selclass qualifier memory;infolog" | cstm 2>/dev/null | grep 'System Total'`
    if [ "$ram" != "" ]; then

is replaced with:

    echo 'begin machinfo:'
    if [ $OSVER -ge 1131 ]; then
        /usr/contrib/bin/machinfo -v
    else
        /usr/contrib/bin/machinfo
    fi
    echo 'end machinfo:'
else
    logical_ram=""
    ram=""
    if [ -x /usr/sbin/parstatus ]; then
        par_id=`/usr/sbin/parstatus -w 2> /dev/null | grep "The local partition number is" | sed 's/.*The local partition number is \([0-9]*\)\..*/\1/'`
        if [ "$par_id" ]; then
            echo par_id: $par_id
            logical_ram=`/usr/sbin/parstatus -C -M |awk -v PAR_ID=$par_id 'BEGIN{ FS=":" };{ if ($NF==PAR_ID) { split($5, memarray,"/"); mem += int(memarray[1])} };END{ printf "logical_ram: %d\n", mem * 1048576 * 1024 }'`
        fi
    fi

    ram=`echo "selclass qualifier memory;infolog" | cstm 2>/dev/null | grep 'System Total'`
    if [ "$ram" != "" ]; then

VMware ESX

getHostInfo: host_info: cmd changed:

The following code is removed:

# First, gather information about the processor.
cpuspeed=`egrep '^(cpu MHz|cpu clock|clock)' /proc/cpuinfo | cut -f2 -d: | sed -e 's/\.[0-9]*//' -e 's/Mhz//i' -e 's/ //g' | head -n 1`

cputype=`egrep '^cpu[^a-z]*:' /proc/cpuinfo | sort -u | cut -f2 -d: | sed -e 's/^ //' |  head -n 1`
if [ "${cputype}" = "" ]; then
    cputype=`egrep '^model name' /proc/cpuinfo | sort -u | cut -f2 -d: | sed -e 's/^ //' |  head -n 1`
fi
if [ "${cputype}" = "" ]; then
    cputype=`egrep '^arch' /proc/cpuinfo | sort -u | cut -f2 -d: | sed -e 's/^ //' |  head -n 1`
fi
if [ "${cputype}" = "" ]; then
    cputype=`egrep '^(cpu model|family|vendor_id|machine|Processor)' /proc/cpuinfo | sort -u | cut -f2 -d: | sed -e 's/^ //' |  head -n 1`
fi

# This value is the number of logical processors available
logical=`egrep '^[pP]rocessor' /proc/cpuinfo | sort -u | wc -l`

physical=0
cores=0
threads_per_core=0

if [ "`echo $cputype | cut -c-2`" = "PA" ]; then
    # check if it is a PA-RISC processor
    cpufamily=`egrep '^(cpu family)' /proc/cpuinfo | sort -u | cut -f2 -d: | sed -e 's/^ //' |  head -n 1`
    if [ "`echo $cpufamily | cut -c-7`" = "PA-RISC" ]; then
        cputype="${cpufamily} ${cputype}"
        model=`egrep '^(model name)' /proc/cpuinfo | sort -u | cut -f2 -d: | sed -e 's/^ //' |  head -n 1`
        
        if [ "${model}" != "" ]; then
            echo 'candidate_model[]:' ${model}
        fi
    fi
fi

if  [ "${cputype}" = "Alpha" ]; then
    # Alpha doesn't have one entry per processor.
    cpumodel=`egrep '^(cpu model)' /proc/cpuinfo | sort -u | cut -f2 -d: | sed -e 's/^ //' |  head -n 1`
    cputype="${cputype} ${cpumodel}"
    cores=1
    threads_per_core=1
    physical=`egrep '^(cpus detected)' /proc/cpuinfo | sort -u | cut -f2 -d: | sed -e 's/^ //' |  head -n 1`
    if [ "$physical" = "" ]; then
        physical=1
    fi
    logical=${physical}
    model=`egrep '^(platform string)' /proc/cpuinfo | sort -u | cut -f2 -d: | sed -e 's/^ //' |  head -n 1`
    serial=`egrep '^(system serial number)' /proc/cpuinfo | sort -u | cut -f2 -d: | sed -e 's/^ //' |  head -n 1`
    if [ "${serial}" != "" ]; then
        echo 'candidate_serial[]:' ${serial}
    fi
    
    if [ "${model}" != "" ]; then
        echo 'candidate_model[]:' ${model}
    fi
    
    cpuspeed=`egrep '^(cycle frequency \[Hz\])' /proc/cpuinfo | cut -f2 -d: | sed -e 's/\.[0-9]*//' -e 's/Mhz//i' -e 's/ //g' | head -n 1`
    if [ "${cpuspeed}" != "" ]; then
        cpuspeed=`expr ${cpuspeed} / 1000000`
    fi

elif [ ${logical} -eq 1 ]; then
    # The common case of one logical processor, no need to do
    # anything more fancyful
    #
    physical=1
    cores=1
    threads_per_core=1

elif [ ${logical} -ge 2 ]; then
    # The "siblings" attribute, when present, if fairly reliable. It
    # indicates how many logical processors are running on each
    # physical. Each of those 'sibling' could be a core or a thread
    # or a combination of both.
    siblings=`egrep '^siblings' /proc/cpuinfo | head -n 1 | awk '{print $3}' | tr -d '[:space:]'`
    if [ "${siblings}" = "" ]; then
        siblings=0
    fi
    
    # Some processors are described as dual or quad core in their description.
    # Use this as a hint to confirm the number of cores reported by the OS
    # or use outright if the OS has no clue.
    isDualCore=`echo ${cputype} | egrep -i 'dual.?(core|cpu)'`
    isQuadCore=`echo ${cputype} | egrep -i 'quad.?(core|cpu)'`
    if [ "${isDualCore}" != "" ]; then
        cores_hint=2
    elif [ "${isQuadCore}" != "" ]; then
        cores_hint=4
    else
        isOpteron=`echo ${cputype} | egrep -i 'amd +opteron *\(tm\) +processor.*[0-9][0-9][0-9]'`
        
        if [ "${isOpteron}" != "" ]; then
            # time to try some common CPU detection.
            opteron_number=`expr match "${cputype}" '.*\(.[0-9][0-9][0-9]\)'`
            if [ ${opteron_number} -lt 1000 ]; then
                # Right now numbers below x60 are 1 core
                # Over x60 are dual core
                if [ `echo ${opteron_number} | cut -c2` -lt 6 ]; then
                    cores_hint=1
                    siblings=1
                else
                    cores_hint=2
                    siblings=2
                fi
            else
                # 4 digit processor code. The second digit is the most significant
                opteron_cores=`echo ${opteron_number} | cut -c2`
                if [ ${opteron_cores} -eq 1 ]; then
                    if [ `echo ${opteron_number} | cut -c1` -eq 4 ]; then
                        if [ `echo ${opteron_number} | cut -c3` -lt 6 ]; then
                            # 41xx where xx is lower than 60 are 4 cores
                            cores_hint=4
                            siblings=4
                        else
                            # 41xx where xx is higher than 60 are 6 cores                    
                            cores_hint=6
                            siblings=6
                        fi
                    elif [ `echo ${opteron_number} | cut -c1` -eq 6 ]; then
                        if [ `echo ${opteron_number} | cut -c3` -lt 6 ]; then
                            # 61xx where xx is lower than 60 are 8 cores
                            cores_hint=8
                            siblings=8
                        else
                            # 61xx where xx is higher than 60 are 12 cores                    
                            cores_hint=12
                            siblings=12
                        fi
                    fi
                elif [ ${opteron_cores} -eq 2 ]; then
                    # x2xx are all dual-core
                    cores_hint=2
                    siblings=2
                elif [ ${opteron_cores} -eq 3 ]; then
                    # x3xx are all quad core
                    cores_hint=4
                    siblings=4
                elif [ ${opteron_cores} -eq 4 ]; then
                    # x4xx are 6 cores.
                    cores_hint=6
                    siblings=6
                fi
            fi
        else
            cores_hint=0
        fi
    fi

    # Use "cpu cores" if available. Note that "core id" is not exploitable
    # as the system sometimes assigns a core id to each core on the system
    # and sometimes reuse the same id on two cores on separate processors.
    cores=`egrep '^cpu cores' /proc/cpuinfo | head -n 1 | awk '{print $4}' | tr -d '[:space:]'`
    if [ "${cores}" = "" ]; then
        cores=${cores_hint}
    elif [ ${cores_hint} -ne 0 ]; then
        if [ ${cores_hint} -ne ${cores} ]; then
            cores=0
        fi
    fi
    
    # Do some fixing.
    if [ ${cores} -gt ${siblings} ]; then
        # Taking a risk here, but multicore hyperthreaded cpus are
        # not that common 
        siblings=${cores}
    fi
    
    # If we do not have access to sibling it is not possible to figure out
    # the number of physical processors from the OS

    if [ ${cores} -eq ${logical} ]; then
        # A special case, we got the number of cores, but not the siblings
        # In that case if the number of cores is the same as the number of
        # logical CPU it is safe to assume one physical package.
        physical=1
        threads_per_core=1
        
    elif [ ${siblings} -ne 0 ]; then
        # Check if the number of physical CPUs can be determined. Unfortunately
        # old version of linux sometimes use the same physical ID for separate
        # processors. So this value is retrieved only if we can confirm it via the 
        # siblings
        physical=`egrep '^(physical id)|(Physical processor ID)' /proc/cpuinfo | cut -f2 -d: | sed -e 's/^ //' | sort -u | wc -l`
    
        calculated=`expr ${logical} / ${siblings}`
        
        if [ ${calculated} -ne ${physical} ]; then
            # conflicting information. Better not to take a position rather
            # than being wrong
            if [ ${cores} -eq 0 ]; then
                physical=0
            else
                physical=${calculated}
            fi
        fi
        
        # There is no easy way to find out the number of threads running in each
        # processor. Relying on the htt flag is not an option as this flag is
        # set on processors on which we know there is not hyperthreading at all.
        # So this value is set only if we get good data on cores and siblings.
        if [ ${cores} -ne 0 ]; then
            threads_per_core=`expr ${siblings} / ${cores}`
        fi

    fi
    
fi

# Please do not remove the next line.
# It is used as an anchor for the test suite.
print=1

The following code:

    uuid=""
    PRIV_ESXCFG /usr/sbin/esxcfg-info --hardware > ${file} 2>/dev/null
    if [ $? -eq 0 ]; then
        physical=`grep "Num Packages\." ${file} | sed -e "s/[^0-9]//g"`
        logical=`grep "Num Cores." ${file} | head -n 1 | sed -e "s/[^0-9]//g"`
        cores=`expr ${logical} / ${physical}`
        total_threads=`grep "Num Threads\." ${file} | sed -e "s/[^0-9]//g"`
        threads_per_core=`expr ${total_threads} / ${logical}`
        cpuspeed=`egrep -i "cpu ?speed\." ${file} | head -n 1 | sed 's/[^0-9]*//g' | awk '{printf( " @ %.1f GHz\n", $1/1024**3)}'`
        tmp=`echo ${cputype} | sed 's/ @.*$//'`
        cputype="${tmp} ${cpuspeed}"
        ram=`grep "Physical Mem\." ${file} | sed 's/[^0-9]*//g'`B
        # For esx/esxi, we should NOT use memory from dmesg or /proc/meminfo 
        # because the values are incorrect
        logical_ram=""
        uuid=`grep "BIOS UUID\." ${file}`
    else
        print=0
    fi
    rm -f ${file}

is replaced with:

    uuid=""
    PRIV_ESXCFG /usr/sbin/esxcfg-info --hardware > ${file} 2>/dev/null
    if [ $? -eq 0 ]; then
        ram=`grep "Physical Mem\." ${file} | sed 's/[^0-9]*//g'`B
        # For esx/esxi, we should NOT use memory from dmesg or /proc/meminfo 
        # because the values are incorrect
        logical_ram=""
        uuid=`grep "BIOS UUID\." ${file}`
    fi
    rm -f ${file}

The following code:

is replaced with:

if [ -f /opt/xensource/bin/xe ]; then
    print=0
    # /proc/cpuinfo reports incorrectly for Xen domains, use "xe"
    # However, this can only tell us the logical processor count, not
    # physical, core count or threads per core
    XE=/opt/xensource/bin/xe
    cores=0
    threads_per_core=0
    physical=0
    cpu_list=`PRIV_XE $XE host-cpu-list 2>/dev/null`
    if [ $? -eq 0 ]; then

        logical=`echo "$cpu_list" | grep uuid | wc -l`
        uuid=`echo "$cpu_list" | grep uuid | head -n 1 | cut -f2 -d: | awk '{print $1;}'`
        cputype=`PRIV_XE $XE host-cpu-param-get uuid=$uuid param-name=modelname`
        cpuspeed=`PRIV_XE $XE host-cpu-param-get uuid=$uuid param-name=speed`

        # /proc/meminfo reports incorrectly for Xen domains, use "xe"
        uuid=`PRIV_XE $XE host-list | grep uuid | head -n 1 | cut -f2 -d: | awk '{print $1;}'`
        logical_ram=`PRIV_XE $XE host-param-get uuid=$uuid param-name=memory-total`
        print=1
    fi
fi

echo 'kernel:' `uname -r`

if [ ${print} -eq 1 ]; then
    # Report processor/memory info
    if [ ${logical} -ne 0 ]; then
        echo 'num_logical_processors:' ${logical}
    fi
    if [ ${cores} -ne 0 ]; then
        echo 'cores_per_processor:' ${cores}
    fi
    if [ ${threads_per_core} -ne 0 ]; then
        echo 'threads_per_core:' ${threads_per_core}
    fi
    if [ ${physical} -ne 0 ]; then
        echo 'num_processors:' ${physical}
    fi
    if [ "${cputype}" != "" ]; then
        echo 'processor_type:' ${cputype}
    fi
    if [ "${cpuspeed}" != "" ]; then
        echo 'processor_speed:' ${cpuspeed}
    fi
    if [ "${ram}" != "" ]; then
        echo 'ram:' ${ram}
    fi
    if [ "${logical_ram}" != "" ]; then
        echo 'logical_ram:' ${logical_ram}
    fi
fi

# Get uptime in days and seconds
if [ -f /opt/xensource/bin/xe ]; then
    # /proc/meminfo reports incorrectly for Xen domains, use "xe"
    uuid=`PRIV_XE $XE host-list | grep uuid | head -n 1 | cut -f2 -d: | awk '{print $1;}'`
    if [ $? -eq 0 ]; then
        logical_ram=`PRIV_XE $XE host-param-get uuid=$uuid param-name=memory-total`
    fi
fi

echo 'kernel:' `uname -r`

if [ "${ram}" != "" ]; then
    echo 'ram:' ${ram}
fi
if [ "${logical_ram}" != "" ]; then
    echo 'logical_ram:' ${logical_ram}
fi

# Get uptime in days and seconds

VMware ESX

initialise

The following code is added:

# bash 4 added command_not_found_handle called when a command is unavailable.
# PackageKit-command-not-found RHEL and Fedora ask to install the package
# making discovery stall. Undefine function to stop this.
unset command_not_found_handle
getDeviceInfo

The following code:

echo 'dns_domain: ' $dns_domain

nis_domain=`domainname 2>/dev/null`
if [ "$nis_domain" == "" ]; then
  nis_domain=`hostname -y 2>/dev/null`
fi
echo 'domain: ' $nis_domain | sed -e 's/(none)//'

is replaced with:

echo 'dns_domain: ' $dns_domain

nis_domain=`domainname 2>/dev/null`
if [ "$nis_domain" = "" ]; then
  nis_domain=`hostname -y 2>/dev/null`
fi
echo 'domain: ' $nis_domain | sed -e 's/(none)//'

Discovery command changes from 10.1 to 10.2

 Click here to show the discovery command changes from 10.1 to 10.2
 

Solaris

getHostInfo

The following code:

            platdir=/usr/platform/`uname -m`/sbin/sparcv9
        elif [ -x /usr/platform/`uname -i`/sbin/prtdiag ]; then
            platdir=/usr/platform/`uname -i`/sbin
        else
            platdir=/sbin
        fi

is replaced with:

            platdir=/usr/platform/`uname -m`/sbin/sparcv9
        elif [ -x /usr/platform/`uname -i`/sbin/prtdiag ]; then
            platdir=/usr/platform/`uname -i`/sbin
        elif [ -x /usr/sbin/prtdiag ]; then
            platdir=/usr/sbin
        else
            platdir=/sbin
        fi
getNetworkInterfaces

The following code:

     if [ $GOT_SPEED_DUPLEX -eq 1 ]; then # ndd -get may provide negotiation info
        for NAME in $LINKNAMES; do
           NIC_TYPE=`echo $NAME | sed 's/[0-9]*//g'`
             case $NIC_TYPE in
                 dmfe | bge | nxge | igb)
                     echo 'NDD :' $NAME ':adv_autoneg_cap:' `PRIV_NDD $NDD -get /dev/$NAME adv_autoneg_cap 2>/dev/null`

is replaced with:

      if [ $GOT_SPEED_DUPLEX -eq 1 ]; then # ndd -get may provide negotiation info
         for NAME in $LINKNAMES; do
            NIC_TYPE=`echo $NAME | sed 's/[0-9.]*//g'`
            case $NIC_TYPE in
                dmfe | bge | nxge | igb)
                    echo 'NDD :' $NAME ':adv_autoneg_cap:' `PRIV_NDD $NDD -get /dev/$NAME adv_autoneg_cap 2>/dev/null`

The following code:

        vars_fjqe="link_mode link_speed adv_autoneg_cap"
        vars_fjgi="link_mode link_speed adv_autoneg_cap"
        vars_igb="link_duplex link_speed adv_autoneg_cap"
        LISTOFTYPES=`echo "$LINKNAMES" | sed 's/[0-9]*$//g' | sort -u`
        LISTOFSETTYPES=`echo $LISTOFTYPES | sed -e 's/bge//' -e 's/dmfe//' -e 's/igb//' -e s'/vsw//'`
        for iface in $LISTOFSETTYPES; do
            eval initial_$iface=`PRIV_NDD $NDD -get /dev/$iface instance 2>/dev/null`
        done
        for NAME in $LINKNAMES; do
            NIC_TYPE=`echo $NAME | sed 's/[0-9]*//g'`
            NIC_NUMBER=`echo $NAME | sed 's/[a-z]*//'`
            eval vars=\$vars_$NIC_TYPE
            case $NIC_TYPE in

is replaced with:

        vars_fjqe="link_mode link_speed adv_autoneg_cap"
        vars_fjgi="link_mode link_speed adv_autoneg_cap"
        vars_igb="link_duplex link_speed adv_autoneg_cap"
        LISTOFTYPES=`echo "$LINKNAMES" | sed 's/[0-9.]*$//g' | sort -u`
        LISTOFSETTYPES=`echo $LISTOFTYPES | sed -e 's/bge//' -e 's/dmfe//' -e 's/igb//' -e s'/vsw//'`
        for iface in $LISTOFSETTYPES; do
            eval initial_$iface=`PRIV_NDD $NDD -get /dev/$iface instance 2>/dev/null`
        done
        for NAME in $LINKNAMES; do
            NIC_TYPE=`echo $NAME | sed 's/[0-9.]*//g'`
            NIC_NUMBER=`echo $NAME | sed 's/[a-z]*//'`
            eval vars=\$vars_$NIC_TYPE
            case $NIC_TYPE in

Linux

getHostInfo

The following code is added:

# The specification only allows for the physical RAM size to be given in either
# KB or MB.  [System Management BIOS (SMBIOS) Reference Specification, p.86 -
# http://www.dmtf.org/sites/default/files/standards/documents/DSP0134_2.8.0.pdf]
if [ -f /usr/sbin/dmidecode ]; then
    dmidecode_ram=`PRIV_DMIDECODE /usr/sbin/dmidecode -t 17 2>/dev/null | awk '
        /Size:/ {
            if ($3 == "kB" || $3 == "KB")
                size += $2
            else if ($3 == "MB")
                size += $2*1024
        }
        END {
            print size
        }'`
    if [ "${dmidecode_ram}" != "" ]; then
        ram="${dmidecode_ram}KB"
    fi
fi
initialise

The following code is added:

# ss requires superuser privileges to display process identifiers (PIDs)
# for ports opened by processes not running as the current user
PRIV_SS() {
    "$@"
}
getDeviceInfo

The following code:

ihn=`hostname 2>/dev/null`
if [ "$ihn" = "localhost" ]; then
    ihn=`hostname 2>/dev/null`
fi
echo 'hostname:' $ihn
echo 'fqdn:' `hostname --fqdn 2>/dev/null`
dns_domain=`hostname -d 2>/dev/null | sed -e 's/(none)//'` 
if [ "$dns_domain" = "" -a -r /etc/resolv.conf ]; then 

is replaced with:

echo 'hostname:' `hostname 2>/dev/null`
echo 'fqdn:' `hostname --fqdn 2>/dev/null`
dns_domain=`hostname -d 2>/dev/null | sed -e 's/(none)//'` 
if [ "$dns_domain" = "" -a -r /etc/resolv.conf ]; then 

VMware ESX

getHostInfo

The following code is added:

# The specification only allows for the physical RAM size to be given in either
# KB or MB.  [System Management BIOS (SMBIOS) Reference Specification, p.86 -
# http://www.dmtf.org/sites/default/files/standards/documents/DSP0134_2.8.0.pdf]
if [ -f /usr/sbin/dmidecode ]; then
    dmidecode_ram=`PRIV_DMIDECODE /usr/sbin/dmidecode -t 17 2>/dev/null | awk '
        /Size:/ {
            if ($3 == "kB" || $3 == "KB")
                size += $2
            else if ($3 == "MB")
                size += $2*1024
        }
        END {
            print size
        }'`
    if [ "${dmidecode_ram}" != "" ]; then
        ram="${dmidecode_ram}KB"
    fi
fi

initialise

The following code is added:

# ss requires superuser privileges to display process identifiers (PIDs)
# for ports opened by processes not running as the current user
PRIV_SS() {
    "$@"
}
getDeviceInfo

The following code:

ihn=`hostname 2>/dev/null`
if [ "$ihn" = "localhost" ]; then
    ihn=`hostname 2>/dev/null`
fi
echo 'hostname:' $ihn
echo 'fqdn:' `hostname --fqdn 2>/dev/null`
dns_domain=`hostname -d 2>/dev/null | sed -e 's/(none)//'` 
if [ "$dns_domain" = "" -a -r /etc/resolv.conf ]; then 

is replaced with:

echo 'hostname:' `hostname 2>/dev/null`
echo 'fqdn:' `hostname --fqdn 2>/dev/null`
dns_domain=`hostname -d 2>/dev/null | sed -e 's/(none)//'` 
if [ "$dns_domain" = "" -a -r /etc/resolv.conf ]; then 

Discovery command changes from 10.0 to 10.1

 Click here to show the discovery command changes from 10.0 to 10.1
 

Solaris

getHostInfo

The following code:

         elif [ -x /usr/platform/`uname -m`/sbin/sparcv9/prtdiag ]; then                        
             platdir=/usr/platform/`uname -m`/sbin/sparcv9
         else
             platdir=/usr/platform/`uname -i`/sbin

is replaced with:

         elif [ -x /usr/platform/`uname -m`/sbin/sparcv9/prtdiag ]; then                        
             platdir=/usr/platform/`uname -m`/sbin/sparcv9
         elif [ -x /usr/platform/`uname -i`/sbin/prtdiag ]; then
             platdir=/usr/platform/`uname -i`/sbin
         else
             platdir=/sbin

The following code is added:

# Solaris 9 and earlier do not support zones directly.
# There isn't any commands to run inside a branded zone to detect if it's a zone.
# However, the zonename is usually listed in /etc/mnttab (for all solaris zones)
# For example:
# Solaris 11: mnttab /zones/sol11z1/root/etc/mnttab mntfs nodevices,zone=sol11z1,sharezone=1,dev=8600002 1396255682
# Solaris 9:  mnttab  /etc/mnttab     mntfs   nodevices,zone=phx-eai-ris-prod1-int,dev=51c0017        1393042650
if [ $os_ver -lt 10 -a -r /etc/mnttab ]; then
    mnttabstr=`cat /etc/mnttab | grep mnttab | grep zone=`
    if [ "$mnttabstr" != "" ]; then
        options=`echo $mnttabstr | awk '{ print $4 }' | tr "," "\n"`
        for member in $options; do
            case $member in
                zone* ) echo $member | sed -e 's/zone=/zonename: /';;
            esac
        done
    fi
fi

AIX

getHostInfo

The following code:

echo 'begin lparstat:'
cat /tmp/tideway.$$
echo 'end lparstat'

is replaced with:

echo 'begin lparstat:'
cat /tmp/tideway.$$
# Adding extra echo to workaround the AIX v7.1 bug IV56200
# which description is "LINE FEED MISSING IN LPARSTAT -I COMMAND OUTPUT"
echo
echo 'end lparstat'
getDeviceInfo

The following code:

echo 'os:' $os
maintlevel=`oslevel -r 2>/dev/null`
if [ $? -ne 0 ]; then
    maintlevel=""
fi

is replaced with:

echo 'os:' $os
maintlevel=`oslevel -s 2>/dev/null`
if [ $? -ne 0 ]; then
    maintlevel=""
fi

Linux

getDeviceInfo

The following code:

    os=`/usr/bin/lsb_release -d | cut -f2 -d: | sed -e 's/^[ \t]//'`
    if [ "$os" = "(none)" ]; then
        os=""
    else
        # Check to see if its a variant of Red Hat
        rpm -q oracle-logos > /dev/null 2>&1
        if [ $? -eq 0 ]; then

is replaced with:

    os=`/usr/bin/lsb_release -d | cut -f2 -d: | sed -e 's/^[ \t]//'`
    if [ "$os" = "(none)" ]; then
        os=""
    elif [ "$os" != "" ]; then
        # Check to see if its a variant of Red Hat
        rpm -q oracle-logos > /dev/null 2>&1
        if [ $? -eq 0 ]; then

VMware ESX

getDeviceInfo

The following code:

    os=`/usr/bin/lsb_release -d | cut -f2 -d: | sed -e 's/^[ \t]//'`
    if [ "$os" = "(none)" ]; then
        os=""
    else
        # Check to see if its a variant of Red Hat
        rpm -q oracle-logos > /dev/null 2>&1
        if [ $? -eq 0 ]; then

is replaced with:

    os=`/usr/bin/lsb_release -d | cut -f2 -d: | sed -e 's/^[ \t]//'`
    if [ "$os" = "(none)" ]; then
        os=""
    elif [ "$os" != "" ]; then
        # Check to see if its a variant of Red Hat
        rpm -q oracle-logos > /dev/null 2>&1
        if [ $? -eq 0 ]; then

Was this page helpful? Yes No Submitting... Thank you

Comments