Bug 727558

Summary: [agent] Unable to specify alternative port for RHQ server
Product: [Other] RHQ Project Reporter: Lukas Krejci <lkrejci>
Component: AgentAssignee: RHQ Project Maintainer <rhq-maint>
Status: CLOSED NOTABUG QA Contact: Mike Foley <mfoley>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 4.1CC: hrupp
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-08-02 14:21:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 725459    

Description Lukas Krejci 2011-08-02 13:05:12 UTC
Description of problem:

$> bin/rhq-agent.sh --cleanconfig --purgedata -p brand-new-and-unused
RHQ 4.1.0-SNAPSHOT [b3eb971] (Mon Aug 01 21:40:33 CEST 2011)
Answer the following questions to setup this RHQ Agent instance.
- After each prompt, a default value will appear in square brackets.
  If you press the ENTER key without providing any value,
  the new preference value will be set to that default value.
- If you wish to rely on the system internal default value and
  not define any preference value, enter '!*'.
- If you wish to stop before finishing all the questions but still
  retain those preferences you already set, enter '!+'.
- If you wish to cancel before finishing all the questions and revert
  all preferences back to their original values, enter '!-'.
- If you need help for a particular preference, enter '!?'.

Agent Name [localhost.localdomain] : 
Agent Hostname or IP Address [!*] : 
Agent Port [16163] : 16164
RHQ Server Hostname or IP Address [127.0.0.1] : 
RHQ Server Port [7080] : 7085
The setup has been completed for the preferences at node [/rhq-agent/brand-new-and-unused].
!!! This agent is registering under the loopback address [socket://127.0.0.1:16164/?rhq.communications.connector.rhqtype=agent&numAcceptThreads=1&maxPoolSize=303&clientMaxPoolSize=304&socketTimeout=60000&enableTcpNoDelay=true&backlog=200] - this should only be done for testing or demo purposes - this agent will only be able to interact with a server running on the same host as this agent

!!! There are [1] servers that are potentially unreachable by this agent.
Please double check all public endpoints of your servers and ensure
they are all reachable by this agent. The failed server endpoints are:
[localhost.localdomain:7080/7443]
See the Administration > High Availability > Servers in the server GUI
to change the public endpoint of a server.
THIS AGENT WILL WAIT UNTIL ONE OF ITS SERVERS BECOMES REACHABLE!


---------------------------------------------------

Note that the server listening on 7085 actually DOES get registration requests:

15:02:44,634 WARN  [CoreServerServiceImpl] An agent [localhost.localdomain] has registered with a loopback address. This should only be done for testing or demo purposes - this agent can only ever interact with this server. AgentRegistrationRequest: [name=[localhost.localdomain]; address=[127.0.0.1]; port=[16164]; remote-endpoint=[socket://127.0.0.1:16164/?rhq.communications.connector.rhqtype=agent&numAcceptThreads=1&maxPoolSize=303&clientMaxPoolSize=304&socketTimeout=60000&enableTcpNoDelay=true&backlog=200]; regenerate-token=[false]; original-token=[<was null>]; agent-version=[4.1.0-SNAPSHOT(b3eb971)]
15:02:44,634 INFO  [CoreServerServiceImpl] Got agent registration request for existing agent: localhost.localdomain[127.0.0.1:16164][4.1.0-SNAPSHOT(b3eb971)] - Will not regenerate a new token

Version-Release number of selected component (if applicable):
4.1.0-SNAPSHOT

How reproducible:
always

Steps to Reproduce:
1. Reconfigure RHQ server to use different ports in rhq-server.properties file.
2. Try to configure agent to use the modified port number
  
Actual results:
Agent never registers

Expected results:
Agent registered successfully

Additional info:

Comment 1 Lukas Krejci 2011-08-02 14:21:20 UTC
PEBCAK :(

The server listening on port 7085 was not configured properly. Its baseUrl was set to http://localhost:7080. Changing that to a proper value (http://localhost:7085) fixed this issue.