Difference between revisions of "Jolokia LoginCounter HOWTO"

(Created page with "= HOWTO - Access Login Counter with Jolokia = This article describes how to access information exposed through JMX by Open-Xchange with the Jolokia JMX-to-HTTP bridge, using...")
 
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= HOWTO - Access Login Counter with Jolokia =  
+
{{Migration|title=HOWTO - Access Login Counter data with Jolokia|link=https://documentation.open-xchange.com/7.10.0/middleware/components/monitoring/login_counter_howto.html}}
 
 
This article describes how to access information exposed through JMX by Open-Xchange with the Jolokia JMX-to-HTTP bridge, using "Login Counter" as an example.
 
 
 
== Install Open-Xchange ==
 
 
 
See http://oxpedia.org/wiki/index.php?title=AppSuite:Main_Page_AppSuite#quickinstall if you don't have Open-Xchange installed yet. Jolokia is part of the base product, no extra packages are needed.
 
 
 
== Enable Jolokia ==
 
 
 
(See also https://oxpedia.org/wiki/index.php?title=Jolokia)
 
 
 
In <code>etc/jolokia.properties</code>, enable Jolokia by setting the following properties:
 
 
 
  com.openexchange.jolokia.start = true
 
  com.openexchange.jolokia.user = youruser
 
  com.openexchange.jolokia.password = yourpassword
 
 
 
Jolokia will not be enabled when no user/password is set.
 
 
 
You can optionally adjust this setting:
 
 
 
  com.openexchange.jolokia.servlet.name = /monitoring/jolokia
 
 
 
If you do, you need to adjust the examples below as well.
 
 
 
== Allow access from other hosts ==
 
 
 
This is an optional step, if you want to access the Jolokia interface from other hosts than localhost. This may be very helpful during the development phase of a project. Please be aware that this interface exposes lots of "interesting" data, so if you remove the restriction to localhost, you need to ensure by other means (network setup, firewalls, web server configuration, ...) that no unauthorised access is possible on production systems.
 
 
 
In <code>etc/jolokia.properties</code>, set:
 
 
 
  com.openexchange.jolokia.restrict.to.localhost = false
 
 
 
In your web server configuration, enable access to the jolokia servlet. For Apache this is possible by adding a ProxyPass directive for each OX host in the cluster:
 
 
 
  ProxyPass /monitoring/ox1/jolokia http://ox1-ip:8009/monitoring/jolokia
 
  ProxyPass /monitoring/ox2/jolokia http://ox2-ip:8009/monitoring/jolokia
 
  ...
 
 
On a default installation as described by our installation guides, this would be in <code>proxy_http.conf</code>.
 
 
 
Reload your apache config and restart open-xchange for the changes to take effect.
 
 
 
== Access the Jolokia interface ==
 
 
 
On localhost, call:
 
 
 
  $ curl http://yourname:yourpassword@localhost:8009/monitoring/jolokia/list > ox.json
 
 
If you enabled access from other hosts, you can also use a standard web browser. Open
 
 
 
  http://<yourserver>/monitoring/jolokia/list
 
 
You'll be asked for user name and password through a standard HTTP auth window.
 
 
 
== Access specific information ==
 
 
 
The ox.json file you received in the last step gives you a complete documentation what data is available through this interface.
 
 
 
As an example, the "Login Counter" interface (which is also used by the [http://oxpedia.org/wiki/index.php?title=AppSuite:Logincounter logincounter command line tool]) is described like this:
 
 
 
<pre>"com.openexchange.reporting": {
 
"name=Login Counter": {
 
"desc": "Information on the management interface of the MBean",
 
"op": {
 
"getLastLoginTimeStamp": {
 
"ret":"java.util.List",
 
"desc":"Operation exposed for management",
 
"args": [
 
{"desc":"","name":"p1","type":"int"},
 
{"desc":"","name":"p2","type":"int"},
 
{"desc":"","name":"p3","type":"java.lang.String"}
 
]
 
},
 
"getNumberOfLogins": {
 
"ret":"java.util.Map",
 
"desc":"Operation exposed for management",
 
"args": [
 
{"desc":"","name":"p1","type":"java.util.Date"},
 
{"desc":"","name":"p2","type":"java.util.Date"},
 
{"desc":"","name":"p3","type":"boolean"},
 
{"desc":"","name":"p4","type":"java.lang.String"}
 
]
 
}
 
}
 
}
 
}</pre>
 
 
 
 
 
See http://www.jolokia.org/reference/html/protocol.html for detailed documentation how to use the Jolokia interface, especially http://www.jolokia.org/reference/html/protocol.html#serialization for the list of datatypes that can be passed as arguments and received in return values.
 
 
 
To know what the parameters <code>p1</code>, <code>p2</code>, etc. mean, you need to look at the source code. (See http://oxpedia.org/wiki/index.php?title=SourceCodeAccess for information how to download it.)
 
 
 
In the example above, to get the number of logins in a specific timeframe and with a specific client, we need to call the method getNumberOfLogins with the parameters startDate, endDate, aggregate and clientstring. They correspond to the command line parameters to the logincounter tool as described on:
 
 
 
  http://oxpedia.org/wiki/index.php?title=AppSuite:Logincounter
 
 
 
In curl this call would look like this:
 
 
 
  $ curl http://yourname:yourpassword@localhost:8009/monitoring/jolokia/exec/com.openexchange.reporting:name=Login%20Counter/getNumberOfLogins/2015-01-01T00:00:00/2015-01-31T23:59:59/true/open-xchange-appsuite/
 
 
If you have enabled access to the Jolokia interface from other hosts, the same information can be viewed in any web browser:
 
 
 
http://<yourserver>/monitoring/jolokia/exec/com.openexchange.reporting:name=Login%20Counter/getNumberOfLogins/2015-01-01T00:00:00/2015-01-31T23:59:59/true/open-xchange-appsuite/
 

Latest revision as of 11:09, 29 October 2018

HOWTO - Access Login Counter data with Jolokia

The content on this page has moved to https://documentation.open-xchange.com/7.10.0/middleware/components/monitoring/login_counter_howto.html.

Note: Open-Xchange is in the process of migrating all its technical documentation to a new and improved documentation system (https://documentation.open-xchange.com). Please note as the migration takes place more information will be available on the new system and less on this system. Thank you for your understanding during this period of transition.