Yes you can have more than one agent running on a box. We run tens of agents on a single box during our perf testing. See our source code repo for the "agentspawn" and "agentcopy" scripts for how we do this - etc/agentspawn
Read the wiki for how to use this test stuff here: http://rhq-project.org/display/RHQ/Agent+Performance+Test+Harness
The three things you have to worry about is 1) the "agent name" (the name you register your agent under when connecting to the server - all agent names must be unique) 2) its public endpoint port (the default is 16163, but you can set it to anything that is free on your box - of course, multiple agents must be listening to unique/different ports). 3) the preferences node name - so each agent must be passed a unique -p argument so each agent has its own location for its Java Preferences configuration.. e.g. "-p first" and "-p second". So technically, all you need to do is install two agents in two different directories, when you start each, you pass in a different -p argument value, and when you answer the setup questions, you have to give a unique agent name (the first question that you are asked when the agent starts) and you have to give a unique port number (they can't both be 16163 for example).
The question I have is - why do you want to do this? The only reason why we've needed to do this is to perform performance testing where we need to have many agents running - more agent than we have boxes. Is there some reason why you need to run more than one other than testing?
If you already registered an agent, that agent's name is registered in the server. The only way you can change that agent's registration (that is, the only way you can change the hostname/port associated with that agent) is to purge that agent from the server DB - you do this by uninventorying the platform resource that belongs to the agent and wait for everythign to get purged from the DB. Then the agent name is free to be used again (this was a new feature added, not in any released RHQ version IIRC). You can look in the database, table RHQ_AGENT, and see if the agent is purged or not.
Are you talking abt multiple JOPR agents installtion on a server but with oly one instance?.
What i want is a JOPR agent for every instance running on my machine so that i can monitor it. Also if i can integrate alerts to actions so that i dont manually have to restart when an instance goes down. I m new to this so please let me know it from scratch if there are some scripts or commands to do it.
Please help me with that.
You need to be more specific when you say "for every instance running on my machine" - an "instance" of what? I assume you mean "for every instance OF JBOSS-AS APP SERVER running on my machine".
You only need to install and run one agent per machine, regardless of the number or types of 'resources' or 'managed instances' running on that machine that you want to manage. For example, if you have one or ten JBossAS app servers running on your machine, you only need to run one RHQ Agent to manage them all; similarly, if you have one or more JBossAS app servers _and_ one or more Apache Web Servers running on your machine, again, you only need to run one RHQ Agent to manage them all.
> "Also if i can integrate alerts to actions so that i dont manually have to restart when an instance goes down. I m new to this so please let me know it from scratch if there are some scripts or commands to do it."
See the alerts documentation for how you can do this. I think these pages might help:
Here's the alerts section table of contents:
In addition, our latest beta releases include new alert features we plan on releasing - the alert support will be more robust. There's a few design docs on the alerts stuff:
As John said,
You generally should not need to run multiple Agents on a single machine, though it is possible. The typical RHQ architecture is to have one Agent installed on each machine being managed. You can monitor multiple server instances (even multiple servers of the same kind - eg- JBossAS) using a single Agent.
As far as wiping away traces of an old Agent, I believe you'll need to stop the unwanted Agent and then remove that Agent from the list of Agents registered with the Server. Do this by going to the Administration > High Availablity > Agents item on the menu in the RHQ GUI. Then delete the install dir mof your old Agent and proceed to start and register your new Agent. Mazz, chime in if I'm off here.
I don't think you delete the agent record from the DB directly from Administration > High Availablity > Agents. All you should need to do is shutdown the agent, then go to the resource inventory page and simply uninventory the platform. When you uninventory a platform, it should now also remove the agent record associated with that platform (it wasn't like this in older versions, but it should be working like that now).
Thanx for ur help. i have been inactive for past one week so could not work on it much though.
I have one more query.
I m able to run an agent on windows but i m facing problem running it on linux.
I installed the agent on linux machines(2 of then ill refer to it as mach1 & mach2)
* i was intially able to work on the mach1 agent , create alerts etc. but when i installed another on mach2 i started facing trouble with both the agents
The availability status is '?' for both the agents where as the windows agents are working fine.
Everytime I go to the machine and run rhq-agent.sh I get an error
" Failed to connect.
java.net.BindException: Address already in use"
How do i run the agent now?
Wen i installed a new agent on the machine giving a different agent name and different port i was able to install it and it acknowledged PING. I also imported it from the auto-discovery queuebut again the avaliability status is '?'.
please help me run the agent on linux.
please help me with the solution quickly.
thanx and regards
> java.net.BindException: Address already in use
This error should make the problem obvious - you are probably still running the first agent and the second can't start if you told it to start on the same port as the first (you can't have two processes listening to the same port). Kill the first agent and the second will start. It sounds like you are starting the agents multiple times and either using the same name/port/address as the previous agent but you aren't stopping the previous agent first, or you are installing multiple agents with different names which forces the server to think you have multiple "agents" which isn't want you want.
I'd recommend reading the docs on installing and running the agent, some of the info might be helpful:
Here's information on configuring the communications settings, such as the port, for server-agent communications:
There should be nothing special you have to do running the agent on Windows as compared to Linux. Obviously there are differences (e.g. using the .bat instead of the .sh) but they are basically the same. Those documents I refer to above will tell you how to install and run agents on windows and linux.
Lastly, we can't guarantee how quickly the community can answer (or even if we can answer fully) your questions here on the forums. Many people try to answer, but are often delayed. If you wish to obtain good and timely support, may I recommend obtaining an official support contract from Red Hat - sales at redhat.com
One other thing - make sure your server's public endpoint address is correct (Administration>HighAvailability>Servers) and make sure the agent can always communicate with that server's endpoint address. In addition, make sure your agent's endpoint IP address or hostname is always accessible to the server (i.e. make sure your agent isn't changing its IP due to it releasing its IP via DHCP and re-aquiring a different IP).
In short, the server and agent IP addresses/hostnames must not dynamically change and they must be resolvable and reachable.
This kind of thing is addressed in the wiki documentation that I pointed to in my previous comment.
Thanks for all your help. I really appreciate it.
I apologize for being impatient.
While monitoring different Jboss instances, If one goes down, I need to run it again. How do i do that?
Note : I have different run.sh files for each instance on the machine.
you can define an alert on the jbas instance that detects if it is going down. Then as notification for the alert choose 'resource operation' and then select the jboss as instance and its start operation.
The used run.sh version should already be encoded in the inventories' connection properties.