12 Replies Latest reply on Jan 3, 2011 7:10 AM by Heiko Rupp

    Can i create more than one agent on one server

    shravan babu Newbie

      Hi,

       

      People please help me with this.

       

      Can i have more than one agent running on one linux server?. If yes, HOW?

       

      what are the valid agent port and server port addresses i can give other than the default ones (16163 and 7080)

       

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

      2.

           i m facing trouble configuring the an agent on a linux machine where i had already created an agent and deleted it.

      please tell me which all files other than the folder in which the agent was installed will i have to clear so that i can start with fresh installation( -cleanconfig, -setup, -purge(-u)  does not seem to work)

        • 1. Re: Can i create more than one agent on one server
          mazz Master

          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.

          • 2. Re: Can i create more than one agent on one server
            shravan babu Newbie

            Hi John,

             

            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.

             

            Thanx.

            • 3. Re: Can i create more than one agent on one server
              mazz Master

              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:

               

              http://www.redhat.com/docs/en-US/JBoss_ON/2.3/html/Feature_Guide/sect-Feature_Guide-Alerts-Integrations.html

               

              Here's the alerts section table of contents:

               

              http://www.redhat.com/docs/en-US/JBoss_ON/2.3/html/Feature_Guide/chap-Feature_Guide-Alerts.html

               

              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:

               

              http://rhq-project.org/display/RHQ/Design+-+Alerts

              • 4. Re: Can i create more than one agent on one server
                Ian Springer Master

                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.

                 

                -Ian

                • 5. Re: Can i create more than one agent on one server
                  mazz Master

                  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).

                  • 6. Re: Can i create more than one agent on one server
                    shravan babu Newbie

                    Hi john,

                     

                    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.

                     

                     

                    thanx

                    • 7. Re: Can i create more than one agent on one server
                      shravan babu Newbie

                      Hi john,

                       

                      please help me with the solution quickly.

                       

                       

                      thanx and regards

                      • 8. Re: Can i create more than one agent on one server
                        mazz Master

                        > 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:

                         

                        http://rhq-project.org/display/JOPR2/RHQ+Agent+Installation

                         

                        http://rhq-project.org/display/JOPR2/Running+the+RHQ+Agent

                         

                        Here's information on configuring the communications settings, such as the port, for server-agent communications:

                         

                        http://rhq-project.org/display/JOPR2/Communications+Configuration

                         

                        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

                        • 9. Re: Can i create more than one agent on one server
                          mazz Master

                          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.

                          • 10. Re: Can i create more than one agent on one server
                            shravan babu Newbie

                            Hi John,

                             

                            Thanks for all your help. I really appreciate it.

                            I apologize for being impatient.

                             

                            Regards

                            • 11. Re: Can i create more than one agent on one server
                              shravan babu Newbie

                              Hi Team,

                               

                              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. 

                               

                              Regards

                              Salil

                              • 12. Re: Can i create more than one agent on one server
                                Heiko Rupp Master

                                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.