Verifying an Instance Can Connect to OS Management Hub

Verify an instance can reach the OS Management Hub service to help troubleshoot connectivity and registration issues.

OCI instance

Oracle Linux

  1. Connect to the instance by using SSH.
  2. Run the following:
    curl -s -H "Authorization: Bearer Oracle" http://169.254.169.254/opc/v2/instance/regionInfo > /tmp/curl.out
    REGION=`cat /tmp/curl.out | jq -r ".regionIdentifier"` ; export REGION
    DOMAIN=`cat /tmp/curl.out | jq -r ".realmDomainComponent"` ; export DOMAIN
    curl -s https://osmh.$REGION.oci.$DOMAIN &>/dev/null ; [ $? == 0 ] && echo "Success" || echo "Failure"
  3. If the test reports 'Failure':

Windows

  1. Connect to the instance.
  2. Run the following command in PowerShell as an administrator.
    Invoke-WebRequest -Headers @{'Authorization'='Bearer Oracle'} http://169.254.169.254/opc/v2/instance/regionInfo
  3. Identify the domain and region from the response.

    For example:

    {
      "realmDomainComponent": "oraclecloud.com",
      "realmKey": "oc1",
      "regionIdentifier": "us-ashburn-1",
      "regionKey": "IAD"
    }
    • The domain is oraclecloud.com

    • The region is us-ashburn-1.

  4. Construct the OS Management Hub endpoint.
    https://osmh.<region>.oci.<domain>/

    For example:

    https://osmh.us-ashburn-1.oci.oraclecloud.com/
  5. Test the connection to the endpoint
    Invoke-WebRequest -TimeoutSec 3 <endpoint>

    For example:

    Invoke-WebRequest -TimeoutSec 3 https://osmh.us-ashburn-1.oci.oraclecloud.com/
  6. Determine if the instance can reach OS Management Hub based on the response.
    Success
    {"code" : "NotAuthorizedOrNotFound", "message" : "Authorization failed or requested resource not found."}
    Failure
    Connection timed out after 3001 milliseconds

    or

    The remote name could not be resolved
  7. If the test fails:

On-premises or third-party cloud instance

Test the OCI endpoint connection

  1. Determine your region. See Regions and Availability Domains.

    For example: us-ashburn-1

  2. Connect to the instance by using SSH.
  3. Run the following:
    curl -s https://osmh.<region>.oci.oraclecloud.com &>/dev/null ; [ $? == 0 ] && echo "Success" || echo "Failure"

    For example:

    curl -s https://osmh.us-ashburn-1.oci.oraclecloud.com &>/dev/null ; [ $? == 0 ] && echo "Success" || echo "Failure"
  4. If the test reports 'Failure', it could mean:
    • Management station used by the instance doesn't have connectivity to the internet or OCI (see Communication to OCI)
    • Your network or firewall isn't allowing traffic to the OCI endpoint (see Communication to OCI)

Test the mirror and proxy ports

  1. Connect to the instance by using SSH.
  2. Run the following:
    STATION=`sudo grep GatewayServerHost /opt/oracle/mgmt_agent/agent_inst/config/emd.properties | awk -F"=" '{print $2}'` ; export STATION
    STATION_PROXY_PORT=`sudo grep GatewayServerPort /opt/oracle/mgmt_agent/agent_inst/config/emd.properties | awk -F"=" '{print $2}'` ; export STATION_PROXY_PORT
    STATION_MIRROR_PORT=`sudo grep baseurl /etc/yum.repos.d/osmh.repo | awk -F"/" '{print $3}' | awk -F":" '{print $2}' | uniq` ; export STATION_MIRROR_PORT
    echo -n "Probing $STATION proxy port $STATION_PROXY_PORT :  "
    nc -zv $STATION $STATION_PROXY_PORT &>/dev/null ; [ $? == 0 ] && echo "Success" || echo "Failure"
    echo -n "Probing $STATION mirror port $STATION_MIRROR_PORT : "
    nc -zv $STATION $STATION_MIRROR_PORT &>/dev/null ; [ $? == 0 ] && echo "Success" || echo "Failure"
  3. If the test reports 'Failure', it could mean: