Use JConsole to Monitor and Manage Governance Registry
Now it is possible to use JMX Console to monitor and manage Governance Registry since it can now be represented as a MBean object. Currently users are able to perform a selective set of operations (services) over Governance Registry and can monitor corresponding results. The set of registry services that can be managed are defined in the registry.xml
. The topics discussed below explain how to setup JConsole and manage Governance Registry.Â
Setup JConsole with Governance RegistryÂ
Enable JMX for Governance Registry as given in the page Configuration for JMX Support .
Â
The same configuration defines the services which are exposed through JMX.
<jmx enabled="true"> <service name="InvocationStatistics" enabled="true"/> <service name="Activities" enabled="true"/> <service name="Properties" enabled="true"/> <service name="Subscriptions" enabled="true"/> <service name="Events" enabled="true"/> </jmx>
- Start the server by running sh wso2serever.sh fromÂ
$GREG_HOME/bin
.
 - On a different console run the command
jconsole
to start the JMX Console.Â
Â
- After running this command a startup screen would be prompted which illustrates a list of currently running processes in the machine. Select the correct Carbon process by the process ID and click the connect button at bottom.Â
- After connecting to the Carbon process a new console would get prompted which is the Management and Monitoring console of the selected Carbon process.
 - Select the MBeans tab of the Management console, and you would be able to see the MBean object of the
org.wso2.carbon/Registry
on the right hand side panel.
- In the panel under Registry the related services are listed and the corresponding attributes and the operations are also illustrated.Â
Managing Activities using JConsoleÂ
-
Activites>Attributes>List
will prompt all the activites happened on a registry by any user.Â
-
Activites>Operations>getActivitesForUser
 will give all the activities performed by a given user. The user name should be given as the P1 parameter, and then click the button with the operation name to invoke the operation.
and results would be illustrated as given below.Â
Activites>Operations>getActivitesForPath
 will give all the activities that has been performed on a given path. The resource path should be given as the P1 parameter, and then click the button with the operation name to invoke the operation.
when the parameter was set asÂ/_system/config/repository/transportsÂ
following were the results illustrated.Â
Managing Events using JConsole
Events>Attributes>List
 will prompt all the JMX related events happened on registry by any user. A JMX related event can occur when a resource is subscribed to JMX type events.Â
Events>Operations>clearAll
 will clear all the JMX related events received and will clear the list underÂEvents>Attributes>List
.Â
Managing Invocation Statistics using JConsoleÂ
InvocationStatistics>Attributes>InvokeMethods
will list the invoked methods of statistics enabled admin services by any user.Â
-
InvocationStatistics>Operations>getInvocationCounts
will give the number of occassions an admin service method has been invoked. The P1 parameter should be the name of the invoked method of the service in the same format as given in the above list.Â
Managing Properties using JConsoleÂ
Properties>Operations>setProperty
can be used to add properties to a given resource. In this method invocation parameters would be as below,- P1 - resource path
- P2 - property name
- P3 - property value
If the method invoked successfully then a "Method successfully invoked" message will be prompted, and then the user can check the added property on the resource from UI.
-
Properties>Operations>getProperty
can be used to retrieve a property. In this method invocation parameters would be as below,- P1 - resource path
- P2 - property name
this method returns the value of the given property, and once the method is invoked the result will be displayed as below.
-
Properties>Operations>getProperties
can be used to retrieve all the properties of a given resource. In this method invocation parameters would be as below,- P1 - resource path
this method invocation would result all the properties (as key, value pairs) on the given resource as below.
-
Properties>Operations>removeProperty
can be used to remove a given property from a given resource. For this method invocation parameters would be as below,- P1 - resource path
- P2 - property name
If the method invoked successfully then a "Method successfully invoked" message will be prompted as given below.
Managing Subscriptions using JConsole
Subscriptions>Attributes>List
would list all the subscriptions added in the registry by any user.
Subscriptions>Attributes>EventNames
 would list all the available Event type names. Event types define possible events that can occur by different resource operations.
-
Subscriptions>Operations>subscribe
operation is used to add any type of subscription to any defined resource. For this method invocation parameters would be as below,P1 - Subscription endpoint (E.g. - For email the endpoint should be given asÂ
mailto:<<email address>>,
For  JMX subscriptions endpoint should beÂjmx://Â
and valid endpoints for SOAP and REST subscriptions ).- P2 - Is the subscription endpoint a REST endpoint (true/false)
- P3 - The path of the resource where the subscription is going to get added to.Â
- P4- Event type (E.g. - ResourceUpdated, ChildCreated and etc.)
To get an idea about Event types, please refer this page .
the invocation of this method would return the ID of the added subscription as given below.
Â
- Subscriptions>Operations>unsubscribe operation is used to remove an already existing subscription in the registry. For this method invocation parameters would be as below,
- P1 - ID of the subscription to be removed
If the method invoked successfully then a "Method successfully invoked" message will be prompted as given below.
- P1 - ID of the subscription to be removed
Â