Splunk AppDynamics

How do you build a java client target (javax.ws.rs.client) to call AppDynamics health rules API ?

CommunityUser
Splunk Employee
Splunk Employee

Question :

Is there any example of how to correctly call the AppDynamics rest API health rules using java?

Summary:

Our team is working on calling the health rules API in appDynamics using java

( javax.ws.rs.client.Client.target library )

Below is the client request call put together, it is currently returning a socket timeout exception. From the research, I have done this should be the correct format in java on how to build the client call for the health rules, but is not working.

Wondering if someone from the community can provide more insight on how to do this in Java.

Thank You

 
How do you build a java rest API client (javax.ws) to call the AppDynamics HealthRules API

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;

Client client = clientBuilder.build();
client.property(ClientConstants.METER_ID, "MyClientApp");
client.property(ClientConstants.SOCKET_TIMEOUT, 600000);
client.property(ClientConstants.CONNECTION_TIMEOUT, 600000);
client.property(ClientConstants.SECURITY_TYPE, 600000);
client.property(ClientConstants.SECURITY_TYPE,SecurityType.BasicAuth);
client.property(ClientConstants.USER_ID, "user@customer1");
client.property(ClientConstants.PASSWORD, "password");


 healthRulesCall = client.target("https://appd-prod.mywork.com:8181/controller/healthrules/24").queryParam("count", 100)
.queryParam("offset", 0).request().accept(MediaType.APPLICATION_XML_TYPE).get(String.class);
Labels (1)
0 Karma

CommunityUser
Splunk Employee
Splunk Employee

Hi Theophilus.Borrero

Socket timeout might be caused by not being able to connect through the network in between. Have you tried doing a telnet or curl to the following address ? 

https://appd-prod.mywork.com:8181

Also I saw you are using this property twice

ClientConstants.SECURITY_TYPE

Once with a number which might indicate a timeout and then with the actual authentication type. Maybe that needs to be fixed as well.

Anyways if there was something wrong with authentication then I would expect you receiving a 401 HTTP return code but it seems you are not even getting to your target.

Philipp

0 Karma
Get Updates on the Splunk Community!

Fueling your curiosity with new Splunk ILT and eLearning courses

At Splunk Education, we’re driven by curiosity—both ours and yours! That’s why we’re committed to delivering ...

Splunk AI Assistant for SPL 1.1.0 | Now Personalized to Your Environment for Greater ...

Splunk AI Assistant for SPL has transformed how users interact with Splunk, making it easier than ever to ...

Unleash Unified Security and Observability with Splunk Cloud Platform

     Now Available on Microsoft AzureOn Demand Now Step boldly into the AI revolution with enhanced security ...