Remote agent failing to connect to server
Asked by Bobby Tait:

Bamboo: 6.9.2 build 60911

Server: Windows 10 Pro on PC

Agent: Windows 10 Pro on Azure VM

I'm assuming I've configured the VM networking incorrectly. I've tried configuring both the server and VM, with no luck. I'd appreciate any guidance.

atlassian-bamboo-agent.log says this, repeatedly:

```
STATUS | wrapper | 2019/09/24 15:13:11 | Launching a JVM...
INFO | jvm 63 | 2019/09/24 15:13:11 | Wrapper (Version 3.2.3-atlassian-1) http://wrapper.tanukisoftware.org
INFO | jvm 63 | 2019/09/24 15:13:11 | Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
INFO | jvm 63 | 2019/09/24 15:13:11 | 
INFO | jvm 63 | 2019/09/24 15:13:11 | 2019-09-24 15:13:11,394 INFO [WrapperSimpleAppMain] [AgentBootstrap] Starting Agent Bootstrap using Java 1.8.0_221 from Oracle Corporation. Default charset: windows-1252, file name encoding: Cp1252
INFO | jvm 63 | 2019/09/24 15:13:11 | 2019-09-24 15:13:11,395 INFO [WrapperSimpleAppMain] [AgentBootstrap] Agent bootstrap using endpoint: http://<server-ip>/agentServer/
INFO | jvm 63 | 2019/09/24 15:13:11 | 2019-09-24 15:13:11,407 INFO [WrapperSimpleAppMain] [RemoteAgentHomeLocatorForBootstrap] Using agent home located at [C:\Users\build\bamboo-agent-home]
INFO | jvm 63 | 2019/09/24 15:13:11 | 2019-09-24 15:13:11,407 INFO [WrapperSimpleAppMain] [RemoteAgentHomeLocatorForBootstrap] Using agent home located at [C:\Users\build\bamboo-agent-home]
INFO | jvm 63 | 2019/09/24 15:13:11 | 2019-09-24 15:13:11,408 INFO [WrapperSimpleAppMain] [AgentUuidInitializer] Found agent UUID '<agent-uuid>' in temporary UUID file 'C:\Users\build\bamboo-agent-home\uuid-temp.properties'
INFO | jvm 63 | 2019/09/24 15:13:11 | 2019-09-24 15:13:11,426 INFO [WrapperSimpleAppMain] [AgentContext] Requesting fingerprint, url: http://<server-ip>/agentServer/GetFingerprint.action?hostName=<agent-address>&version=3&agentUuid=<agent-uuid>
INFO | jvm 63 | 2019/09/24 15:13:11 | 2019-09-24 15:13:11,435 INFO [WrapperSimpleAppMain] [RemoteAgentHttpClientFactory] Creating a new HTTP client...
INFO | jvm 63 | 2019/09/24 15:13:12 | 2019-09-24 15:13:12,197 INFO [WrapperSimpleAppMain] [AgentContext] Authenticating against Bamboo server at http://<server-ip>/agentServer/
INFO | jvm 63 | 2019/09/24 15:13:33 | Exiting due to fatal exception.
INFO | jvm 63 | 2019/09/24 15:13:33 | org.apache.http.conn.HttpHostConnectException: Connect to <server-ip>:80 [/<server-ip>] failed: Connection timed out: connect
INFO | jvm 63 | 2019/09/24 15:13:33 | at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:159)
...
[snip]
...
INFO | jvm 63 | 2019/09/24 15:13:33 | at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
INFO | jvm 63 | 2019/09/24 15:13:33 | at java.lang.Thread.run(Unknown Source)
INFO | jvm 63 | 2019/09/24 15:13:33 | Caused by: java.net.ConnectException: Connection timed out: connect
INFO | jvm 63 | 2019/09/24 15:13:33 | at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
...
[snip]
...
INFO | jvm 63 | 2019/09/24 15:13:33 | at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
INFO | jvm 63 | 2019/09/24 15:13:33 | ... 21 more
INFO | jvm 63 | 2019/09/24 15:13:33 | 2019-09-24 15:13:33,319 FATAL [WrapperSimpleAppMain] [AgentBootstrap] Exiting due to fatal exception.
INFO | jvm 63 | 2019/09/24 15:13:33 | org.apache.http.conn.HttpHostConnectException: Connect to <server-ip>:80 [/<server-ip>] failed: Connection timed out: connect
INFO | jvm 63 | 2019/09/24 15:13:33 | at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:159)
...
[snip]
...
INFO | jvm 63 | 2019/09/24 15:13:33 | at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
INFO | jvm 63 | 2019/09/24 15:13:33 | at java.lang.Thread.run(Unknown Source)
INFO | jvm 63 | 2019/09/24 15:13:33 | Caused by: java.net.ConnectException: Connection timed out: connect
INFO | jvm 63 | 2019/09/24 15:13:33 | at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
...
[snip]
...
INFO | jvm 63 | 2019/09/24 15:13:33 | at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
INFO | jvm 63 | 2019/09/24 15:13:33 | ... 21 more
ERROR | wrapper | 2019/09/24 15:13:33 | JVM exited unexpectedly.


```


Answers:
author: Daniel Santos
body: Hi [@Bobby Tait](/t5/user/viewprofilepage/user-id/1032830)

I can't help you with Azure configuration, but with Bamboo. What I see from your logs is that the Bamboo agent is not getting responses from the server and that is probably happening because your agent is trying to reach the Bamboo server using wrong or unreachable address.

We need to make sure your Bamboo server is reachable from the VM running the agent. I guess you already know that. You can use this page as a reference on troubleshooting: [Troubleshooting Remote Agent - Atlassian Documentationtip/resting](https://confluence.atlassian.com/bamkb/troubleshooting-remote-agents-216957427.html). It has some suggested commands to check the connectivity.  

The same page will talk about the connections needed between the server and agent HTTP and JMS ones. In your case, the HTTP one is failing. Once that is working your agent will try the second one which will involve reaching the Bamboo server broker configured in **\<Bamboo_Home\>/bamboo.cfg.xml**.

Please keep us posted on your findings and possibly other questions, to solve this problem, as your investigation evolves.

comments: author: Bobby Tait
body: Thanks for your reply, [@Daniel Santos](/t5/user/viewprofilepage/user-id/502125); got sidetracked for a couple of days. I have seen that page and attempted some of the steps to no avail. This is my first time administrating a Bamboo server and working with an Azure VM, and was hoping somebody had already made this work. Continuing to dig and experiment.

More specifically, I can ping the server from the agent.

However, I am stuck trying to get it to telnet into it.


author: Daniel Santos
body: Hi [@Bobby Tait](/t5/user/viewprofilepage/user-id/1032830),
> Thanks for your reply, [@Daniel Santos](https://community.atlassian.com/t5/user/viewprofilepage/user-id/502125); got sidetracked for a couple of days.  

That is ok, take your time.  
> I have seen that page and attempted some of the steps to no avail.

=/
> This is my first time administrating a Bamboo server and working with an Azure VM, and was hoping somebody had already made this work. Continuing to dig and experiment.

I can't help with the Azure configuration, unfortunately, but I can help with the troubleshooting.
> More specifically, I can ping the server from the agent.  
> However, I am stuck trying to get it to telnet into it.

From what I can get, the agent is not able to reach the ports of the server, but it can resolve the server. It might be the case that the server firewall is not allowing public access to the HTTP and JMS (broker) ports.


author: Bobby Tait
body: That is my guess, too. My test "server" in this case is my development laptop. I opened the ports up, but still no love. I'm thinking the company firewall is blocking the traffic. IS hasn't gotten back to me yet about that.


author: Daniel Santos
body: I got it! You are on the right track. If your remote agent is not able to reach the server there is no deal. Let's wait for their feedback.


author: Bobby Tait
body: As we thought, IS is very particular about who or what accesses their servers. Holes need to be drilled through our corporate firewall in order for this to work. Thank you for the additional information, Daniel. :)


author: Daniel Santos
body: You are welcome! =\]