synaps not responding to API call

Asked by Henry Wong

Synaps is not responding to my API call.

netstat -a gives me this: tcp 0 0 *:8776 *:* LISTEN

When I make an API call with java:
CWSample() throws IOException {
                cw = new AmazonCloudWatchClient(new PropertiesCredentials(new File(
         "target/classes/SpcsCredentials.properties")));
                cw.setEndpoint("http://164.150.4.117:8776/monitor/");
        }

I am getting a connection timeout.

Is the endpoint correct? 164.150.4.117 is my synaps server.

If I put this (http://164.150.4.117:8776/monitor/) in a web browser, should I get a response?

Also, in my /var/log/synaps-api.log, I have this line in there:
2014-02-27 16:42:02 INFO synaps.wsgi [-] Started cloudwatch on 0.0.0.0:8776

Instead of 0.0.0.0:8776, how can I get it to start on 164.150.4.117:8776?

Question information

Language:
English Edit question
Status:
Answered
For:
Synaps Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
June Yi (gochist) said :
#1

It should respond for your browser request or curl command with the endpoint url, http://164.150.4.117:8776/monitor.

Can you try curl command at the server that synaps api is running? If its response is like below, it might be blocked by firewall or proxy between the client and server route.

$ curl http://localhost:8776/monitor
<?xml version="1.0"?>
<ErrorResponse xmlns="http://monitoring.amazonaws.com/doc/2010-08-01/"><Error><Code>Unauthorized</Code><Message>Access key or signature not provided</Message></Error><RequestId>req-b5635798-3248-4138-8344-ecfa3344313a</RequestId></ErrorResponse>

If there is no problem with network, you need to check log files in both server and client. To enable server log, add a line, "logdir=/var/log/synaps" in your synaps.conf and restart synaps api . Be sure that the directory exists. And to enable client log, see http://docs.aws.amazon.com/AWSSdkDocsJava/latest/DeveloperGuide/java-dg-logging.html .

Revision history for this message
June Yi (gochist) said :
#2

> Instead of 0.0.0.0:8776, how can I get it to start on 164.150.4.117:8776?

Add this line to your synaps.conf.

cloudwatch_listen=164.150.4.117

ps. If you have additional question, add comment or open new question, please. If you change question description, it is hard to be notified for me.

Revision history for this message
Henry Wong (henry-wong) said :
#3

I added the line but still am receiving the following error even though I am running on the same machine that synaps is installed on:

root@synaps:/etc/synaps# curl http://162.150.4.117:8776/
<?xml version="1.0"?>
<ErrorResponse xmlns="http://monitoring.amazonaws.com/doc/2010-08-01/"><Error><Code>Unauthorized</Code><Message>Signature not provided</Message></Error><RequestId>req-e41acb42-da9e-47ab-8317-93f888a1a802</RequestId>

</ErrorResponse>root@synaps:/etc/synaps# curl http://162.150.4.117:8776/monitor
<?xml version="1.0"?>
<ErrorResponse xmlns="http://monitoring.amazonaws.com/doc/2010-08-01/"><Error><Code>Unauthorized</Code><Message>Signature not provided</Message></Error><RequestId>req-7878d98c-f816-4f0d-8843-08e0f43f96d2</RequestId></ErrorResponse>root@synaps:/etc/synaps#

I do not see any proxy or firewalls.

root@synaps:/var/log/synaps# traceroute 162.150.4.117
traceroute to 162.150.4.117 (162.150.4.117), 30 hops max, 60 byte packets
 1 synaps (162.150.4.117) 0.047 ms 0.011 ms 0.009 ms

ps:/etc/synaps# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

netcat -vz 162.150.4.117 8776
Connection to 162.150.4.117 8776 port [tcp/*] succeeded!
root@synaps:/var/log/synaps# netcat -vz 162.150.4.117 8777
Connection to 162.150.4.117 8777 port [tcp/*] succeeded!
root@synaps:/var/log/synaps# netcat -vz 162.150.4.117 8778
Connection to 162.150.4.117 8778 port [tcp/*] succeeded!
root@synaps:/var/log/synaps# netcat -vz 162.150.4.117 8779
Connection to 162.150.4.117 8779 port [tcp/*] succeeded!
root@synaps:/var/log/synaps#

Revision history for this message
Henry Wong (henry-wong) said :
#4

Also, why is the error message pointing to "http://monitoring.amazonaws.com/doc/2010-08-01/", is that an URL that we should be able to access from within our synaps server?

Revision history for this message
June Yi (gochist) said :
#5

1. As I see your curl result, server side looks fine. Because you didn't provide signature parameter. Boto or AWS SDK will do it for you. Can you show me your client side log?

2. That xmlns is just for setting xml namespace. You can just ignore it.

Revision history for this message
Henry Wong (henry-wong) said :
#6

Exception in thread "main" com.amazonaws.AmazonServiceException: Status Code: 400, AWS Service: AmazonCloudWatch, AWS Request ID: req-509bf8f4-cf78-401e-9f0a-d7c4c737ca24, AWS Error Code: Unauthorized, AWS Error Message: Signature not provided
 at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:773)
 at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:417)
 at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:229)
 at com.amazonaws.services.cloudwatch.AmazonCloudWatchClient.invoke(AmazonCloudWatchClient.java:867)
 at com.amazonaws.services.cloudwatch.AmazonCloudWatchClient.listMetrics(AmazonCloudWatchClient.java:388)
 at synaps.CWSample.examListMetrics(CWSample.java:75)
 at synaps.CWSample.main(CWSample.java:40)

Revision history for this message
June Yi (gochist) said :
#7

Synaps doesn't provide AWS signature v4 but v2. But your SDK is using v4. Please use SDK version under 1.3.12 or SPCS branch of SDK. (see http://spcs.github.io/synaps/artifacts/sdkdescription.html )

Revision history for this message
June Yi (gochist) said :
#8

And just for information, I have plan to support signature v4 in near future.

Can you help with this problem?

Provide an answer of your own, or ask Henry Wong for more information if necessary.

To post a message you must log in.