Support Questions
Find answers, ask questions, and share your expertise

AmbariUI fronted by Knox doesn't display alerts, services can't be managed

New Contributor

We have a demo cluster and where we successfully configured knox to front some services. But are having some issues when fronting the AmbariUI. The login and interface work OK but the cluster alerts and service management don't work.

Looking at the console's output we see that the following request fails with an error when calling it fronted by knox.

Request

https://my1-testhost.com/gateway/default/ambari/api/v1/clusters/desa_datahub/hosts?fields=Hosts/rack...

Response:

{
  "status" : 400,
  "message" : "Invalid Request: Malformed Request Body.  An exception occurred parsing the request body: Unexpected character ('%' (code 37)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: java.io.StringReader@4fc081ba; line: 1, column: 3]"
}

But it works OK when called accessing directly to the machine that hosts ambari (i.e. http://ambari1.testhost.com:8080).

We are working with Knox 0.12.0 and Ambari 2.5.1.0. Any tips on where to find further info or a possible solution?

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions

Super Mentor
@iperurena

Can you please share your knox topology file?

Also as a quick test please try this:

1. Create a file "/etc/knox/conf/topologies/ui.xml" on the knox host as following:

<topology>
    <gateway>
        <provider>
            <role>authentication</role>
            <name>Anonymous</name>
            <enabled>true</enabled>
        </provider>
        <provider>
            <role>identity-assertion</role>
            <name>Default</name>
            <enabled>false</enabled>
        </provider>
    </gateway>
    <service>
        <role>AMBARI</role>
        <url>http://$AMBARI_HOST:8080</url>
    </service>
    <service>
        <role>AMBARIUI</role>
        <url>http://$AMBARI_HOST:8080</url>
    </service>
</topology>

**NOTE: ** Please replace the "$AMBARI_HOST" with your ambari server hostname.


2. Move the knox deployment dorectory and then restart knox.

# cd /var/lib/knox/data-x.x.x.x
# mv deployments deployments_bak



3. Now login to ambari UI and then try accessing the Ambari APIs as following:

https://<KNOX_HOST>:8443/gateway/ui/ambari/
https://<KNOX_HOST>:8443/gateway/ui/ambari/api/v1/clusters

.

View solution in original post

2 REPLIES 2

Super Mentor
@iperurena

Can you please share your knox topology file?

Also as a quick test please try this:

1. Create a file "/etc/knox/conf/topologies/ui.xml" on the knox host as following:

<topology>
    <gateway>
        <provider>
            <role>authentication</role>
            <name>Anonymous</name>
            <enabled>true</enabled>
        </provider>
        <provider>
            <role>identity-assertion</role>
            <name>Default</name>
            <enabled>false</enabled>
        </provider>
    </gateway>
    <service>
        <role>AMBARI</role>
        <url>http://$AMBARI_HOST:8080</url>
    </service>
    <service>
        <role>AMBARIUI</role>
        <url>http://$AMBARI_HOST:8080</url>
    </service>
</topology>

**NOTE: ** Please replace the "$AMBARI_HOST" with your ambari server hostname.


2. Move the knox deployment dorectory and then restart knox.

# cd /var/lib/knox/data-x.x.x.x
# mv deployments deployments_bak



3. Now login to ambari UI and then try accessing the Ambari APIs as following:

https://<KNOX_HOST>:8443/gateway/ui/ambari/
https://<KNOX_HOST>:8443/gateway/ui/ambari/api/v1/clusters

.

View solution in original post

New Contributor

Thanks for the quick answer!

Turns out we were missing a service block in our topology file. We had the AMBARIUI service but not AMBARI. Adding

<service>
<role>AMBARI</role>
<url>http://ambari1.testhost.com:8080</url>
</service>

To our topology file and restarting Knox did the trick.

Originally, we followed this article: https://community.hortonworks.com/articles/78361/configure-knox-to-access-ambari-ui.html which doesn't mention the service blocks you just pointed out. It would be interesting to fix the article so that other users don't face the same issue.