Bug 1158228
Summary: | The --agent-preference and --agent-config options for rhqctl install don't work as expected on Windows | ||
---|---|---|---|
Product: | [JBoss] JBoss Operations Network | Reporter: | Michael Burman <miburman> |
Component: | Agent, Installer | Assignee: | John Mazzitelli <mazz> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | Armine Hovsepyan <ahovsepy> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | JON 3.3.0 | CC: | ahovsepy, jshaughn, mfoley, myarboro |
Target Milestone: | CR01 | Keywords: | Regression |
Target Release: | JON 3.3.0 | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: |
Cause: When installing the agent on Windows and where the agent service that gets installed will run as a different user as that user who installed the agent via rhqctl.
Consequence: The agent configuration stored by the installer goes in a different Java Preferences store (since Java Preferences are stored in a user-specific location). In some cases (like when installing a standalone storage node+agent without a local JON Server on the same Windows box) the agent will fail to start and register properly
Fix: Instead of using --agent-preferences command line option to rhqctl, you need to preconfigure a full agent-configuration.xml file (see documentation on preconfiguring the agent for more details). You then pass that preconfigured agent-configuration.xml to "rhqctl install" via the --agent-config command line option.
Result: The agent will ensure to load the preconfigured agent-configuration.xml when it starts up for the first time, thus getting its true configuration settings, which can include remote JON Server endpoint information.
|
Story Points: | --- |
Clone Of: | Environment: | ||
Last Closed: | 2014-12-11 14:04:14 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Michael Burman
2014-10-28 21:23:54 UTC
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 |