• Loading...
This documentation refers to a previously released version of BMC Atrium Discovery (other versions).

Changes to Discovery Commands

Skip to end of metadata
Go to start of metadata
Space Search

Searching TWF 7.2

Table of Contents

The following sections show the discovery command changes between Tideway Foundation versions.

The following changes are not shown:

  • Changes to comments only
  • Commands which have been removed and not replaced
  • Changes to echo only statements

Changes that are limited to comments have been excluded.

Discovery Command Changes from 7.2 to 7.2.1

Click this link to show the Discovery Command Changes from 7.2 to 7.2.1

Removal of the Linux hostid attribute

The hostid attribute has been removed from nodes representing Linux hosts. The Linux discovery script has had the following line removed:

echo 'hostid:' `hostid`

The hostid attribute is removed from existing Linux hosts in the upgrade procedure. The changed discovery script must be merged before any scan take place or the hostid attribute will be reset. The following warning is shown in the upgrade section:

Merge Discovery Commands before scanning.
This upgrade contains a fix which removes the hostid attribute from all Linux hosts. The Discovery commands have been updated so that a hostid is no longer set for Linux hosts. You must merge the Discovery commands before performing a scan otherwise the hostid attribute will be reset for each Linux host.

Re-directing errors to /dev/null

In the UNIX discovery script, errors in the output from the lputil and hbacmd commands are redirected to /dev/null
The following lines are changed:

max_count=`echo 0 | lputil count`

becomes

max_count=`echo 0 | lputil count 2>/dev/null`

and

for WWPN in `PRIV_HBACMD hbacmd ListHBAs | awk '/Port WWN/ {print $4;}'`

becomes

for WWPN in `PRIV_HBACMD hbacmd ListHBAs 2>/dev/null | awk '/Port WWN/ {print $4;}'`

Discovery Command Changes from 7.1.7 to 7.2

Click this link to show the Discovery Command Changes from 7.1.7 to 7.2

Re-directing stderr to /dev/null

In order to prevent error messages being interpreted as valid discovery command results, a global change was made to add the the following to each executed command 2>/dev/null/

This change was made to all platforms, apart from Windows.

Moving control of privilege escalation method into Platform init blocks.

Prior to 7.2, if a particular command benefited from being executed with escalated privileges then this had to be handled withing each discovery command.

This has been improved in 7.2 by wrapping all commands that require escalated privileges in a function, defined in the init block, that can be managed centrally.

See Viewing or Disabling the Scripts Used for more details.

AIX

The init block now has the following added:

# 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() {
  "$@"
}

# lslpp requires superuser privileges to list all installed packages
PRIV_LSLPP() {
    "$@"
}


The following individual commands have been modified to use this

  • LSOF
    PRIV_LSOF lsof -l -n -P -F ptPTn -i 2>/dev/null
    
  • LSLPP
    PRIV_LSLPP lslpp -l
    
FreeBSD

The init block now has the following added:

# 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() {
  "$@"
}

# dmidecode requires superuser privileges to read data from the system BIOS
PRIV_DMIDECODE() {
    "$@"
}


The following individual commands have been modified to use this

  • LSOF
    PRIV_LSOF lsof -l -n -P -F ptPTn -i 2>/dev/null
    
  • DMIDECODE
    if [ -x /usr/sbin/dmidecode ]; then
        PRIV_DMIDECODE /usr/sbin/dmidecode 2>/dev/null | awk '/DMI type 1,/,/^Handle 0x0*[2-9]+0*/ {
            if( $1 ~ /Manufacturer:/ ) { sub(".*Manufacturer: *","");  printf( "vendor: %s\n", $0 ); }
            if( $1 ~ /Product/ && $2 ~ /Name:/ ) { sub(".*Product Name: *",""); printf( "model: %s\n", $0 ); }
            if( $1 ~ /Serial/ && $2 ~ /Number:/ ) { sub(".*Serial Number: *",""); printf( "serial: %s\n", $0 ); }
        }'
    fi
    
HPUX

The init block now has the following added:

# 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() {
  "$@"
}

# lanadmin requires superuser privileges to display any interface speed
# and negotiation settings
PRIV_LANADMIN() {
    "$@"
}

# swlist requires superuser privileges to list all installed packages
PRIV_SWLIST() {
    "$@"
}


The following individual commands have been modified to use this

  • LSOF
    PRIV_LSOF lsof -l -n -P -F ptPTn -i 2>/dev/null
    
  • SWLIST - patches
    PRIV_SWLIST swlist -l product 2>/dev/null | egrep -v '^#' | egrep 'PH[A-Z]{2}_[0-9]+' | awk '{print $1, $2;}'
    
  • SWLIST - packages
    PRIV_SWLIST swlist -l product 2>/dev/null | egrep -v '^#|PH[A-Z]{2}_[0-9]+'
    
  • LANADMIN
    PRIV_LANADMIN lanadmin -x $interface 2>/dev/null | grep -v 'NO LINK'
    
IRIX

The init block now has the following added:

# 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() {
  "$@"
}


The following individual commands have been modified to use this:

  • LSOF
    PRIV_LSOF lsof -l -n -P -F ptPTn -i 2>/dev/null
    
Linux

The init block now has the following added:

# 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() {
  "$@"
}

# dmidecode requires superuser privileges to read data from the system BIOS
PRIV_DMIDECODE() {
    "$@"
}

# hwinfo requires superuser privileges to read data from the system BIOS
PRIV_HWINFO() {
    "$@"
}

# mii-tool requires superuser privileges to display any interface speed
# and negotiation settings
PRIV_MIITOOL() {
    "$@"
}

# ethtool requires superuser privileges to display any interface speed
# and negotiation settings
PRIV_ETHTOOL() {
    "$@"
}

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

# lputil requires superuser privileges to display any HBA information
PRIV_LPUTIL() {
    "$@"
}

# hbacmd requires superuser privileges to display any HBA information
PRIV_HBACMD() {
    "$@"
}

# Xen's xe command requires superuser privileges
PRIV_XE(){
    "$@"
}


The following individual commands have been modified to use this:

  • LSOF
    PRIV_LSOF lsof -l -n -P -F ptPTn -i 2>/dev/null
    
  • DMIDECODE
    PRIV_DMIDECODE /usr/sbin/dmidecode 2>/dev/null | awk '/DMI type 1,/,/^Handle 0x0*[2-9]+0*/ {
            if( $1 ~ /Manufacturer:/ ) { sub(".*Manufacturer: *","");  printf( "vendor: %s\n", $0 ); }
            if( $1 ~ /Vendor:/ ) { sub(".*Vendor: *","");  printf( "vendor: %s\n", $0 ); }
            if( $1 ~ /Product/ && $2 ~ /Name:/ ) { sub(".*Product Name: *",""); printf( "model: %s\n", $0 ); }
            if( $1 ~ /Product:/ ) { sub(".*Product: *",""); printf( "model: %s\n", $0 ); }
            if( $1 ~ /Serial/ && $2 ~ /Number:/ ) { sub(".*Serial Number: *",""); printf( "serial: %s\n", $0 ); }
        }'
    
  • HWINFO
    PRIV_HWINFO /usr/sbin/hwinfo --bios 2>/dev/null | awk 'BEGIN { flag=0; }
    
  • MIITOOL
    PRIV_MIITOOL $MIITOOL -v $i 2>/dev/null
    
  • ETHTOOL
    PRIV_ETHTOOL $ETHTOOL $i 2>/dev/null
    
  • NETSTAT
    PRIV_NETSTAT netstat -aneep --tcp --udp 2>/dev/null
    
  • LPUTIL
    echo begin lputil_listhbas
    echo 0 | PRIV_LPUTIL lputil listhbas 2>/dev/null
    echo end lputil_listhbas
    
    echo begin lputil_fwlist
    i=0
    max_count=`echo 0 | lputil count`
    if [ $? -eq 0 ]; then
        while [ $i -lt "$max_count" ]
        do 
            echo Board $i
            echo 0 | PRIV_LPUTIL lputil fwlist $i 2>/dev/null | grep "Functional Firmware" || echo "Functional Firmware: None"
            i=`expr $i + 1`
        done
    fi
    echo end lputil_fwlist
    
  • HBACMD
    echo begin hbacmd_listhbas
    PRIV_HBACMD hbacmd ListHBAs 2>/dev/null
    echo end hbacmd_listhbas
    
    echo begin hbacmd_hbaattr
    for WWPN in `PRIV_HBACMD hbacmd ListHBAs | awk '/Port WWN/ {print $4;}'`
    do
        PRIV_HBACMD hbacmd HBAAttrib $WWPN 2>/dev/null
    done
    echo end hbacmd_hbaattr
    
MACOSX

The init block now has the following added:

# 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() {
  "$@"
}


The following individual commands have been modified to use this

  • LSOF
    PRIV_LSOF lsof -l -n -P -F ptPTn -i 2>/dev/null
    
NETBSD

The init block now has the following added:

# 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() {
  "$@"
}

# dmidecode requires superuser privileges to read data from the system BIOS
PRIV_DMIDECODE() {
    "$@"
}


The following individual commands have been modified to use this

  • LSOF
    PRIV_LSOF lsof -l -n -P -F ptPTn -i 2>/dev/null
    
  • DMIDECODE
    if [ -x /usr/sbin/dmidecode ]; then
        PRIV_DMIDECODE /usr/sbin/dmidecode 2>/dev/null | awk '/DMI type 1,/,/^Handle 0x0*[2-9]+0*/ {
            if( $1 ~ /Manufacturer:/ ) { sub(".*Manufacturer: *","");  printf( "vendor: %s\n", $0 ); }
            if( $1 ~ /Product/ && $2 ~ /Name:/ ) { sub(".*Product Name: *",""); printf( "model: %s\n", $0 ); }
            if( $1 ~ /Serial/ && $2 ~ /Number:/ ) { sub(".*Serial Number: *",""); printf( "serial: %s\n", $0 ); }
        }'
    fi
    
OPENBSD

The init block now has the following added:

# 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() {
  "$@"
}

# dmidecode requires superuser privileges to read data from the system BIOS
PRIV_DMIDECODE() {
    "$@"
}


The following individual commands have been modified to use this

  • LSOF
    PRIV_LSOF lsof -l -n -P -F ptPTn -i 2>/dev/null
    
  • DMIDECODE
    if [ -x /usr/sbin/dmidecode ]; then
        PRIV_DMIDECODE /usr/sbin/dmidecode 2>/dev/null | awk '/DMI type 1,/,/^Handle 0x0*[2-9]+0*/ {
            if( $1 ~ /Manufacturer:/ ) { sub(".*Manufacturer: *","");  printf( "vendor: %s\n", $0 ); }
            if( $1 ~ /Product/ && $2 ~ /Name:/ ) { sub(".*Product Name: *",""); printf( "model: %s\n", $0 ); }
            if( $1 ~ /Serial/ && $2 ~ /Number:/ ) { sub(".*Serial Number: *",""); printf( "serial: %s\n", $0 ); }
        }'
    fi
    
Solaris

The init block now has the following added:

# 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() {
  "$@"
}

# dmidecode requires superuser privileges to read data from the system BIOS
# on Solaris X86 platforms only
PRIV_DMIDECODE() {
    "$@"
}

# ifconfig requires superuser privileges to display the MAC address of each
# interface
PRIV_IFCONFIG() {
  "$@"
}

# ndd requires superuser privileges to display any interface speed
# and negotiation settings
PRIV_NDD() {
  "$@"
}

# /usr/ucb/ps requires superuser privileges to display full command line 
# information (without this, command lines will be limited to 80 characters).
# This affects Solaris 10 and Solaris 8 & 9 with certain patches
PRIV_PS() {
  "$@"
}
# lputil requires superuser privileges to display any HBA information
PRIV_LPUTIL() {
  "$@"
}

# hbacmd requires superuser privileges to display any HBA information
PRIV_HBACMD() {
  "$@"
}

# pfiles requires superuser privileges to display open port information 
# for processes not running as the current user
PRIV_PFILES() {
  "$@"
}


The following individual commands have been modified to use this:

  • LSOF
    if [ `uname -r | cut -d. -f2` -lt 7 ]; then
        PRIV_LSOF lsof -l -n -P -F ptPTn -C -i 2>/dev/null
    else
        PRIV_LSOF lsof -l -n -P -F ptPTn -i 2>/dev/null
    fi
    
  • DMIDECODE
    if [ -x /usr/sbin/dmidecode ]; then
        PRIV_DMIDECODE /usr/sbin/dmidecode 2>/dev/null | nawk '/DMI type 1,/,/^Handle 0x0*[2-9]+0*/ {
    	if( $1 ~ /Manufacturer:/ ) { sub(".*Manufacturer: *","");  printf( "vendor: %s\n", $0 ); }
    	if( $1 ~ /Product/ && $2 ~ /Name:/ ) { sub(".*Product Name: *",""); printf( "model: %s\n", $0 ); }
    	if( $1 ~ /Serial/ && $2 ~ /Number:/ ) { sub(".*Serial Number: *",""); printf( "serial: %s\n", $0 ); }
        }'
    fi
    
  • IFCONFIG
    IFCONFIG=`PRIV_IFCONFIG ifconfig -a 2>/dev/null`
    
  • NDD
    echo ndd:
    vars_hme="link_speed link_mode adv_autoneg_cap"
    vars_eri="adv_autoneg_cap"
    vars_bge="adv_autoneg_cap link_duplex link_speed"
    vars_dmfe="link_speed link_mode adv_autoneg_cap"
    vars_qfe="link_mode adv_autoneg_cap"
    vars_ge="link_mode adv_1000autoneg_cap"
    vars_ce="adv_autoneg_cap"
    vars_fjqe="link_mode link_speed adv_autoneg_cap"
    vars_fjgi="link_mode link_speed adv_autoneg_cap"
    for iface in $LISTOFSETTYPES
    do
        eval initial_$iface=`PRIV_NDD $NDD -get /dev/$iface instance 2>/dev/null`
    done
    for NIC in $PHYSICALNICS
    do
        NIC_TYPE=`echo $NIC | sed 's/[0-9]*//g'`
        NIC_NUMBER=`echo $NIC | sed 's/[a-z]*//'`
        eval vars=\$vars_$NIC_TYPE
        case $NIC_TYPE in
            ge | hme | ce | qfe | eri | fjqe | fjgi) # interfaces that need the -set option:
                PRIV_NDD $NDD -set /dev/$NIC_TYPE instance $NIC_NUMBER 2>/dev/null
                instance=`PRIV_NDD $NDD -get /dev/$NIC_TYPE instance`
                if [ "$instance" != "$NIC_NUMBER" ]; then
                    echo "Skipping $NIC : ndd  -set failed"
                    continue
                fi
                for var in $vars
                do
                    echo 'NDD :' $NIC ':' $var ':' `PRIV_NDD $NDD -get /dev/$NIC_TYPE $var 2>/dev/null`
                done
            ;;
            bge | dmfe ) #interfaces that do not need -set:
                for var in $vars
                do
                    echo 'NDD :' $NIC ':' $var ':' `PRIV_NDD $NDD -get /dev/$NIC $var 2>/dev/null`
                done
            ;;
            dman ) # Known but ignored interfaces
            continue
            ;;
            *) # unknown interface
            echo unknown interface: $NIC_TYPE
            continue
            ;;
        esac
    done
    for iface in $LISTOFSETTYPES
    do
        eval instance=\$initial_$iface
        PRIV_NDD $NDD -set /dev/$iface instance $instance 2>/dev/null
    done
    echo "end ndd"
    
  • PS
    PRIV_PS /usr/ucb/ps -axww 2>/dev/null
    
  • LPUTIL
    echo begin lputil_listhbas
    echo 0 | PRIV_LPUTIL lputil listhbas 2>/dev/null
    echo end lputil_listhbas
    
    echo begin lputil_fwlist
    i=0
    max_count=`echo 0 | lputil count`
    if [ $? -eq 0 ]; then
        while [ $i -lt "$max_count" ]
        do 
            echo Board $i
            echo 0 | PRIV_LPUTIL lputil fwlist $i 2>/dev/null | grep "Functional Firmware" || echo "Functional Firmware: None"
            i=`expr $i + 1`
        done
    fi
    
  • HBACMD
    PRIV_HBACMD hbacmd ListHBAs 2>/dev/null
    echo end hbacmd_listhbas
    
    echo begin hbacmd_hbaattr
    for WWPN in `PRIV_HBACMD hbacmd ListHBAs | awk '/Port WWN/ {print $4;}'`
    do
        PRIV_HBACMD hbacmd HBAAttrib $WWPN 2>/dev/null
    done
    
  • PFILES - Disabled by default
    PRIV_PFILES pfiles /proc/* 2>/dev/null
    
TRU64

The init block now has the following added:

# 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() {
  "$@"
}


The following individual commands have been modified to use this

  • LSOF
    PRIV_LSOF lsof -l -n -P -F ptPTn -i 2>/dev/null
    
UNIXWARE

The init block now has the following added:

# 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() {
  "$@"
}


The following individual commands have been modified to use this

  • LSOF
    PRIV_LSOF lsof -l -n -P -F ptPTn -i 2>/dev/null
    

Enabling capture of command exit status

In 7.2 the ability to capture the exit status of commands has been re-introduced. See Viewing or Disabling the Scripts Used for more details.

All UNIX discovery scripts have had their init blocks extended in the same way.

AIX FreeBSD HPUX IRIX Linux MacOSX NetBSD OpenBSD Solaris TRU64 Unixware
stty kill ^U
# - some systems have the kill character set to @ - changed 
# it to something harmless

if [ -w /tmp ] 
then
    # use a /tmp file to capture stderr
    TW_CAPTURE_FILE=/tmp/tideway_status_$$
    export TW_CAPTURE_FILE
    rm -f $TW_CAPTURE_FILE

    tw_capture(){
        TW_NAME=$1
        shift
        echo begin cmd_status_err_$TW_NAME >>$TW_CAPTURE_FILE
        $@ 2>>$TW_CAPTURE_FILE
        RETURN_VAL=$?
        echo end cmd_status_err_$TW_NAME >>$TW_CAPTURE_FILE

        echo cmd_status_$TW_NAME=$RETURN_VAL >>$TW_CAPTURE_FILE
        return $RETURN_VAL
    }

    tw_report(){
        if [ -f $TW_CAPTURE_FILE ]
        then 
            cat $TW_CAPTURE_FILE 2>/dev/null
            rm -f $TW_CAPTURE_FILE 2>/dev/null
        fi
    }
else
    # can't write to /tmp - do not capture anything
    tw_capture(){
        shift
        $@ 2>/dev/null
    }

    tw_report(){
        echo "cmd_status_err_status_unavailable=Unable to write to /tmp"
    }
fi 

Bug 10096 - CPU speed units incorrectly capitalised.

7.1.7
cpuspeed="$cpuspeed Mhz"
7.2
cpuspeed="$cpuspeed MHz"

Improve parsing of AIX LPAR 6 hosts

7.1.7
  • netstat
    netstat -an -f inet -@ | grep Global
    
  • ps
    ps -eo pid,ppid,uid,user,wpar,args | grep Global | sed -e 's/Global //'
    
7.2
  • netstat
    netstat -an -f inet -@ 2>/dev/null | egrep "Global|Proto" | sed -e 's/Global //'
    
  • ps
    ps -eo pid,ppid,uid,user,wpar,args | egrep "Global|PID" | sed -e 's/Global //'
    

Bug 10395 - AIX process list truncation issue

7.1.7
if [ `uname -v` -ge 6 ]; then
    COLUMNS=2047 ps -eo pid,ppid,uid,user,wpar,args | grep Global | sed -e 's/Global //'
else
    COLUMNS=2047 ps -eo pid,ppid,uid,user,args
fi
7.2
if [ `uname -v` -ge 6 ]; then
    ps -eo pid,ppid,uid,user,wpar,args | egrep "Global|PID" | sed -e 's/Global //'
else
    # pipe through cat to remove tty columns limit
    ps -eo pid,ppid,uid,user,args | cat
fi

Bug 9920 - Discovery fails due to long line in disco script on some hosts

Reformatting of awk script that gets uptime. On some platforms the single long line was overflowing a buffer and causing it to fail.

7.1.7
uptime | awk '{ if ( $4 ~ /day/ ) { print "uptime:", $3; z = split($5,t,":"); printf( "uptimeSeconds: %d\n", ($3 * 86400) + (t[1] * 3600) + (t[2] * 60) ); } else { print "uptime: 0"; z = split($3,t,":"); print "uptimeSeconds:", (t[1] * 3600) + (t[2] * 60); } }'
7.2
uptime | awk '
{ 
  if ( $4 ~ /day/ ) { 
    print "uptime:", $3; 
    z = split($5,t,":"); 
    printf( "uptimeSeconds: %d\n", ($3 * 86400) + (t[1] * 3600) + (t[2] * 60) ); 
  } else { 
    print "uptime: 0"; 
    z = split($3,t,":"); 
    print "uptimeSeconds:", (t[1] * 3600) + (t[2] * 60); 
  }
}'

Bug 9967 - FreeBSD hosts can sometimes return a blank hostname

In this scenario we report the hostname to be localhost.

7.1.7
ihn=`hostname 2>/dev/null`
7.2
ihn=`hostname 2>/dev/null`
if [ "$ihn" = "" ]; then
    # Its possible for the host name to be blank on FreeBSD ...
    ihn=localhost
fi

Enhance HP-UX Platform Script to identify nPars.

7.1.7
hostid=`uname -i 2>/dev/null`
if [ "$hostid" = "" ]; then
    hostid=`getconf CS_MACHINE_IDENT 2>/dev/null`
fi
7.2
hostid=`getconf CS_MACHINE_IDENT 2>/dev/null`
partition_id=`getconf CS_PARTITION_IDENT 2>/dev/null`
if [ "$partition_id" != "" ]; then
    echo 'partition_id:' $partition_id
    if [ "$hostid" = "" ]; then
        hostid="$partition_id"
    fi
    if [ "$partition_id" != "$hostid" ]; then
        hostid="$hostid:$partition_id"
    fi

Multiple improvements to HPUX hardware discovery.

The following bugs were contained in this change block:

  • Bug 10762 - Enhance HP-UX Platforms Script to identify nPars
  • Bug 10942 - Issues capturing HP-UX cpu speed discovery.
  • Bug 11118 - HP-UX discovery on Itanium incomplete
  • Bug 11286 - Discovery fails with HP-UX 11.31 Itanium
7.1.7
KERNEL=/stand/vmunix   
MEMDEV=/dev/mem
if [ -r $MEMDEV ]; then
    if [ "$kernel_bits" -eq 64 ]; then
        ADB="adb64 -k"
    else
        ADB="adb -k"
    fi
    echo "begin hpux_chip_info:"
    cat <<EOF > /tmp/tw_chip_info.$$
cpu_revision_number/X
cpu_arch_is_2_0/D
cpu_arch_is_1_1/D
cpu_arch_is_1_0/D
cpu_is_a_PCXS/D
cpu_is_a_PCXT/D
cpu_is_a_PCXT_PRIME/D
cpu_is_a_PCXL/D
cpu_is_a_PCXL2/D
cpu_is_a_PCXU/D
cpu_is_a_PCXU_PLUS/D
cpu_is_a_PCXW/D
cpu_is_a_PCXW_PLUS/D
cpu_is_a_PIRANHA/D
cpu_is_a_MAKO/D
itick_per_usec/D
processor_count/D
EOF
    cat /tmp/tw_chip_info.$$ | $ADB $KERNEL $MEMDEV 2>/dev/null | egrep -v ':$'
    rm -f /tmp/tw_chip_info.$$
    echo "end hpux_chip_info"

    if [ "$OSVER" -ge 1100 ]; then
        PAGES=`echo phys_mem_pages/D | $ADB $KERNEL $MEMDEV 2>/dev/null | egrep -v '^phys_mem_pages:$' | cut -f2`
    else
        PAGES=`echo physmem/D | $ADB $KERNEL $MEMDEV 2>/dev/null | egrep -v '^physmem:$' | cut -f2`
    fi
    eval $(grep "define *PAGESIZE" /usr/include/limits.h | sed 's/# *define *//;s/ /=/;s/ *//g')
    if [ -z "$PAGESIZE" ]; then
        echo "__discovery_errors: HP-UX getDeviceInfo(): PAGESIZE not explicitly defined; assuming 4 MB"
        PAGESIZE=4096
    fi
    echo "ram:" `echo "scale=1; $PAGES * $PAGESIZE" | bc`
else
    echo "__discovery_errors: HP-UX getDeviceInfo(): could not read kernel memory"
    echo "begin hpux_cpu_info:"
    echo "cpu_count:" `ioscan -kC processor | grep processor | wc -l`
    echo "cpu_version:" `getconf CPU_VERSION`
    if [ "$OSVER" -ge 1100 ]; then
        typeset -i2 bin
        bin=`getconf CPU_CHIP_TYPE`
        typeset -i16 hex
        hex=2#`echo $bin | sed -e 's/2#//' -e 's/.....$//'`
        echo "cpu_chip_type:" `echo $hex | cut -c4-`
    else
        echo 'cpu_model:' `model 2>/dev/null`
    fi
    echo "end hpux_cpu_info"
    RAM=`echo "selclass qualifier memory;infolog" | cstm 2>/dev/null | grep 'System Total'`
    if [ "$RAM" != "" ]; then
        echo $RAM | sed -e 's/^.*(\(.*\))[^0-9]*\([0-9]*\).*$/ram: \2\1/'
    fi
    if [ "$RAM" = "" ]; then  #cstm not installed or do not have suitable credentials, try another method
        # first try to check the Ignite-UX manifest
        MANIFEST_PATH="/var/opt/ignite/local/manifest/manifest"
        if [ -r $MANIFEST_PATH ]; then
            RAM=`grep "Main Memory" $MANIFEST_PATH | cut -d: -f2 | sed 's/ //g'`
            if [ "$RAM" != "" ]; then
                echo "ram: $RAM"
            fi
        fi
    fi
    if [ "$RAM" = "" ]; then  #cannot read manifest or cannot extract RAM info, try to read syslog
        SYSLOG_PATH="/var/adm/syslog/syslog.log"
        if [ -r $SYSLOG_PATH ]; then
            RAM=`grep "Physical" $SYSLOG_PATH | sed 's/^.*Physical: *\([0-9]*\).*\([GMK]\)bytes.*$/\1\2B/'`
            if [ "$RAM" != "" ]; then
                echo "ram: $RAM"
            fi
        fi
    fi   
fi
7.2
# machinfo indicates Itanium based system
if [ -x /usr/contrib/bin/machinfo ]; then
    tpc=1 # Assume single thread per core

    MACHINFO=/tmp/tideway-machinfo-$$
    /usr/contrib/bin/machinfo > $MACHINFO
    nlp=`cat $MACHINFO | grep "Number of CPUs =" | cut -d= -f2 | tr -d '[:cntrl:]'`
    type=`cat $MACHINFO | grep "processor model:" | cut -d: -f2 | cut -c18- | tr -d '[:cntrl:]'`
    speed=`cat $MACHINFO | grep "Clock speed =" | cut -d= -f2 | tr -d '[:cntrl:]'`
    ram=`cat $MACHINFO | egrep "^Memory = " | cut -d= -f2 | awk '{print$1;}'`
    rm -f $MACHINFO

    # Work out cores per processor using series info
    cpp=1
    echo $type | grep "9000 series" 1>/dev/null 2>&1
    if [ $? -eq 0 ]; then
        # 9000 series, Montecito processor = dual core
        cpp=2
    fi
    echo $type | grep "9100 series" 1>/dev/null 2>&1
    if [ $? -eq 0 ]; then
        # 9100 series, Montvale processor = dual core
        cpp=2
    fi
    np=`expr $nlp / $cpp`

    echo num_logical_processors: $nlp
    echo num_processors: $np
    echo processor_type: $type $speed
    echo processor_speed: $speed
    echo cores_per_processor: $cpp
    echo threads_per_core: $tpc
    echo ram: $ram MB
else
    cores=0
    ram=0
    if [ -x /usr/sbin/parstatus ]; then
        par_id=`/usr/sbin/parstatus -w 2> /dev/null | sed 's/.*The local partition number is \([0-9]*\)\..*/\1/'`
        if [ "$par_id" ]; then
            echo par_id: $par_id
            par_status=`/usr/sbin/parstatus -C -M | grep "$par_id"\$`
            for i in `echo "$par_status" | sed 's/^[^:]*:[^:]*:[^:]*: *\([0-9]*\).*/\1/'`; do
                cores=$((cores + i))
            done
            for i in `echo "$par_status" | sed 's/^[^:]*:[^:]*:[^:]*:[^:]*: *\([0-9]*\).*/\1/'`; do
                ram=$((ram + i))
            done
            ram=`echo "$ram" '* 1048576 * 1024' | bc`
            echo ram: $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
        typeset -i2 bin
        bin=`getconf CPU_CHIP_TYPE`
        typeset -i16 hex
        hex=2#`echo $bin | sed -e 's/2#//' -e 's/.....$//'`
        chip_type=`echo $hex | cut -c4-`
    fi
    
    if [ "$chip_type" -eq 14 ]; 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
    else
        echo 'cpu_model:' `model 2>/dev/null`
    fi
    KERNEL=/stand/vmunix  
    MEMDEV=/dev/mem
    if [ -r $MEMDEV ]; then
        if [ "$kernel_bits" -eq 64 ]; then
            ADB="adb64 -k"
        else
            ADB="adb -k"
        fi
        echo itick_per_usec/D | $ADB $KERNEL $MEMDEV 2>/dev/null | egrep -v ':$'
    fi
    echo "end hpux_cpu_info"

    if [ $ram -eq 0 ]; then
        ram=`echo "selclass qualifier memory;infolog" | cstm 2>/dev/null | grep 'System Total'`
        if [ "$ram" != "" ]; then
            echo $ram | sed -e 's/^.*(\(.*\))[^0-9]*\([0-9]*\).*$/ram: \2\1/'
        fi
        if [ "$ram" = "" ]; then  #cstm not installed or do not have suitable credentials, try another method
            # first try to check the Ignite-UX manifest
            MANIFEST_PATH="/var/opt/ignite/local/manifest/manifest"
            if [ -r $MANIFEST_PATH ]; then
                ram=`grep "Main Memory" $MANIFEST_PATH | cut -d: -f2 | sed 's/ //g'`
                if [ "$ram" != "" ]; then
                    echo "ram: $ram"
                fi
            fi
        fi
        if [ "$ram" = "" ]; then  #cannot read manifest or cannot extract RAM info, try to read syslog
            SYSLOG_PATH="/var/adm/syslog/syslog.log"
            if [ -r $SYSLOG_PATH ]; then
                ram=`grep "Physical" $SYSLOG_PATH | sed 's/^.*Physical: *\([0-9]*\).*\([GMK]\)bytes.*$/\1\2B/'`
                if [ "$ram" != "" ]; then
                    echo "ram: $ram"
                fi
            fi
        fi   
    fi
fi

Improve HP-UX interface discovery on both Itanium and PA-RISC.

7.1.7
lanscan -ia | grep $interface | awk '{printf("Hardware Address: %s\n", $1);}'

7.2

lanscan -ia 2>/dev/null | awk "\$2==\"lan$interface\" {printf(\"Hardware Address: %s\\n\", \$1);}"

Implemented missing IRIX platform commands

Ifconfig, netstat, ps and showprods commands were not implemented in 7.1.7 and have been added.

ifconfig
echo --- START ifconfig
ifconfig -av
echo 'begin netstat-ian:'
netstat -ian
echo 'end netstat-ian:'
echo --- END ifconfig
netstat
echo --- START netstat
netstat -an -f inet 2>/dev/null
echo --- END netstat
ps
echo --- START ps
ps -eo pid,ppid,uid,user,args 2>/dev/null
echo --- END ps
showprods
echo --- START showprods
showprods -M -1
echo --- END showprods

Bug 10975 - IRIX path should include /usr/bsd and /usr/etc

7.1.7
PATH=/bin:/usr/bin:/sbin:/usr/sbin
7.2
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/etc:/usr/bsd

IRIX OS discovery improvement

7.1.7
echo 'os:' `uname -sr`
7.2
echo 'os:' `uname -s 2>/dev/null` `uname -R | awk '{print $2;}'`

Bug 8166 - hostid not reported on IRIX

This bug fix extended to include discovering more than just hostid, greatly improving hardware information on IRIX.

7.1.7
Not implemented
7.2
echo vendor: `sysconf | egrep '^VENDOR' | sed -e 's/VENDOR//' `
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 -1 | sed -e 's/^CPU/processor_type/'
echo processor_speed: `hinv -c processor | head -1 | awk '{print $2;}'`
echo cores_per_processor: 1
echo threads_per_core: 1

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

Linux hostname, two bug-fixes

  • Bug 10045 - Somtimes full fqdn returned as hostname
  • bug 11047 - Hostname can somtimes be reported as 'localhost'
7.1.7
ihn=`hostname 2>/dev/null`
7.2
ihn=`hostname --short 2>/dev/null`
if [ $? -ne 0 -o "$ihn" = "localhost" ]; then
    ihn=`hostname 2>/dev/null`
fi

Improving discovery of SuSe and Ubuntu Linux

7.1.7
if [ "$os" = "" -a -f /etc/debian_version ]; then
    ver=`cat /etc/debian_version`
    os="Debian Linux $ver"
fi
if [ "$os" = "" -a -f /etc/SuSE-release ]; then
    os=`cat /etc/SuSE-release | head -1`
fi
7.2
if [ "$os" = "" -a -f /etc/SuSE-release ]; then
    os=`head -1 /etc/SuSE-release`
fi
if [ "$os" = "" -a -f /etc/lsb-release ]; then
    ostype=`grep DISTRIB_ID /etc/lsb-release | cut -f2 -d=`
    osver=`grep DISTRIB_RELEASE /etc/lsb-release | cut -f2 -d=`
    os="$ostype $osver"
fi
if [ "$os" = "" -a -f /etc/debian_version ]; then
    ver=`cat /etc/debian_version`
    os="Debian Linux $ver"
fi

Linux on POWER, fixes to cpu speed discovery

7.1.7
if [ "$procarch" = "ppc64" ]; then
    # POWER6 is dual core
    cores=2
    physical=`expr $logical / $cores`
    cputype=`egrep '^cpu' /proc/cpuinfo | sort -u | head -1 | awk '{print $3;}' | sed -e 's/,//'`
7.2
if [ "$procarch" = "ppc64" ]; then
    # POWER6 is dual core
    cores=2
    physical=`expr $logical / $cores`
    cpuspeed=`egrep '^clock' /proc/cpuinfo | sort -u | head -1 | awk '{print $3;}' | sed -e 's/\.[0-9]*//'`
    cputype=`egrep '^cpu' /proc/cpuinfo | sort -u | head -1 | awk '{print $3;}' | sed -e 's/,//'`
    cputype="PowerPC $cputype $cpuspeed"

Bug 9346 - Xen Server installation report incorrect Memory and CPU Info

7.1.7
Not implemented.
7.2
if [ -f /opt/xensource/bin/xe ]; then
    print=0
    if [ -x /opt/xensource/bin/xe ]; then
        # /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=""
        threads_per_core=""
        physical=""
        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 -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 -1 | cut -f2 -d: | awk '{print $1;}'`
            ram=`PRIV_XE $XE host-param-get uuid=$uuid param-name=memory-total`
            print=1
        fi
    fi
fi

Bug 4819 - Linux NIC Discovery script does not counter for ethtool failing but mii-tool suceeding.

7.1.7
if [ "$ETHTOOL" != "" ]; then
    echo 'begin ethtool:'
    for i in `ifconfig -a 2>/dev/null | egrep '^[a-z]' | awk '{print $1;}'`
    do
        echo Begin-interface: $i
        PRIV_ETHTOOL $ETHTOOL $i 2>/dev/null
        echo End-interface: $i
    done
    echo 'end ethtool:'
else
    if [ "$MIITOOL" != "" ]; then
        echo 'begin mii-tool:'
        for i in `ifconfig -a | egrep '^[a-z]' | awk '{print $1;}'`
        do
            echo Begin-interface: $i
        PRIV_MIITOOL $MIITOOL -v $i 2>/dev/null
            echo End-interface: $i
        done
        echo 'end mii-tool:'
    fi
7.2
if [ "$ETHTOOL" != "" ]; then
    echo 'begin ethtool:'
    for i in `ifconfig -a 2>/dev/null | egrep '^[a-z]' | awk '{print $1;}'`
    do
        echo Begin-interface: $i
        PRIV_ETHTOOL $ETHTOOL $i 2>/dev/null
        echo End-interface: $i
    done
    echo 'end ethtool:'
fi
if [ "$MIITOOL" != "" ]; then
    echo 'begin mii-tool:'
    for i in `ifconfig -a | egrep '^[a-z]' | awk '{print $1;}'`
    do
        echo Begin-interface: $i
        PRIV_MIITOOL $MIITOOL -v $i 2>/dev/null
        echo End-interface: $i
    done
    echo 'end mii-tool:'
fi

Bug 10759 - Linux discovery script 'ps' output limited to 4096 chars

7.1.7

ps -eo pid,ppid,uid,user,cmd --no-headers --cols 4096
7.2
ps -eo pid,ppid,uid,user,cmd --no-headers -ww 2>/dev/null

Bug 10730 - Mac OS X ps command breaks on Leopard due to use of g flag

7.1.7
ps -agxwww -o pid,ppid,uid,logname,command
7.2
ps -axwww -o pid,ppid,uid,logname,command 2>/dev/null

Bug 10222 - Duplicated processor string in Solaris

7.1.7
cpucount=`grep -c "cpu, instance" /tmp/tideway.$$`
if [ $cpucount -gt 0 ]; then
echo "num_processors:" ${cpucount}
cputype=`awk 'BEGIN { s=0 } /brand-string/ { s=1 } /value=/ { if (s) { s=0; print $0 } }' /tmp/tideway.$$ | sed -e "s/value='//" -e "s/'\$//"`
echo "processor_type:" ${cputype}
fi
7.2
if [ $cpucount -gt 0 ]; then
	cputype=`awk 'BEGIN { s=0 } /brand-string/ { s=1 } /value=/ { if (s) { print $0; exit } }' /tmp/tideway.$$ | sed -e "s/value='//" -e "s/'\$//"`
fi

Various changes to cpu discovery on Solaris

  • Bug 10055 - prtdiag should only be run in global zone
  • Bug 9335 - Solaris Processor Information is incorrectly reported.
  • Bug 10811 - Solaris processor counts are wrongly reported
7.1.7
    # Solaris SPARC
    if [ -x /usr/platform/`uname -m`/sbin/prtdiag ]; then
        platdir=/usr/platform/`uname -m`/sbin
    else
        platdir=/usr/platform/`uname -i`/sbin
    fi
    if [ -x $platdir/prtdiag ]; then
        echo 'begin prtdiag:'
        $platdir/prtdiag -v
        echo 'end prtdiag'
    fi
7.2
    # Solaris SPARC - use prtdiag if possible
    run_prtdiag=1
    if [ -x /usr/bin/zonename ]; then
        # Solaris 10 or later, check this is the global zone before attempting
        # to run prtdiag
        if [ `/usr/bin/zonename 2>/dev/null` != "global" ]; then
            # Non global zone, don't run prtdaig
            run_prtdiag=0
        fi
    fi
    if [ $run_prtdiag -eq 1 ]; then
        if [ -x /usr/platform/`uname -m`/sbin/prtdiag ]; then
            platdir=/usr/platform/`uname -m`/sbin
        else
            platdir=/usr/platform/`uname -i`/sbin
        fi
        if [ -x $platdir/prtdiag ]; then
            echo 'begin prtdiag:'
            $platdir/prtdiag -v 2>/dev/null
            echo 'end prtdiag'
        fi
    fi
    if [ -x $platdir/eeprom ]; then
        serial=`$platdir/eeprom 2>/dev/null | grep system-board-serial | cut -f2 -d= | grep -v 'data not available'`
        if [ "$serial" != "" ]; then
            echo "serial: $serial"
        fi
    fi
fi

physical=`/usr/sbin/psrinfo -p 2>/dev/null`
if [ "$physical" = "" ]; then
    physical=`kstat cpu_info | grep chip_id | sort | uniq | wc -l`
    if [ $physical -eq 0 ]; then
        physical=1
    fi
fi
logical=`/usr/sbin/psrinfo -v 2>/dev/null | grep -i virtual | wc -l`
if [ $logical -eq 0 ]; then
    logical=$physical
fi
cores_pp=`kstat -p -m cpu_info -s '/(chip|core)_id/' | awk '{cpu=$2; getline; core=$2; print cpu, core}' | sort | uniq | cut -f1 -d\  | sort | uniq -c | awk '{print $1}' | sort | tail -1`
cores=`kstat cpu_info 2>/dev/null | grep core_id | sort | uniq | wc -l`
if [ "$cores" -eq 0 ]; then
    cores=$physical
    cores_pp=1
fi
speed=`kstat cpu_info 2>/dev/null | grep clock_MHz | sort | uniq | awk '{print $2;}'`
if [ "$cputype" = "" ]; then
    cputype=`kstat cpu_info | grep implementation | sort | uniq | awk '{print $2;}' | head -1`
    cputype="$cputype ${speed}MHz"
fi

echo 'processor_type:' $cputype 
echo 'processor_speed:' $speed
echo 'num_processors:' $physical
echo 'num_logical_processors:' $logical
echo 'cores:' $cores
echo 'cores_per_processor:' $cores_pp
echo 'threads_per_core:' `expr $logical / $cores`

Pfiles command removed (Solaris)

It is still possible to call pfiles from patterns if required

7.1.7
pfiles /proc/*
7.2
Removed

Unixware discovery updated and extended

Several enhancements to unixware discovery have been made including adding netstat, lsof and pkginfo commands

7.1.7
  • Hostinfo
    echo 'kernel:' `uname -v`
    
  • netstat
    Not implemented.
    
  • lsof
    Not implemented.
    
  • pkginfo
    Not implemented.
    
7.2
  • Hostinfo
    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`
    
  • netstat
    netstat -an -f inet
    
  • lsof
    PRIV_LSOF lsof -l -n -P -F ptPTn -i 2>/dev/null
    
  • pkginfo
    pkginfo -l 2>/dev/null
    

Discovery Command Changes from 7.1.6 to 7.1.7

There have been no discovery command changes in this release.

Discovery Command Changes from 7.1.5 to 7.1.6

There have been no discovery command changes in this release.

Discovery Command Changes from 7.1.1 to 7.1.5

There have been no discovery command changes in this release though it should be noted that an additional echo statement is used which creates the new processor_speed attribute. The information was discovered in previous versions but was not used.

Discovery Command Changes from 7.1 to 7.1.1

There have been no discovery command changes in this release.

Discovery Command Changes from 7.0.2 to 7.1

The following sections show the discovery command changes from Tideway Foundation version 7.0.2 to version 7.1.

New INIT Commands in Tideway Foundation Version 7.1

The table below lists the new INIT commands for each platform.

AIX FreeBSD HP-UX IRIX Linux NetBSD OpenBSD Solaris Tru64 and Unixware
tw_locale=`locale -a | grep -i en_us | grep -i "utf.*8" |
head -n 1 2>/dev/null`
LANGUAGE=""
if [ "$tw_locale" != "" ]; then
  LANG=$tw_locale
  LC_ALL=$tw_locale
else
  LANG=C
  LC_ALL=C
fi
export LANG LC_ALL
Apple
export LC_ALL=C
tw_locale=`locale -a | grep -i en_us | grep -i "utf.*8" | 
head -n 1 2>/dev/null`
LANGUAGE=""
if [ "$tw_locale" != "" ]; then
  LANG=$tw_locale
  LC_MESSAGES=$tw_locale
else
  LANG=C
  LC_MESSAGES=C
fi
export LANG LC_MESSAGES

New LPAR commands added to AIX and Linux

The command changes here are complex, so changed portions of new versions are shown rather then individual changes. The command changes are shown in the table below.

AIX Netstat
if [ `uname -v` -ge 6 ]; then
    if [ `uname -W` -eq 0 ]; then
        netstat -an -f inet -@ | grep Global
    else
        netstat -an -f inet
    fi
else
    netstat -an -f inet 
fi
AIX Ifconfig
wparaddrs=""
if [ `uname -v` -ge 6 ]; then

    wparaddrs=`lswpar -Nqa address 2>/dev/null | xargs echo | sed -e 's/\./\\./g
' -e 's/ /|/g'`
fi
if [ "$wparaddrs" = "" ]; then
    ifconfig -a 2>/dev/null
else
    ifconfig -a 2>/dev/null | egrep -v "$wparaddrs"
fi
echo 'begin lparstat:'
lparstat -i
echo 'end lparstat'
wparid=0
if [ `uname -v` -ge 6 ]; then
    # AIX 6 WPAR support
    wparid=`uname -W`
    echo "wparid: $wparid" 
    if [ $wparid -eq 0 -a -x /usr/sbin/lswpar ]; then
        echo 'begin lswpar:'
        /usr/sbin/lswpar -cqa name,state,type,hostname,directory,key,owner,application
        echo 'end lswpar'
    fi
fi
if [ -x /usr/sbin/prtconf ]; then
    /usr/sbin/prtconf > /tmp/tideway.$$ 2>/dev/null
    echo 'model:' `egrep '^System Model:' /tmp/tideway.$$ | cut -f2 -d:`
    echo 'kernel:' `egrep '^Kernel Type:' /tmp/tideway.$$ | cut -f2 -d:`
    if [ $wparid -eq 0 ]; then
        echo 'serial:' `egrep '^Machine Serial Number:' /tmp/tideway.$$ | cut -f2 -d:`
        cpucount=`egrep '^Number Of Processors:' /tmp/tideway.$$ | cut -f2 -d:`
        cputype=`egrep '^Processor Type:' /tmp/tideway.$$ | cut -f2 -d: | sed -e 's/_/ /'`
        cpuspeed=`egrep '^Processor Clock Speed:' /tmp/tideway.$$ | cut -f2 -d:`
    fi
    rm -f /tmp/tideway.$$
AIX hostinfo
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 "serial: " $2;}'
    cpucount=`lscfg -lproc\* | wc -l`
    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

if [ $wparid -eq 0 ]; then
    # Get SMT information
    smt_enabled=`lsattr -E -l proc0 -a smt_enabled 2>/dev/null | awk '{print $2;}'`
    if [ "$smt_enabled" = "true" ]; then
        # SMT is enabled, get threads per core
        threads_per_core=`lsattr -E -l proc0 -a smt_threads 2>/dev/null | awk '{print $2;}'`
    else
        # SMT not enabled, one thread per core then
        threads_per_core=1
    fi

    # POWER4 and POWER5 chips are actually dual core but this is not exposed
    # to the OS (it simple sees a single physical CPU). In terms of reporting
    # the number of logical processors, we can ignore this value ...
    cores_per_processor=1

    lpppp=`expr $cores_per_processor \* $threads_per_core`
    echo "num_logical_processors:" `expr $cpucount \* $lpppp`
    echo "threads_per_core:" $threads_per_core
    echo "cores_per_processor:" $cores_per_processor
    echo "num_processors:" $cpucount
    echo "processor_type:" $cputype $cpuspeed
fi

lsattr -E -l sys0 -a realmem 2>/dev/null | awk '{print "ram: " $2 "KB";}'
if [ -x /usr/sbin/hostid ]; then
    echo 'hostid:' `/usr/sbin/hostid`
fi
echo 'systemid:' `uname -F`
Linux device info
if [ -f /proc/ppc64/lparcfg ]; then
    sed -e 's/=/: /' /proc/ppc64/lparcfg | egrep '^[a-z]' | sed -e 's/^serial_number/serial/' 
           -e 's/^system_type/model/' -e 's/partition_id/lpar_id/'
           -e 's/^group/lpar_partition_group_id/' -e 's///'
fi

New PS command on AIX

The PS command on AIX has been changed to support AIX version 6. The command changes are shown in the table below.

7.0.2
COLUMNS=2047 ps -eo pid,ppid,uid,user,args
7.1
if [ `uname -v` -ge 6 ]; then
  COLUMNS=2047 ps -eo pid,ppid,uid,user,wpar,args | 
        grep Global | sed -e 's/Global //'
else
  COLUMNS=2047 ps -eo pid,ppid,uid,user,args
fi

Bug 8380 - HP-UX Truncates Process List

The PS command on HP-UX has been changed to fix bug 8380. The command changes are shown in the table below.

7.0.2
env UNIX95=1 ps -eo pid,ppid,uid,user,args
7.1
if [ `uname -r | cut -d. -f2` -eq 11 ]; then
  if [ `uname -r | cut -d. -f3` -ge 11 ]; then
    PS_X_OPT=x
  fi
fi
env UNIX95=1 ps -e${PS_X_OPT}o pid,ppid,uid,user,args

Bug 8571 – MAC Address Not Captured on AIX

The command to capture MAC addresses on AIX has been changed to fix bug 8571. The command changes are shown in the table below.

7.0.2
entstat -d ${adapter} | grep "Media Speed" 2>/dev/null
7.1
entstat -d ${adapter} | egrep "(Media Speed)|(Hardware Address)" 2>/dev/null

Bug 8573 - MAC Address Not Captured on HP-UX

The command to capture MAC addresses on HP-UX has been changed to fix bug 8571. The command changes are shown in the table below.

7.0.2

No command

7.1
lanscan -ia | grep $interface | awk '{printf("Hardware Address: %s\\n", $1);}'

Bug 8576 - FreeBSD, OpenBSD, NetBSD in VM Cannnot be Linked - no serial number

The command to capture VM serial numbers has been changed to fix bug 8576. The command changes are shown in the table below.

7.0.2

No command

7.1
if [-x /usr/sbin/dmidecode]; then
  /usr/sbin/dmidecode 2>/dev/null | 
             awk '/DMI type 1,/,/^Handle 0x0*[2-9]+0*/ {
if( $1 ~ /Manufacturer:/ ) 
         { sub(".*Manufacturer: *","");  
                      printf( "vendor: %s\n", $0 ); }
    if( $1 ~ /Product/ && $2 ~ /Name:/ ) 
         { sub(".*Product Name: *",""); 

                      printf( "model: %s\n", $0 ); }
    if( $1 ~ /Serial/ && $2 ~ /Number:/ ) 
          { sub(".*Serial Number: *",""); 
                      printf( "serial: %s\n", $0 ); }
  }'
fi

Bug 8728 - A Virtual Machine which hosts other Virtual Machines is not listed as a Virtual Machine

The command to identify Virtual Machines which host other Virtual Machines is not listed as a Virtual Machine. The command changes are shown in the table below.

7.0.2
if [ -x /usr/sbin/smbios ]; then
  /usr/sbin/smbios -i 1 2>/dev/null | nawk '{
    if( $1 ~ /Manufacturer:/ ) { sub(".*Manufacturer:
         *","");  printf( "vendor: %s\n", $0 ); }
if( $1 ~ /Product:/ ) { sub(".*Product: *",""); 
     printf( "model: %s\n", $0 ); }


if( $1 ~ /Serial/ && $2 ~ /Number:/ ) { sub(".*Serial Number: *",""); printf( "serial: %s\n", $0 ); }
  }'
fi
7.1
if [ -x /usr/sbin/smbios ]; then
  /usr/sbin/smbios -i 1 2>/dev/null | nawk '{
    if( $1 ~ /Manufacturer:/ ) { sub(".*Manufacturer: *","");  printf( "vendor: %s\n", $0 ); }
    if( $1 ~ /Product:/ ) { sub(".*Product: *",""); printf( "model: %s\n", $0 ); }
    if( $1 ~ /Serial/ && $2 ~ /Number:/ ) { sub(".*Serial Number: *",""); printf( "serial: %s\n", $0 ); }
}'
else
  if [ -x /usr/sbin/dmidecode ]; then
     /usr/sbin/dmidecode 2>/dev/null | nawk '/DMI type 1,/,/^Handle 0x0*[2-9]+0*/ {
    if( $1 ~ /Manufacturer:/ ) { sub(".*Manufacturer:            *","");  printf( "vendor: %s\n", $0 ); }
    if( $1 ~ /Product/ && $2 ~ /Name:/ ) { sub(".*Product            Name: *",""); printf( "model: %s\n", $0 ); }
    if( $1 ~ /Serial/ && $2 ~ /Number:/ ) { sub(".*Serial
           Number: *",""); printf( "serial: %s\n", $0 ); }
    }'
  fi
fi

Bug 8375 - Two Host Attributes Always Set to Same Value

Two host attributes have always been set to the same value. This has been fixed to address bug 8375. The command changes are shown in the table below.

7.0.2
series=`uname -m | cut -d/ -f2 | cut -c1`
if [ "$series" = 7 ]; then
    echo "host_type: Unix Workstation"
elif [ "$series" = 8 ]; then
    echo "host_type: Unix Server"
fi
7.1
echo 'series:' `uname -m | cut -d/ -f2 | cut -c1`

Bug 7637 - Discovery Should Return the Architecture of Packages

Discovery should always return the architecture of packages. This has been fixed to address bug 7637. The command changes are shown in the table below.

7.0.2

No command.

7.1
rpm -qa --queryformat 'begin\nname: %{NAME}\nversion: %{VERSION}\nrelease: 
     %{RELEASE}\narch: %{ARCH}\ninstall_time: %{INSTALLTIME}\nend\n' 2>/dev/null

Improved core detection and ESX memory reporting

Core detection and memory reporting has been improved on VMware ESX platforms. The command changes are shown in the table below.

7.0.2
# Count cores if possible
cores=`egrep '^core id' /proc/cpuinfo | sort -u | wc -l`
if [ $cores -eq 0 ]; then
   # Cores not reported, assume one per processor
    cores=1
[...........]
physical=`egrep '^(physical id)|(Physical processor ID)' /proc/cpuinfo | sort -u | wc -l`
if [ $physical -eq 0 ]; then
    # Could not determine number of physical CPUs so we fail back on the
    # number of logical CPUs divided by the number of cores
    physical=`expr ${logical} / ${cores}`
fi
[..............]
cputype=`egrep '^(model name)|^(family)' /proc/cpuinfo | cut -f2 -d: | sed -e 's/^ //' | sort -u`
if [ "$cputype" = "" ]; then
    cputype="Unknown"
7.1
# Handle the output of /proc/cpuinfo based on processor architecture
if [ `uname -p` = ppc64 ]; then
    # POWER6 is dual core
    cores=2
    physical=`expr $logical / $cores`
    cputype=`egrep '^cpu' /proc/cpuinfo | sort -u | head -1 | awk '{print $3;}' | sed -e 's/,//'`
else
    # Assume x86 based processor
# Use "cpu cores" if possible
    cores=`egrep '^cpu cores' /proc/cpuinfo | head -1 | awk '{print $4}' | tr -d '[:space:]'`
    if [ -z $cores ]; then
     # Count "core id" if possible
     cores=`egrep '^core id' /proc/cpuinfo | sort -u | wc -l`
        if [ $cores -eq 0 ]; then
            # Cores not reported, assume one per processor
            cores=1
        fi
    fi
# Check if the number of physical CPUs can be determined

    physical=`egrep '^(physical id)|(Physical processor ID)' /proc/cpuinfo | sort -u | wc -l`
    if [ $physical -eq 0 ]; then
     # Could not determine number of physical CPUs so we fail
     # back on the number of logical CPUs divided by the number of cores
        physical=`expr ${logical} / ${cores}`
    fi
cputype=`egrep '^(model name)|^(family)' /proc/cpuinfo | cut -f2 -d: | sed -e 's/^ //' | sort -u`
fi
[..........]
# Did we determine the processor type?
if [ "$cputype" = "" ]; then
    cputype="Unknown"
[............]
threads_per_core=`expr ${lpppp} / ${cores}`
cpuspeed=""
ram=`awk '/^MemTotal:/ {print $2 "KB"}' /proc/meminfo 2>/dev/null`
[.............]
print=1
if [ -f /usr/sbin/esxcfg-info ]; then
    if [ -x /usr/sbin/esxcfg-info ]; then
	 # On a VMWare ESX controller, report the *real* hardware information
        file=/tmp/tideway-hw-$$
        /usr/sbin/esxcfg-info > ${file}
        physical=`grep "Num Packages." ${file} | sed -e "s/[Changes to Discovery Commands^0-9]//g"`
        logical=`grep "Num Cores." ${file} | sed -e "s/[Changes to Discovery Commands^0-9]//g"`
        cores=`expr ${logical} / ${physical}`
        total_threads=`grep "Num Threads." ${file} | sed -e "s/[Changes to Discovery Commands^0-9]//g"`
        threads_per_core=`expr ${total_threads} / ${logical}`
        cpuspeed=`egrep "[cC]puSpeed\." ${file} | head -n 1 | sed 's/[Changes to Discovery Commands^0-9]*//g' | awk '{printf( " @ %.1f GHz\n", $1/1024**3)}'`
        cputype=`echo ${cputype} | sed 's/ @.*$//'`
        ram=`grep "Physical Mem." ${file} | sed 's/[Changes to Discovery Commands^0-9]*//g'`B
        rm -f ${file}
    else
        print=0
    fi
fi

Bug 8687 - UNIX HBA Command Script Contains a Syntax Error if Commands are not Installed

UNIX HBA command script contains a syntax error if the HBA commands are not installed. The command changes are shown in the table below.

7.0.2
while [ $i -lt "$max_count" ]
do 
    echo Board $i
    echo 0 | lputil fwlist $i | grep "Functional Firmware" || echo "Functional Firmware: None"
    i=`expr $i + 1`
done
7.1
if [ $? -eq 0 ]; then
    while [ $i -lt "$max_count" ]
    do 
        echo Board $i
        echo 0 | lputil fwlist $i | grep "Functional Firmware" || echo "Functional Firmware: None"
        i=`expr $i + 1`
    done
fi

Discovery Command Changes from 7.0.1 to 7.0.2

New Discovery Platform in 7.0.2 - UnixWare

UnixWare is a new discovery platform and all of the discovery commands used are shown below.

getDeviceInfo
echo 'hostname:' `uname -n`
if [ -f /etc/resolv.conf ]; then
  echo 'dns_domain:' `awk '/^(domain|search)/ { print $2; exit }'   /etc/resolv.conf2>/dev/null`
fi
echo 'os:' `uname -sr`
getFileInfo	if [ -f %(path)s ]; then
  echo "ls:" `ls -lTd %(path)s`
  echo "begin content:"
  sed -e 's/[[:cntrl:]]//g' %(path)s
else
   echo "FILE NOT FOUND"
fi
getHostInfo
echo 'kernel:' `uname -v`
echo 'begin df:'
df -k 2>/dev/null 
echo 'end df'
getInterfaceList
ifconfig -a 2>/dev/null
getProcessList	ps -A -l -o pid,ppid,user,comm
/usr/ucb/ps -axww

Retrieve patch information on HP-UX 10.20 (defect 8366)

7.0.1
swlist -l patch 2>/dev/null | egrep -v '^#' | grep applied | awk '{print $1, $2;}'
7.0.2
swlist -l product 2>/dev/null | egrep -v '^#' | egrep 'PH[A-Z]{2}_[0-9]+' | awk '{print $1, $2;}'

Retrieve package information on HP-UX 10.20 (defect 8366)

7.0.1
swlist -l product 2>/dev/null | egrep -v '^#'
7.0.2
swlist -l product 2>/dev/null | egrep -v '^#|PH[A-Z]{2}_[0-9]+'

Add support for emlxadm utility for discovering Emulex HBA cards on Linux and Solaris platforms.

7.0.1
PATH=/usr/sbin/hbanyware:/usr/sbin/lpfc:/usr/sbin/lpfs:$PATH
[...]
7.0.2
PATH=/usr/sbin/hbanyware:/usr/sbin/lpfc:/usr/sbin/lpfs:/opt/EMLXemlxu/bin:$PATH
[...]
echo begin emlxadm_get_port_attrs
emlxadm devctl -y get_port_attrs wwn
echo end emlxadm_get_port_attrs

echo begin emlxadm_get_fw_rev
emlxadm devctl -y get_fw_rev
echo end emlxadm_get_fw_rev

Discovery Command Changes from 7.0 to 7.0.1

The tables below show the discovery command changes from Tideway Foundation version 7.0 to Tideway Foundation version 7.0.1.

Add SMT processor detection to AIX (defect 8057)

7.0
lsattr -E -l sys0 -a modelname 2>/dev/null | awk '{print "model: " $2 "KB";}'
7.0.1
lsattr -E -l sys0 -a modelname 2>/dev/null | awk '{print "model: " $2;}'
lsattr -E -l sys0 -a systemid 2>/dev/null | awk '{print "serial: " $2;}'
[...]
# Get SMT information
smt_enabled=`lsattr -E -l proc0 -a smt_enabled 2>/dev/null | awk '{print $2;}'`
if [ "$smt_enabled" = "true" ]; then
    # SMT is enabled, get threads per core
    threads_per_core=`lsattr -E -l proc0 -a smt_threads 2>/dev/null | awk '{print $2;}'`
else
    # SMT not enabled, one thread per core then
    threads_per_core=1
fi
# POWER4 and POWER5 chips are actually dual core but this is not exposed
# to the OS (it simple sees a single physical CPU). In terms of reporting
# the number of logical processors, we can ignore this value ...
cores_per_processor=1
lpppp=`expr $cores_per_processor \* $threads_per_core`
echo "num_logical_processors:" `expr $cpucount \* $lpppp`
echo "threads_per_core:" $threads_per_core
echo "cores_per_processor:" $cores_per_processor

Remove Processor attribute (defect 8074)

The following lines were removed from discovery commands in version 7.0.1:

AIX
echo "processor:" $cpucount '*' $cputype $cpuspeed
MacOSX
echo "processor: $cpucount * $cputype $cpuspeed"
Linux
echo 'processor:' ${physical} '*' ${cputype}
Solaris
echo 'processor:' `uname -p`
echo "processor:" ${cpucount} '*' ${cputype}
Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.