Description of problem: In Windows, JON/RHQ are run as Services and are installed by default as such. Services on the other hand are by default run with the "Local system account", which is non-user account and different from the installer's account. This means for example that when we want to install additional storage node, we will give for example the following parameter: --agent-preference="rhq.agent.server.bind-address=0.0.0.0" This parameter is stored to the JavaPrefs (in the registry), but under the installer's user, which is not used to run the agent itself. This will end up with failure like this: 2014-10-28 20:45:21,574 INFO [WrapperSimpleAppMain] (org.rhq.enterprise.agent.AgentMain)- {AgentMain.no-auto-detect}Server auto-detection is not enabled - starting the poller immediately And the agent will most likely not find anything. Version-Release number of selected component (if applicable): JON 3.3.0.ER05 & current master. How reproducible: Always. Steps to Reproduce: 1. Install additional storage node with --agent-preference 2. rhqctl start 3. Actual results: Agent will never connect to the server. Expected results: Agent would use the given parameters. Additional info:
It is only a default that the windows service is installed to run as the system default user. It can be installed as different user with the RUN_AS or RUN_AS_ME settings. This could be one workaround assuming the user doing the install was also the user under which the service was running. Other than that, I'm not sure how to get the command line pref set in the correct java preferences. Could you just use the --agent-config option instead?
I clarified the title of this. So any scenario where agent is started as a service will not work with any configuration mode. So these options: - Downloading only the rhq-agent.jar and installing it. The configuration entered will not be taken into account once the agent is started with wrapper that installed it on Windows. - Any rhqctl installation (including additional storage nodes or other reasons to use rhqctl) The only installation which will work out of the box is installing JON server on Windows. But no Windows machine can be monitored without manual tinkering.
I re-clarified the summary for the BZ to hopefully be more specific. The issue being that using either of: 'rhqctl install --agent-preference <pref>' 'rhqctl install --agent-config <config-file>' will apply the settings to the registry settings of the user executing the rhqctl command, and not necessarily to the user running the installed service. So, the only way this will work, currently, as far as I know, is if the RHQ_SERVER_RUN_AS_ME=true property has been set prior to the install command. This will install the service to run as the current user. In that case all of the preferences will be set correctly. Another possible workaround, I think, would be to not use those options on the 'rhqctl install' command line. And later, after the install has been performed and the agent is started, use the agent prompt commands ['config' and 'setconfig'] to update the config settings as needed. Other options or fixes will need to be investigated.
I think this will help: https://github.com/rhq-project/rhq/commit/438e10b42c4d8725637eb4582b0a7d072b040ee2 now you can preconfigure an agent config xml with, say, remote server endpoint info and pass it in via rhqctl install --agent-config.
(In reply to John Mazzitelli from comment #6) > I think this will help: > > https://github.com/rhq-project/rhq/commit/ > 438e10b42c4d8725637eb4582b0a7d072b040ee2 > > now you can preconfigure an agent config xml with, say, remote server > endpoint info and pass it in via rhqctl install --agent-config. jay cherry-picked: https://github.com/rhq-project/rhq/commit/65f745fc70ae63045476ba8e0cd641cda1000677
OK, here's the deal. Because we have multiple users here (user A running the installer and user B running the agent), the installer can't do what it wants in some cases - it can't alter user B's Java preferences. Under most cases, no one cares because the installer should be run by the user who will run the agent. But in some cases, this doesn't happen on Windows - and in this case you can't use things like the --agent-preference option in rhqctl. So what we can do now with the code just committed is ask that the Windows user preconfigure an agent-configuration.xml (this would allow him to put the remote server address and port in the .xml, for example) and then pass it to the installer via rhqctl install --agent-config /my/custom/agent-configuration.xml There is a new feature in the agent - if you put a file called "agent-configuration.xml.reload" in the /conf directory, the agent will do a one-time reload of the agent-configuration.xml file at startup. It will then delete that .reload file. The rhqctl installer will create this .reload file for you in the newly installed agent and will put your preconfigured agent-configuration.xml in the conf/ directory. So even if you have old preferences (or no preferences at all) it doesn't matter - your preconfigured agent .xml will get loaded thanks to the reload marker file. The reload marker file has the same effect as if you passed in "-c agent-configuration.xml" to the agent command line.
So, I believe there are three ways to get around this Windows install issue: 1) Install using RUN_AS_ME and use --agent-preference This will run the service as the same user executing rhqctl, so the command line --agent-preference settings will apply. 2) Install using --agent-config <custom-agent-configuration.xml> Without RUN_AS_ME the user executing rhqctl will be different that the user running the service. But with the latest change the custom configuration file will be applied on the first startup of the agent. 3) Update the agent config post-install Without RUN_AS_ME the user executing rhqctl will be different that the user running the service. Without --agent-config the installed agent will have default configuration. After installation the agent config can be updated using the agent prompt commands (or direct manipulation of the registry - not recommended).
Moving to ON_QA as available to test with latest brew build: https://brewweb.devel.redhat.com//buildinfo?buildID=396547
Scenario 1: rhqctl install using pre-configued rhq-server-env.sh with set RHQ_AGENT_RUN_AS_ME=true set RHQ_AGENT_PASSWORD=PASSWORD_OF_CURRENT_USER (Administrator in my case) Scenario 2: rhqctl install --agent-config PATH_TO_AGENT_CONFIGURATION.xml Scenario 3: rhqctl install (without any config) rhq-agent.bat -L rhqctl start OR rhq-agent-wrapper.bat start All 3 scenarios worked, agent connected to server (both remote and local) Thank you for docs and hints, Jay. verified in JON 3.3 CR01