Default language.

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 that have been removed and not replaced
  • Changes to echo-only statements

Discovery command changes from 24.3 to 25.2

The Hewlett Packard Enterprise NonStop platform was added.

Windows

getNetworkConnectionList

The following code:


Get-NetTCPConnection | ForEach-Object {
   "protocol: TCP";
   "local_ip_addr: {0}" -f $_.LocalAddress;
   "local_port: {0}" -f $_.LocalPort;

is replaced with:

 
Get-NetTCPConnection -State Listen,Established | ForEach-Object {
   "protocol: TCP";
   "local_ip_addr: {0}" -f $_.LocalAddress;
   "local_port: {0}" -f $_.LocalPort;

getPackageList

The following code:

 
       }
       if ($name) {
           "name: {0}" -f $name;
           "version: {0}" -f $item.DisplayVersion;
           if ($item.Publisher) {
               "vendor: {0}" -f $item.Publisher;
           }
 

is replaced with:

 

       }
       if ($name) {
           "name: {0}" -f $name;
           "version: {0}" -f ($item.DisplayVersion | Select-String '((?:\d+\.){1,3}\d+)' | ForEach-Object {$_.Matches[0].Groups[1].Value});
           if ($item.Publisher) {
               "vendor: {0}" -f $item.Publisher;
           }
 

initialise

The following code is added:


# Ensure that cmdlets don't report progress
$ProgressPreference = "SilentlyContinue"

getDeviceInfo

The following code:


$info = $null
if ($PSVersionTable.PSVersion.Major -gt 5 -or
   ($PSVersionTable.PSVersion.Major -eq 5 -And $PSVersionTable.PSVersion.Minor -ge 1)) {
   $info = Get-ComputerInfo
}

if ($info) {
   "hostname: {0}" -f $info.csDNSHostName;
   "domain: {0}" -f $info.csDomain;
} else {

is replaced with:


$info = $null
if ($PSVersionTable.PSVersion.Major -gt 5 -or
  ($PSVersionTable.PSVersion.Major -eq 5 -And
    $PSVersionTable.PSVersion.Minor -ge 1)) {
    try {
       $info = Get-ComputerInfo -ErrorAction SilentlyContinue;
   }
    catch {
   }
}

if ($info -And
   $info.csDNSHostName -And
   $info.csDomain) {
   "hostname: {0}" -f $info.csDNSHostName;
   "domain: {0}" -f $info.csDomain;
} else {

and the following code:


try {
   $fqdn = [System.Net.Dns]::GetHostByName($env:computerName).HostName;
   "fqdn: {0}" -f $fqdn;
}

is replaced with:


try {
   $fqdn = [System.Net.Dns]::GetHostEntry($env:computerName).HostName;
   "fqdn: {0}" -f $fqdn;
}

The following code:


###########################################################################
# Operating System details
if ($info) {
   "os: {0} Version {1} Build {2}" -f $info.OsName, $info.OsVersion, $info.OsBuildNumber;
   "os_version: {0}" -f $info.OsVersion;
   "os_build: {0}" -f $info.OsBuildNumber;
   if ($info.OsServicePackMajorVersion) {
       "service_pack: {0}" -f $info.OsServicePackMajorVersion;
   }
   "os_directory: {0}" -f $info.OsWindowsDirectory;
   "os_arch: {0}" -f $info.CsSystemType;
   "os_release: {0}" -f $info.WindowsVersion;
   "os_update_build_revision: {0}" -f $info.WindowsUBR;
} else {
   $os = Get-CIMInstance -Class Win32_OperatingSystem;
   "os: {0} Version {1} Build {2}" -f $os.Caption, $os.Version, $os.BuildNumber;
   "os_version: {0}" -f $os.Version;
   "os_build: {0}" -f $os.BuildNumber;
   if ($os.ServicePackMajorVersion) {
       "service_pack: {0}" -f $os.ServicePackMajorVersion;
   }
   "os_directory: {0}" -f $os.WindowsDirectory;
   "os_arch: {0}" -f $cs.SystemType;

   $tmp = Get-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ReleaseId -ErrorAction SilentlyContinue;
   if ($tmp) {
       "os_release: {0}" -f $tmp.ReleaseId;
   }
   $tmp = Get-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name UBR -ErrorAction SilentlyContinue;
   if ($tmp) {
       "os_update_build_revision: {0}" -f $tmp.UBR;

is replaced with:


###########################################################################
# Operating System details
$os = Get-CIMInstance -Class Win32_OperatingSystem;
if ($info -And
   $info.OsName -And
   $info.OsVersion -And
   $info.OsBuildNumber) {
   "os: {0} Version {1} Build {2}" -f $info.OsName, $info.OsVersion, $info.OsBuildNumber;
   "os_version: {0}" -f $info.OsVersion;
   "os_build: {0}" -f $info.OsBuildNumber;
} else {
   "os: {0} Version {1} Build {2}" -f $os.Caption, $os.Version, $os.BuildNumber;
   "os_version: {0}" -f $os.Version;
   "os_build: {0}" -f $os.BuildNumber;
}

if ($info -And $info.OsServicePackMajorVersion) {
   "service_pack: {0}" -f $info.OsServicePackMajorVersion;
} elseif ($os.ServicePackMajorVersion) {
   "service_pack: {0}" -f $os.ServicePackMajorVersion;
}

if ($info -And $info.OsWindowsDirectory) {
   "os_directory: {0}" -f $info.OsWindowsDirectory;
} else {
   "os_directory: {0}" -f $os.WindowsDirectory;
}

if ($info -And $info.CsSystemType) {
   "os_arch: {0}" -f $info.CsSystemType;
} else {
   "os_arch: {0}" -f $cs.SystemType;
}

if ($info -And $info.WindowsVersion) {
   "os_release: {0}" -f $info.WindowsVersion;
} else {
   $tmp = Get-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ReleaseId -ErrorAction SilentlyContinue;
   if ($tmp) {
       "os_release: {0}" -f $tmp.ReleaseId;
   }
}

if ($info -And $info.WindowsUBR) {
   "os_update_build_revision: {0}" -f $info.WindowsUBR;
} else {
   $tmp = Get-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name UBR -ErrorAction SilentlyContinue;
   if ($tmp) {
       "os_update_build_revision: {0}" -f $tmp.UBR;

Linux

A new script, getOSNamespaces is added.

initialise

The following code:

...
    PRIV_LSHW() {
       "$@"
   }
...
   }
    PRIV_LSOF() {
       "$@"
   }
...
    PRIV_LSHW() {
        sudo "$@"
   }
...
   # lsof requires superuser privileges to display information on processes
   # other than those running as the current user
   PRIV_LSOF() {
...
   # nsenter requires superuser privileges to run commands in alternative
   # namespaces
   PRIV_NSENTER() {
       "$@"
   }
   # Allow patterns to run commands with elevated privileges
   PRIV_RUNCMD() {
...
    PRIV_LSHW() {
       "$@"
   }
   # lsof requires superuser privileges to display information on processes
   # other than those running as the current user
  

is replaced with:

...
    PRIV_LSHW() {
       "$@"
   }
    PRIV_LSNS() {
       "$@"
   }
    PRIV_LSOF() {
       "$@"
   }
...
    PRIV_LSHW() {
        sudo "$@"
   }
   # lsns requires superuser privileges to read all OS namespaces
   PRIV_LSNS() {
        sudo "$@"
   }
   # lsof requires superuser privileges to display information on processes
   # other than those running as the current user
   PRIV_LSOF() {
...
   # nsenter requires superuser privileges to run commands in alternative
   # namespaces
   PRIV_NSENTER() {
        sudo "$@"
   }
   # Allow patterns to run commands with elevated privileges
   PRIV_RUNCMD() {
...
    PRIV_LSHW() {
       "$@"
   }
   # lsns requires superuser privileges to read all OS namespaces
   PRIV_LSNS() {
       "$@"
   }
   # lsof requires superuser privileges to display information on processes
   # other than those running as the current user
  

containerExec

The following code:


PRIV_NSENTER nsenter -t %(pid)s -m /bin/sh << 'TW_EOF_MARKER'
PAT
H=%(path)s
export PATH
  

is replaced with:

PRIV_NSENTER nsenter -t %(pid)s -m -p -w /bin/sh << 'TW_EOF_MARKER'
TW_
CONTAINER_ID="%(container_id)s"
export TW_CONTAINER_ID

PATH=%(path)s
export PATH
  

getPackageList

The rpm command is removed.
The zypper command is added 
The apk-list command is added.

The following code:

rpm -qa --queryformat 'begin\nname: %{NAME}\nversion: %{VERSION}\nrelease: %{RELEASE}\narch: %{ARCH}\nvendor: %{VENDOR}\nepoch: %{EPOCH}\ndescription: %{SUMMARY}\nend\n' 2>/dev/null
 

is replaced with:


if [ -x /bin/rpm ]; then
    /bin/rpm -qa --queryformat 'begin\nname: %{NAME}\nversion: %{VERSION}\nrelease: %{RELEASE}\narch: %{ARCH}\nvendor: %{VENDOR}\nepoch: %{EPOCH}\ndescription: %{SUMMARY}\nend\n' 2>/dev/null
fi
 

getPackageList

The following code:

COLUMNS=256 dpkg -l '*' 2>/dev/null | grep -E '^ii '
 

is replaced with:

for binary in /bin/dpkg /usr/bin/dpkg
do
   if [ -x $binary ]; then
       COLUMNS=256 $binary -l '*' 2>/dev/null | grep -E '^ii '
       break
   fi
done

getDeviceInfo

The following code:

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
 dns_domain=`awk '/^(domain|search)/ {sub(/\\\\000$/, "", $2); print $2; exit }' /etc/resolv.conf 2>/dev/null`
fi
if [ "$dns_domain" = "." ]; then
   dns_domain=""
fi
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)//'

os=""
# 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 build`

is replaced with:

if [ -z "$TW_CONTAINER_ID" ]; then
   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
       dns_domain=`awk '/^(domain|search)/ {sub(/\\\\000$/, "", $2); print $2; exit }' /etc/resolv.conf 2>/dev/null`
   fi
   if [ "$dns_domain" = "." ]; then
       dns_domain=""
   fi
   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)//'
fi

os=""
# VMware appliances
if [ "$os" = "" -a -f /etc/vmware/deployment.node.type ]; 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 build`

VMware ESX

A new script, getOSNamespaces is added.

initialise

The following code:

     PRIV_LSHW() {
        "$@"
    }
     PRIV_LSOF() {
        "$@"
    }
...
     PRIV_LSHW() {
         sudo "$@"
    }
    # lsof requires superuser privileges to display information on processes
    # other than those running as the current user
    PRIV_LSOF() {
...
    # nsenter requires superuser privileges to run commands in alternative
    # namespaces
    PRIV_NSENTER() {
        "$@"
    }
    # Allow patterns to run commands with elevated privileges
    PRIV_RUNCMD() {
...
     PRIV_LSHW() {
        "$@"
    }
    # lsof requires superuser privileges to display information on processes
    # other than those running as the current user
    PRIV_LSOF() {

is replaced with:

     PRIV_LSHW() {
        "$@"
    }
     PRIV_LSNS() {
        "$@"
   }
     PRIV_LSOF() {
        "$@"
    }
...
     PRIV_LSHW() {
         sudo "$@"
    }
    # lsns requires superuser privileges to read all OS namespaces
   PRIV_LSNS() {
         sudo "$@"
    }
    # lsof requires superuser privileges to display information on processes
    # other than those running as the current user
    PRIV_LSOF() {
...
    # nsenter requires superuser privileges to run commands in alternative
    # namespaces
    PRIV_NSENTER() {
         sudo "$@"
    }
    # Allow patterns to run commands with elevated privileges
    PRIV_RUNCMD() {
...
     PRIV_LSHW() {
        "$@"
    }
    # lsns requires superuser privileges to read all OS namespaces
    PRIV_LSNS() {
        "$@"
    }
    # lsof requires superuser privileges to display information on processes
    # other than those running as the current user
    PRIV_LSOF() {

containerExec

The following code:

PRIV_NSENTER nsenter -t %(pid)s -m /bin/sh << 'TW_EOF_MARKER'
PAT
H=%(path)s
export PATH

is replaced with:

PRIV_NSENTER nsenter -t %(pid)s -m -p -w /bin/sh << 'TW_EOF_MARKER'
TW_
CONTAINER_ID="%(container_id)s"
export TW_CONTAINER_ID

PATH=%(path)s
export PATH

getPackageList

The rpm command is REMOVED.
The zypper command is ADDED.
The apk-list command is ADDED.

The following code:

rpm -qa --queryformat 'begin\nname: %{NAME}\nversion: %{VERSION}\nrelease: %{RELEASE}\narch: %{ARCH}\nvendor: %{VENDOR}\nepoch: %{EPOCH}\ndescription: %{SUMMARY}\nend\n' 2>/dev/null

is replaced with:

if [ -x /bin/rpm ]; then
    /bin/rpm -qa --queryformat 'begin\nname: %{NAME}\nversion: %{VERSION}\nrelease: %{RELEASE}\narch: %{ARCH}\nvendor: %{VENDOR}\nepoch: %{EPOCH}\ndescription: %{SUMMARY}\nend\n' 2>/dev/null
fi

The following code:

COLUMNS=256 dpkg -l '*' 2>/dev/null | grep -E '^ii '

is replaced with:

for binary in /bin/dpkg /usr/bin/dpkg
do
   if [ -x $binary ]; then
       COLUMNS=256 $binary -l '*' 2>/dev/null | grep -E '^ii '
       break
   fi
done

getDeviceInfo

The following code:

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
 dns_domain=`awk '/^(domain|search)/ {sub(/\\\\000$/, "", $2); print $2; exit }' /etc/resolv.conf 2>/dev/null`
fi
if [ "$dns_domain" = "." ]; then
   dns_domain=""
fi
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)//'

os=""
# 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 build`

is replaced with:

if [ -z "$TW_CONTAINER_ID" ]; then
   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
       dns_domain=`awk '/^(domain|search)/ {sub(/\\\\000$/, "", $2); print $2; exit }' /etc/resolv.conf 2>/dev/null`
   fi
   if [ "$dns_domain" = "." ]; then
       dns_domain=""
   fi
   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)//'
fi

os=""
# VMware appliances
if [ "$os" = "" -a -f /etc/vmware/deployment.node.type ]; 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 build`

AIX

getDeviceInfo

The following code:

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

is replaced with:

    
os="`uname -s 2>/dev/null` $osver"
fi
maintlevel=`oslevel -s 2>/dev/null`
if [ $? -ne 0 ]; then
   maintlevel=""
fi
if [ "$maintlevel" != "" ]; then
   echo 'os_level:' $maintlevel
   tl_os=`echo "$os $maintlevel" | sed -ne 's/^\([[doc:xwiki:IT-Operations-Management.Discovery.BMC-Discovery.BMC-Helix-Discovery-25-2-On-Premises.PREM-BMC-Discovery.PREM-Changes-to-Discovery-commands.:alpha:]]\{1,\} '\
'[[doc:xwiki:IT-Operations-Management.Discovery.BMC-Discovery.BMC-Helix-Discovery-25-2-On-Premises.PREM-BMC-Discovery.PREM-Changes-to-Discovery-commands.:digit:]]\.[[doc:xwiki:IT-Operations-Management.Discovery.BMC-Discovery.BMC-Helix-Discovery-25-2-On-Premises.PREM-BMC-Discovery.PREM-Changes-to-Discovery-commands.:digit:]]\)\.[[doc:xwiki:IT-Operations-Management.Discovery.BMC-Discovery.BMC-Helix-Discovery-25-2-On-Premises.PREM-BMC-Discovery.PREM-Changes-to-Discovery-commands.:digit:]]\.[[doc:xwiki:IT-Operations-Management.Discovery.BMC-Discovery.BMC-Helix-Discovery-25-2-On-Premises.PREM-BMC-Discovery.PREM-Changes-to-Discovery-commands.:digit:]] '\
'[[doc:xwiki:IT-Operations-Management.Discovery.BMC-Discovery.BMC-Helix-Discovery-25-2-On-Premises.PREM-BMC-Discovery.PREM-Changes-to-Discovery-commands.:digit:]]\{4\}-0*\([[doc:xwiki:IT-Operations-Management.Discovery.BMC-Discovery.BMC-Helix-Discovery-25-2-On-Premises.PREM-BMC-Discovery.PREM-Changes-to-Discovery-commands.:digit:]]\{1,\}\)-[[doc:xwiki:IT-Operations-Management.Discovery.BMC-Discovery.BMC-Helix-Discovery-25-2-On-Premises.PREM-BMC-Discovery.PREM-Changes-to-Discovery-commands.:digit:]]\{2\}-[[doc:xwiki:IT-Operations-Management.Discovery.BMC-Discovery.BMC-Helix-Discovery-25-2-On-Premises.PREM-BMC-Discovery.PREM-Changes-to-Discovery-commands.:digit:]]\{4\}$/\1 TL\2/p'`

   if [ "$tl_os" != "" ]; then
       os=$tl_os
   fi
   echo $maintlevel | sed -ne 's/^[[doc:xwiki:IT-Operations-Management.Discovery.BMC-Discovery.BMC-Helix-Discovery-25-2-On-Premises.PREM-BMC-Discovery.PREM-Changes-to-Discovery-commands.:digit:]]\{4\}-[[doc:xwiki:IT-Operations-Management.Discovery.BMC-Discovery.BMC-Helix-Discovery-25-2-On-Premises.PREM-BMC-Discovery.PREM-Changes-to-Discovery-commands.:digit:]]\{2\}-[[doc:xwiki:IT-Operations-Management.Discovery.BMC-Discovery.BMC-Helix-Discovery-25-2-On-Premises.PREM-BMC-Discovery.PREM-Changes-to-Discovery-commands.:digit:]]\{2\}-0*\([[doc:xwiki:IT-Operations-Management.Discovery.BMC-Discovery.BMC-Helix-Discovery-25-2-On-Premises.PREM-BMC-Discovery.PREM-Changes-to-Discovery-commands.:digit:]]\{1,\}\)$/os_build: \1/p'
   echo $maintlevel | sed -ne 's/^[[doc:xwiki:IT-Operations-Management.Discovery.BMC-Discovery.BMC-Helix-Discovery-25-2-On-Premises.PREM-BMC-Discovery.PREM-Changes-to-Discovery-commands.:digit:]]\{4\}-[[doc:xwiki:IT-Operations-Management.Discovery.BMC-Discovery.BMC-Helix-Discovery-25-2-On-Premises.PREM-BMC-Discovery.PREM-Changes-to-Discovery-commands.:digit:]]\{2\}-0*\([[doc:xwiki:IT-Operations-Management.Discovery.BMC-Discovery.BMC-Helix-Discovery-25-2-On-Premises.PREM-BMC-Discovery.PREM-Changes-to-Discovery-commands.:digit:]]\{1,\}\)-[[doc:xwiki:IT-Operations-Management.Discovery.BMC-Discovery.BMC-Helix-Discovery-25-2-On-Premises.PREM-BMC-Discovery.PREM-Changes-to-Discovery-commands.:digit:]]\{4\}$/service_pack: \1/p'
fi
echo 'os:' $os
echo 'os_arch:' `uname -p 2>/dev/null`

 

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*