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.3 to 20.02 (12.0)
Click here to show the discovery command changes from 11.3 to 20.02 (12.0)
VMware ESX
getHBAList
The following code:
echo begin sysfs_hba:
if [ ! -d /sys/class ]; then
echo /sys/class does not exist
elif [ -r /proc/vmware/version ] &&
[ `grep -o -m1 ESX /proc/vmware/version` ] ||
[ -r /etc/vmware-release ] &&
[ `grep -o ESX /etc/vmware-release` ]; then
echo ESX HBA drivers do not support sysfs
else
for device in `ls /sys/class/fc_host 2>/dev/null`
do
systool -c fc_host -v $device
systool -c scsi_host -v $device
done
fi
echo end sysfs_hba:
is replaced with:
if [ ! -d /sys/class ]; then
echo ERROR: Linux kernel does not support sysfs
elif [ -r /proc/vmware/version ] &&
[ `grep -o -m1 ESX /proc/vmware/version` ] ||
[ -r /etc/vmware-release ] &&
[ `grep -o ESX /etc/vmware-release` ]; then
echo ERROR: ESX HBA drivers do not support sysfs
elif [ -d /sys/class/fc_host ]; then
for device in `ls /sys/class/fc_host 2>/dev/null`
do
if [ -x /usr/bin/systool ]; then
systool -c fc_host -v $device
systool -c scsi_host -v $device
else
# systool not present? We will have to,
# find information from /sys/class/fc_host and /sys/class/scsi_host
# similar to systool.
# some files are ignored as they do not have read permissions,
# and does not contain relevant data either.
ignore_files=( "issue_lip" "vport_create" "vport_delete" "host_reset"
"scan" "trace" "lpfc_xlane_lun" "lpfc_xlane_lun_status"
"issue_reset" "ctlreg" "lpfc_aer_state_cleanup"
"lpfc_drvr_stat_data" "lpfc_soft_wwn_enable"
)
device_path_fc="/sys/class/fc_host/$device/"
# Resolve symlink as we need to identify source device path.
device_class_path_fc=`readlink -f $device_path_fc`
echo -e "\nClass = " '"fc_host"'
echo -e "\n Class Device = " \"$device\"
echo -e " Class Device path = " \"$device_class_path_fc\"
for f in `ls $device_path_fc 2>/dev/null`
do
if [ ! -d $device_path_fc$f ] && [[ ! " ${ignore_files[@]} " =~ " ${f} " ]]; then
echo -e "\t$f =" \"`cat $device_path_fc$f 2>/dev/null`\"
fi
done
echo -e "\n\tDevice = " \"$device\"
echo -e "\tDevice path = " \"`echo $device_class_path_fc | sed 's/\/[^/]*\/[^/]*$//'`\"
device_path_scsi="/sys/class/scsi_host/$device/"
# Resolve symlink as we need to identify source device path.
device_class_path_scsi=`readlink -f $device_path_scsi`
echo -e "\n Class = " '"scsi_host"'
echo -e "\n Class Device = " \"$device\"
echo -e " Class Device path = " \"$device_class_path_scsi\"
for scsi_f in `ls $device_path_scsi 2>/dev/null`
do
if [ ! -d $device_path_scsi$scsi_f ] && [[ ! " ${ignore_files[@]} " =~ " ${scsi_f} " ]]; then
echo -e "\t$scsi_f =" \"`cat $device_path_scsi$scsi_f 2>/dev/null`\"
fi
done
echo -e "\n\tDevice = " \"$device\"
echo -e "\tDevice path = " \"`echo $device_class_path_scsi | sed 's/\/[^/]*\/[^/]*$//'`\"
fi
done
else
echo ERROR: Missing /sys/class/fc_host
fi
echo end sysfs_hba:
getHostInfo
The following code:
{
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);
}
}'
is replaced with:
if ( $6 ~ /min/ ) {
print "uptimeSeconds: ", ($3 * 86400) + ($5 * 60);
} else {
split($5,t,":");
print "uptimeSeconds: ", ($3 * 86400) + (t[1] * 3600) + (t[2] * 60);
}
} else {
print "uptimeSeconds: ", ($3 * 86400);
}
} else {
print "uptime: 0";
if ( $4 ~ /min/ ) {
print "uptimeSeconds: ", ($3 * 60);
} else {
split($3,t,":");
print "uptimeSeconds: ", (t[1] * 3600) + (t[2] * 60);
}
}
}'
The following code:
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 --connect-timeout 5 --fail http://169.254.169.254/latest/meta-data/instance-id 2>/dev/null | egrep '^i-[0-9a-f]+$'`
fi
if [ "$aws_instance_id" != "" ]; then
echo "aws_instance_id: " "$aws_instance_id"
fi
is replaced with:
fi
if [ -z "$aws_instance_id" -a -f /usr/bin/curl ]; then
# These web requests are not chargeable.
# See: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html
# Try IMDSv2 first. We only need a short session so set TTL to 60 seconds.
TOKEN=`curl --connect-timeout 5 --max-time 10 --fail -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 60" 2>/dev/null`
if [ ! -z "$TOKEN" ]; then
aws_instance_id=`curl --connect-timeout 5 --max-time 10 --fail -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/instance-id 2>/dev/null | egrep '^i-[0-9a-f]+$'`
else
# Try IMDSv1
aws_instance_id=`curl --connect-timeout 5 --max-time 10 --fail http://169.254.169.254/latest/meta-data/instance-id 2>/dev/null | egrep '^i-[0-9a-f]+$'`
fi
fi
if [ "$aws_instance_id" != "" ]; then
echo "aws_instance_id: " "$aws_instance_id"
fi
# Try to get the GCE IDs, if any
# see: https://cloud.google.com/compute/docs/storing-retrieving-metadata
if [ -f /usr/bin/curl ]; then
# Get instance ID
gce_instance_id=`curl --connect-timeout 5 --max-time 10 --fail --header 'Metadata-Flavor: Google' http://metadata.google.internal/computeMetadata/v1/instance/id 2>/dev/null`
if [ -n "$gce_instance_id" ]; then
echo "gce_instance_id: " "$gce_instance_id"
fi
fi
getDeviceInfo
The following code is added:
if [ "$os" = "" ]; then
type=`cat /etc/vmware/deployment.node.type 2> /dev/null`
# VMware vCenter Server Appliance
version=`rpm -q --queryformat "%{VERSION} ${type} build %{RELEASE}" VMware-vpxd 2>/dev/null | grep -v VMware-vpxd`
if [ "$version" = "" ]; then
# VMware Platform Service Controller
version=`rpm -q --queryformat "%{VERSION} ${type} build %{RELEASE}" psc_client 2>/dev/null | grep -v psc_client`
fi
if [ "$version" != "" ]; then
os="VMware vCenter Server Appliance $version"
fi
fi
Mainframe
The following mainframe discovery methods have been removed:
- getTransactionProgram
- getDatabaseDetail
- getSoftware
- getMQDetail
- getApplication
- getDatabase
- getTransaction
- getStorageSubsystem
The following mainframe discovery methods have been added:
- getIMSTransaction
- getCommServer
- getIMSFastPath
- getDB2Tablespace
- getPrintServer
- getCICSProgram
- getDB2Indexspace
- getResourceServer
- getSecurityServer
- getDatabaseServer
- getDB2Database
- getMessageServer
- getMQQueue
- getTransactionServer
- getMQChannel
- getIMSDatabase
- getOperatingSystem
- getWebSphereApplication
- getDB2Pageset
- getWorkload
- getDiskStorage
- getCICSTransaction
- getVirtualSystemEnabler
- getApplicationServer
- getMQListener
- getTransactionPolicy
- getTapeStorage
The following mainframe methods were changed:
getSysplex
The following command was added:
$DZSSYSP
getCouplingFacility
The following command was added:
$DZSCF
getMainframeInfo
The following command was added:
$DZSCEC
getMFPart
The following command was added:
$DZSLPAR
getDiskDrive
The following command was added:
$DZSDISK
getDependency
The following command was added:
$DZSRELA
getTapeDrive
The following command was added:
$DZSTPED
getHostInfo
The following code:
{
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);
}
}'
if [ -f /usr/sbin/dmidecode ]; then
is replaced with:
if ( $4 ~ /day/ ) {
print "uptime:", $3;
if ( $6 !~ /user/ ) {
if ( $6 ~ /min/ ) {
print "uptimeSeconds: ", ($3 * 86400) + ($5 * 60);
} else {
split($5,t,":");
print "uptimeSeconds: ", ($3 * 86400) + (t[1] * 3600) + (t[2] * 60);
}
} else {
print "uptimeSeconds: ", ($3 * 86400);
}
} else {
print "uptime: 0";
if ( $4 ~ /min/ ) {
print "uptimeSeconds: ", ($3 * 60);
} else {
split($3,t,":");
print "uptimeSeconds: ", (t[1] * 3600) + (t[2] * 60);
}
}
}'
if [ -f /usr/sbin/dmidecode ]; then
Solaris
initialise
The following code:
# At end as locale is slow leading to Solaris small input buffer overflowing
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
was moved to the end of the initialise method. The added comment describes the reason:
getDeviceInfo
The following code:
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
is replaced with:
os=`pkg info entire 2>/dev/null | grep "Version:" | awk 'NR > 1 {print $1}' RS='(' FS=')'`
if [ "$os" = "" ]; then
os=`pkg info entire 2>/dev/null | awk '/Branch:/ {print $2}' | nawk -F. '{printf "Oracle Solaris 11.%s.%s.%s.%s", $3, $4, $6, $7;}'`
fi
fi
AIX
getPackageList
The following code:
PRIV_LSLPP lslpp -l
is replaced with:
getHostInfo
The following code:
rm -f /tmp/tideway.$$
wparid=0
if [ `uname -v` -ge 6 ]; then
# AIX 6 WPAR support
wparid=`uname -W 2>/dev/null`
echo "wparid: $wparid"
if [ $wparid -eq 0 ]; then
echo 'begin lswpar:'
PRIV_LSWPAR /usr/sbin/lswpar -cqa name,state,type,hostname,directory,key,owner,application 2>/dev/null
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: | sed -e 's/IBM,//'`
echo 'kernel:' `egrep '^Kernel Type:' /tmp/tideway.$$ | cut -f2 -d:`
if [ $wparid -eq 0 ]; then
serial=`egrep '^Machine Serial Number:' /tmp/tideway.$$ | cut -f2 -d:`
# Don't output serial number if it isn't available. Also work around
is replaced with:
wparid=0
if [ `uname -v` -ge 5 ]; then
# WPAR support introduced in AIX 6 but a versioned WPAR may have AIX 5
wparid=`uname -W 2>/dev/null`
if [ $? -eq 0 ]; then
echo "wparid: $wparid"
if [ $wparid -eq 0 ]; then
echo 'begin lswpar:'
PRIV_LSWPAR /usr/sbin/lswpar -cqa name,state,type,hostname,directory,key,owner,application 2>/dev/null
echo 'end lswpar'
fi
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: | sed -e 's/IBM,//'`
echo 'kernel:' `egrep '^Kernel Type:' /tmp/tideway.$$ | cut -f2 -d:`
egrep '^LPAR Info:' /tmp/tideway.$$ | cut -f2 -d: | awk '
{
if ( ($1 ~ /^[[:digit:]]+$/ ) && ( toupper($2) !~ /NULL/ ) ) {
print "partition_id: "$2":"$1
}
}'
if [ $wparid -eq 0 ]; then
serial=`egrep '^Machine Serial Number:' /tmp/tideway.$$ | cut -f2 -d:`
# Don't output serial number if it isn't available. Also work around
The following code:
{
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);
}
}'
is replaced with:
if ( $4 ~ /day/ ) {
print "uptime:", $3;
if ( $6 !~ /user/ ) {
if ( $6 ~ /min/ ) {
print "uptimeSeconds: ", ($3 * 86400) + ($5 * 60);
} else {
split($5,t,":");
print "uptimeSeconds: ", ($3 * 86400) + (t[1] * 3600) + (t[2] * 60);
}
} else {
print "uptimeSeconds: ", ($3 * 86400);
}
} else {
print "uptime: 0";
if ( $4 ~ /min/ ) {
print "uptimeSeconds: ", ($3 * 60);
} else {
split($3,t,":");
print "uptimeSeconds: ", (t[1] * 3600) + (t[2] * 60);
}
}
}'
FreeBSD
getHostInfo
The following code:
{
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);
}
}'
if [ -f /usr/sbin/dmidecode ]; then
is replaced with:
if ( $4 ~ /day/ ) {
print "uptime:", $3;
if ( $6 !~ /user/ ) {
if ( $6 ~ /min/ ) {
print "uptimeSeconds: ", ($3 * 86400) + ($5 * 60);
} else {
split($5,t,":");
print "uptimeSeconds: ", ($3 * 86400) + (t[1] * 3600) + (t[2] * 60);
}
} else {
print "uptimeSeconds: ", ($3 * 86400);
}
} else {
print "uptime: 0";
if ( $4 ~ /min/ ) {
print "uptimeSeconds: ", ($3 * 60);
} else {
split($3,t,":");
print "uptimeSeconds: ", (t[1] * 3600) + (t[2] * 60);
}
}
}'
HPUX
getHostInfo
The following code:
OSVER=`uname -r 2>/dev/null | sed 's/[A-Z.]//g'`
kernel_bits=`getconf KERNEL_BITS 2>/dev/null`
if [ "$kernel_bits" = "" ]; then
kernel_bits=32
fi
echo "kernel: $kernel_bits bit"
echo 'vendor: HP'
echo 'model:' `model 2>/dev/null`
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"
is replaced with:
echo 'vendor: HP'
echo 'model:' `model 2>/dev/null`
hostid=`getconf CS_MACHINE_IDENT 2>/dev/null`
partition_id=`getconf CS_PARTITION_IDENT 2>/dev/null`
if [ "$partition_id" != "" ]; then
container_id=`/usr/sbin/srp_env 2>/dev/null | grep "id:" | sed 's/id: \([0-9]*\)/\1/'`
if [ "$container_id" != "" ]; then
partition_id="$partition_id:$container_id"
fi
echo 'partition_id:' $partition_id
if [ "$hostid" = "" ]; then
hostid="$partition_id"
OpenBSD
getHostInfo
The following code:
{
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);
}
}'
if [ -f /usr/sbin/dmidecode ]; then
is replaced with:
if ( $4 ~ /day/ ) {
print "uptime:", $3;
if ( $6 !~ /user/ ) {
if ( $6 ~ /min/ ) {
print "uptimeSeconds: ", ($3 * 86400) + ($5 * 60);
} else {
split($5,t,":");
print "uptimeSeconds: ", ($3 * 86400) + (t[1] * 3600) + (t[2] * 60);
}
} else {
print "uptimeSeconds: ", ($3 * 86400);
}
} else {
print "uptime: 0";
if ( $4 ~ /min/ ) {
print "uptimeSeconds: ", ($3 * 60);
} else {
split($3,t,":");
print "uptimeSeconds: ", (t[1] * 3600) + (t[2] * 60);
}
}
}'
if [ -f /usr/sbin/dmidecode ]; then
Linux
getHBAList
The following code:
echo begin sysfs_hba:
if [ ! -d /sys/class ]; then
echo /sys/class does not exist
elif [ -r /proc/vmware/version ] &&
[ `grep -o -m1 ESX /proc/vmware/version` ] ||
[ -r /etc/vmware-release ] &&
[ `grep -o ESX /etc/vmware-release` ]; then
echo ESX HBA drivers do not support sysfs
else
for device in `ls /sys/class/fc_host 2>/dev/null`
do
systool -c fc_host -v $device
systool -c scsi_host -v $device
done
fi
echo end sysfs_hba:
is replaced with:
if [ ! -d /sys/class ]; then
echo ERROR: Linux kernel does not support sysfs
elif [ -r /proc/vmware/version ] &&
[ `grep -o -m1 ESX /proc/vmware/version` ] ||
[ -r /etc/vmware-release ] &&
[ `grep -o ESX /etc/vmware-release` ]; then
echo ERROR: ESX HBA drivers do not support sysfs
elif [ -d /sys/class/fc_host ]; then
for device in `ls /sys/class/fc_host 2>/dev/null`
do
if [ -x /usr/bin/systool ]; then
systool -c fc_host -v $device
systool -c scsi_host -v $device
else
# systool not present? We will have to,
# find information from /sys/class/fc_host and /sys/class/scsi_host
# similar to systool.
# some files are ignored as they do not have read permissions,
# and does not contain relevant data either.
ignore_files=( "issue_lip" "vport_create" "vport_delete" "host_reset"
"scan" "trace" "lpfc_xlane_lun" "lpfc_xlane_lun_status"
"issue_reset" "ctlreg" "lpfc_aer_state_cleanup"
"lpfc_drvr_stat_data" "lpfc_soft_wwn_enable"
)
device_path_fc="/sys/class/fc_host/$device/"
# Resolve symlink as we need to identify source device path.
device_class_path_fc=`readlink -f $device_path_fc`
echo -e "\nClass = " '"fc_host"'
echo -e "\n Class Device = " \"$device\"
echo -e " Class Device path = " \"$device_class_path_fc\"
for f in `ls $device_path_fc 2>/dev/null`
do
if [ ! -d $device_path_fc$f ] && [[ ! " ${ignore_files[@]} " =~ " ${f} " ]]; then
echo -e "\t$f =" \"`cat $device_path_fc$f 2>/dev/null`\"
fi
done
echo -e "\n\tDevice = " \"$device\"
echo -e "\tDevice path = " \"`echo $device_class_path_fc | sed 's/\/[^/]*\/[^/]*$//'`\"
device_path_scsi="/sys/class/scsi_host/$device/"
# Resolve symlink as we need to identify source device path.
device_class_path_scsi=`readlink -f $device_path_scsi`
echo -e "\n Class = " '"scsi_host"'
echo -e "\n Class Device = " \"$device\"
echo -e " Class Device path = " \"$device_class_path_scsi\"
for scsi_f in `ls $device_path_scsi 2>/dev/null`
do
if [ ! -d $device_path_scsi$scsi_f ] && [[ ! " ${ignore_files[@]} " =~ " ${scsi_f} " ]]; then
echo -e "\t$scsi_f =" \"`cat $device_path_scsi$scsi_f 2>/dev/null`\"
fi
done
echo -e "\n\tDevice = " \"$device\"
echo -e "\tDevice path = " \"`echo $device_class_path_scsi | sed 's/\/[^/]*\/[^/]*$//'`\"
fi
done
else
echo ERROR: Missing /sys/class/fc_host
fi
echo end sysfs_hba:
getHostInfo
The following code:
{
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);
}
}'
is replaced with:
if ( $4 ~ /day/ ) {
print "uptime:", $3;
if ( $6 !~ /user/ ) {
if ( $6 ~ /min/ ) {
print "uptimeSeconds: ", ($3 * 86400) + ($5 * 60);
} else {
split($5,t,":");
print "uptimeSeconds: ", ($3 * 86400) + (t[1] * 3600) + (t[2] * 60);
}
} else {
print "uptimeSeconds: ", ($3 * 86400);
}
} else {
print "uptime: 0";
if ( $4 ~ /min/ ) {
print "uptimeSeconds: ", ($3 * 60);
} else {
split($3,t,":");
print "uptimeSeconds: ", (t[1] * 3600) + (t[2] * 60);
}
}
}'
The following code:
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 --connect-timeout 5 --fail http://169.254.169.254/latest/meta-data/instance-id 2>/dev/null | egrep '^i-[0-9a-f]+$'`
fi
if [ "$aws_instance_id" != "" ]; then
echo "aws_instance_id: " "$aws_instance_id"
fi
is replaced with:
fi
if [ -z "$aws_instance_id" -a -f /usr/bin/curl ]; then
# These web requests are not chargeable.
# See: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html
# Try IMDSv2 first. We only need a short session so set TTL to 60 seconds.
TOKEN=`curl --connect-timeout 5 --max-time 10 --fail -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 60" 2>/dev/null`
if [ ! -z "$TOKEN" ]; then
aws_instance_id=`curl --connect-timeout 5 --max-time 10 --fail -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/instance-id 2>/dev/null | egrep '^i-[0-9a-f]+$'`
else
# Try IMDSv1
aws_instance_id=`curl --connect-timeout 5 --max-time 10 --fail http://169.254.169.254/latest/meta-data/instance-id 2>/dev/null | egrep '^i-[0-9a-f]+$'`
fi
fi
if [ "$aws_instance_id" != "" ]; then
echo "aws_instance_id: " "$aws_instance_id"
fi
# Try to get the GCE IDs, if any
# see: https://cloud.google.com/compute/docs/storing-retrieving-metadata
if [ -f /usr/bin/curl ]; then
# Get instance ID
gce_instance_id=`curl --connect-timeout 5 --max-time 10 --fail --header 'Metadata-Flavor: Google' http://metadata.google.internal/computeMetadata/v1/instance/id 2>/dev/null`
if [ -n "$gce_instance_id" ]; then
echo "gce_instance_id: " "$gce_instance_id"
fi
fi
getDeviceInfo
The following code is added:
# VMware appliances
if [ "$os" = "" ]; then
type=`cat /etc/vmware/deployment.node.type 2> /dev/null`
# VMware vCenter Server Appliance
version=`rpm -q --queryformat "%{VERSION} ${type} build %{RELEASE}" VMware-vpxd 2>/dev/null | grep -v VMware-vpxd`
if [ "$version" = "" ]; then
# VMware Platform Service Controller
version=`rpm -q --queryformat "%{VERSION} ${type} build %{RELEASE}" psc_client 2>/dev/null | grep -v psc_client`
fi
if [ "$version" != "" ]; then
os="VMware vCenter Server Appliance $version"
fi
fi