Thursday, September 24, 2009

Encounter with JOPR

There is a discussion for Mobicents Media Server 2.x.y Console requirements on

  • whether it should be built using Swing that can be installed on any machine and this stand-alone instance connects with Mobicents Media Server for statistics and configuration
OR
  • use standard JOPR server that almost all Mobicents project is using as de-facto and write agent that will monitor media server.

In quest to understand what exactly is JOPR I decided to write a custom plugin for JOPR and see how it can monitor any resource's that we want.

I started with blog from Heiko and this was very useful. Thank you JOPR guys for such a niece blog! After reading all 5 Part's I decided to give it a try.

Started with SVN check-out of JOPR from http://svn.rhq-project.org/repos/rhq/trunk to my local directory /jopr/src/

Since JOPR is also using maven, building JOPR was not nightmare. However JOPR by default requires the access to Postgres database and it wasn't easy for me to install Postgres and get it running :( I wish JOPR uses in-memory HSQLDB initially and latter on give an option to go for Postgres, Oracle, My-Sql or any DB that user may want to use in production. This will make the development very fast.

The wiki explaining the build of JOPR is given at http://support.rhq-project.org/display/RHQ/Building+RHQ

Once you have JOPR built and installed and have Postgres up and running, you need to develop a custom plugin as explained in Part3 of blog.

Assuming that custom plugin is built and ready, next step is start the server

  1. cd to /jopr/src/trunk/modules/enterprise/server/container/target/rhq-server-1.3.0-SNAPSHOT/bin and call ./rhq-server.sh start
  2. Go to http://localhost:7080/ to see the JOPR console. Login as user rhqadmin and password rhqadmin
  3. Still we haven't started the Agent. So next cd to /jopr/src/trunk/modules/enterprise/agent/target/rhq-agent/bin and ./rhq-agent.sh -l. This will configure the Agent and ask few simple questions. For almost all of them the default answers are rigtht. Bellow is from my comandline showing what reply I provided


    RHQ 1.3.0-SNAPSHOT [4925] (Thu Aug 20 13:44:46 GMT+05:30 2009)
    Answer the following questions to setup this RHQ Agent instance.
    - After each prompt, a default value will appear in square brackets.
    If you press the ENTER key without providing any value,
    the new preference value will be set to that default value.
    - If you wish to rely on the system internal default value and
    not define any preference value, enter '!*'.
    - If you wish to stop before finishing all the questions but still
    retain those preferences you already set, enter '!+'.
    - If you wish to cancel before finishing all the questions and revert
    all preferences back to their original values, enter '!-'.
    - If you need help for a particular preference, enter '!?'.

    Agent Name [localhost] : postgres_agent
    Agent Hostname or IP Address [!*] :
    Agent Port [16163] :
    RHQ Server Hostname or IP Address [127.0.0.1] :
    RHQ Server Port [7080] :
    The setup has been completed for the preferences at node [/rhq-agent/default].



    Next from client CLI I executed command 'plugins' just to refresh the plugins from server.

  4. Now go to http://localhost:7080/ Click on Dashboard - Auto-Discovery and you should see entry of the 'postgres_agent' agent. Import this Agent and now all the statistics including the custom plugin that we developed will be available to JOPR Server and we can monitor the stats. Below is the Screen shot showing the Response Time metrics exposed by our custom plugin.


So far so good. The conclusion is Agent needs to be installed on Mobicents Media Server that we need to monitor and Agent communicate to server Via JBoss Remoting. I am still learning what is the communication protocol and what is the load on client machine where Agent is installed due to agent activity. Remember Mobicents Media Server cannot take any heavy load else Jitter will kill all the performance.

Its now clear that we can expose the statistics using JOPR. Next I want to write a Agent that talks to MMS via MGCP protocol to avoid installing Agent at MMS side and expose some real statistics. Also one of the requirements of MMS Console is configuring the media-path at run-time with easy drag-and-drop feature from console. I still don't know if this is possible via JOPR Agent? And if yes can it be remote or needs to be in same JVM as Mobicents Media Server?

May be I will ask the JOPR experts to help me out with this dilemma.


Till then enjoy the JOPR :)

4 comments:

Heiko W. Rupp said...

Actually since Jopr 2.2(?) - in any case since 2.3 we have support for an embedded H2 database, so at least for demo, testing and development, you don't need a postgres database anymore. H2 is not for production though.

amit.bhayani said...

Thanks Heiko for clarifying things. Actually yes I see that in JOPR 2.3 binary, I can start with embedded HSQL DB. However while building source from SVN, it still looks for real database, or am I missing something?

amit.bhayani said...

This guide gives an overview of how to install the Postgres DB for JOPR

https://www.redhat.com/docs/en-US/JBoss_ON/2.3/html/Installation_Guide/Installation_Guide-Database-PostgreSQL_Quick_Start_Installation.html

Heiko W. Rupp said...

The database choice when building from source depends on the ~/.m2/settings.xml that is default for -Pdev (dev - profile section).