Wednesday, November 26, 2008

How to use the upcoming agent download in Jopr + RHQ

Mazz has recently written code that the agent can use to auto-upgrade itself and has blogged about it. This code is in the RHQ trunk - so if you want to try it, you need to install RHQ from source.

This feature is also good for an initial agent install:

Get the agent code from the Jopr server:

$ wget http://pickeldi:7080/agentupdate/download -O agent.jar

Option -O sets the name of the local file which otherwise would be 'download'. Next you need to run the downloaded jar file to extract the agent from it

$  java -jar agent.jar --install
======================================
Wed Nov 26 15:33:14 CET 2008
======================================
[header-for-install] [echo]
===== RHQ AGENT INSTALL =====
Installing Agent To: .
Version: 1.2.0-SNAPSHOT
Build Number: 2125
Jar File: /home/hrupp/agent.jar
[install] [unjar] Expanding: /home/hrupp/agent.jar into /home/hrupp
[install] [unzip] Expanding: /home/hrupp/rhq-enterprise-agent-1.2.0-SNAPSHOT.zip into /home/hrupp
[install] [delete] Deleting: /home/hrupp/rhq-enterprise-agent-1.2.0-SNAPSHOT.zip
[install] [echo] Agent version 1.2.0-SNAPSHOT (build number=2125) has been installed to .
$ ls rhq-agent
bin conf lib plugins
$


Starting java -jar without any other option will show some online help about the available options.

On Unix you still need to set the permissions


$ chmod +x rhq-agent/bin/rhq-agent.sh


Now that this is done, you can start the agent as usual:


$ cd rhq-agent/
$ bin/rhq-agent.sh


Try this feature and give us feedback.

1 comment:

John said...

I have seen the wget command work differently on different platforms. You used -O because your version of wget probably ignored the "Content-Disposition" header that comes back as part of the HTTP headers during the download (that header's value will be set to the real agent jar's filename). I have seen some versions of wget honor this header automatically (so it actually writes the local file as the same name as that which is found on the server - i.e. it will not be "download"). I have seen yet another form of wget that requires you to explicitly tell it to honor that header via the "--content-disposition" option.