Show last authors
1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
4
5 There are various solutions you can use to monitor a running XWiki instance:
6
7 * Install and configure [[Glowroot>>https://glowroot.org]]
8 * Install and configure [[JavaMelody>>https://github.com/javamelody/javamelody/wiki]]
9 * [[Use a Profiler>>dev:Community.Profiling]]. This has the advantage of providing advanced information, but has the drawback of being resource intensive and thus slowing the XWiki instance. It also requires a special startup script.
10 * Starting with XWiki 2.4M2 we're now using the [[JMX Technology>>http://en.wikipedia.org/wiki/Java_Management_Extensions]] to provide runtime monitoring of XWiki instances. The following features are currently available:
11 ** Monitor the Velocity macro caches
12 ** Monitor the JBossCache caches XWiki is using to cache Document data, Users & Groups data and more
13 ** (starting with XE 3.1) Monitor the JGroups channel and protocols (when the XWiki Cluster feature is turned on)
14 ** (starting with XE 3.1) Monitor the Logback Logging configuration and change it
15
16 {{info}}
17 XWiki also has a [[Monitor Plugin>>Documentation.AdminGuide.Logging||anchor="HActivatingtheXWikiMonitoringfeature"]] that you can use to monitor execution times. However this plugin is going to be deprecated in the future and replaced by the JMX technology.
18 {{/info}}
19
20 = Glowroot =
21
22 {{image reference="glowroot.png" width="650px"/}}
23
24 There is nothing specific about XWiki when you install Glowroot, just follow [[the standard documentation>>https://github.com/glowroot/glowroot/wiki/Agent-Installation-%28with-Embedded-Collector%29]].
25
26 = JavaMelody =
27
28 [[[[image:https://raw.githubusercontent.com/wiki/javamelody/javamelody/resources/screenshots/graphs.png||width="50%"]]>>https://github.com/javamelody/javamelody/wiki/Screenshots#charts||style="width:50%"]]
29
30 To install JavaMelody for XWiki follow these steps (see the [[JavaMelody user guide>>https://github.com/javamelody/javamelody/wiki/UserGuide]] for more details):
31
32 * Download the latest [[javamelody.jar>>https://github.com/javamelody/javamelody/releases]] and [[jrobin-x.jar>>https://github.com/javamelody/javamelody/releases/download/javamelody-core-1.49.0/jrobin-1.5.9.jar]] and put them in the ##WEB-INF/lib## folder
33 * Edit ##web.xml## and add the following information:(((
34 {{code}}
35 ...
36 <filter>
37 <filter-name>monitoring</filter-name>
38 <filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
39 </filter>
40 <!-- to enable BASIC authentication with username and password, but do no want to use a realm and "security-constraint"
41 The storage files of statistics and of graphs are stored in the temporary directory of the server, unless if you have defined the "storage-directory" path
42 <filter>
43 <filter-name>javamelody</filter-name>
44 <filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
45 <init-param>
46 <param-name>authorized-users</param-name>
47 <param-value>user1:pwd1, user2:pwd2</param-value>
48 </init-param>
49 <init-param>
50 <param-name>storage-directory</param-name>
51 <param-value>/path/of/javamelody/stats</param-value>
52 </init-param>
53 </filter> -->
54 ... other <filter>s from the default web.xml here ...
55
56 <filter-mapping>
57 <filter-name>monitoring</filter-name>
58 <url-pattern>/*</url-pattern>
59 </filter-mapping>
60 ... other <filter-mapping>s from the default web.xml here ...
61
62 <listener>
63 <listener-class>net.bull.javamelody.SessionListener</listener-class>
64 </listener>
65 ... other <listener>s from the default web.xml here ...
66 ...
67 {{/code}}
68 )))
69 * Edit ##hibernate.cfg.xml## and add:(((
70 {{code}}
71 <property name="jdbc.factory_class">net.bull.javamelody.HibernateBatcherFactory</property>
72 {{/code}}
73 )))
74
75 Then restart XWiki and access JavaMelody at ##http:~/~/localhost:8080/xwiki/monitoring##.
76
77 {{warning}}
78 Recent versions of JavaMelody (at least 1.70+ ?) require the configuration in this guide to be adapted like this:
79
80 {{code}}
81 in web.xml:
82 -----------
83
84 <filter>
85 <filter-name>javamelody</filter-name>
86 <filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
87 <async-supported>true</async-supported>
88 </filter>
89 <filter-mapping>
90 <filter-name>javamelody</filter-name>
91 <url-pattern>/*</url-pattern>
92 <dispatcher>REQUEST</dispatcher>
93 <dispatcher>ASYNC</dispatcher>
94 </filter-mapping>
95 <listener>
96 <listener-class>net.bull.javamelody.SessionListener</listener-class>
97 </listener>
98
99
100
101 in hibernate.cfg.xml:
102 ---------------------
103
104 <property name="connection.driver_class">net.bull.javamelody.JdbcDriver</property>
105 <property name="connection.driver">com.mysql.jdbc.Driver</property>
106 {{/code}}
107 {{/warning}}
108
109 = JMX Console =
110
111 Since JMX is a standard you can use [[any JMX-compatible monitoring console>>http://stackoverflow.com/questions/1744900/what-is-the-best-or-most-commonly-used-jmx-console-client]] (most application servers provide a web-based JMX console). There's also a console called [[JConsole>>http://docs.oracle.com/javase/7/docs/technotes/guides/management/jconsole.html]] which is bundled by default in the Java Runtime you're using. To start it, simply execute the ##jconsole## executable.
112
113 {{info}}
114 Note that starting with XWiki 6.3, if you're using the Standalone Distribution (which bundles Jetty) you can now use ##start_xwiki.sh -j## (or ##start_xwiki.sh ~-~-jmx##) to monitor/manage the Jetty instance itself (it adds Jetty-specific MBeans):
115
116 {{image reference="jettymbeans.png"/}}
117 {{/info}}
118
119 == XWiki Caches Monitoring ==
120
121 XWiki can use different cache implementations. The JBoss Cache and JBoss Infinispan implementations have nice JMX features available as shown below.
122
123 Starting with XWiki 3.3 the default implementation is JBoss Infinispan.
124
125 === With JBoss Infinispan ===
126
127 Since JBoss Infinispan natively supports JMX we benefit from this feature directly (JBoss documentation available [[here>>https://docs.jboss.org/author/display/ISPN/Management+Tooling]]).
128
129 {{info}}
130 Prior to XWiki 3.5 the JMX support was not enabled by default. To enable it, edit ##WEB-INF/cache/infinispan/config.xml## and uncomment the two places where the "jmx" string is mentioned
131 {{/info}}
132
133 Example showing the cache list and some statistic for a given cache:
134
135 {{image reference="infinispancache.png"/}}
136
137 Example showing how to clear a given cache from all its entries:
138
139 {{image reference="infinispancacheclearing.png"/}}
140
141 === With JBoss Cache ===
142
143 Since JBoss Cache natively supports JMX we benefit from this feature directly (JBoss documentation available [[here>>https://access.redhat.com/knowledge/docs/en-US/JBoss_Enterprise_Web_Platform/5/html/JBoss_Cache_User_Guide/jmx_reference.html]]).
144
145 Example showing all JBoss Caches in memory in a running instance, showing all the elements in the cache (example on the document cache):
146
147 {{image reference="jbosscache.png"/}}
148
149 Example showing Cache stats (for the document cache):
150
151 {{image reference="jbosscache-stats.png"/}}
152
153 == Velocity Cache Monitoring ==
154
155 Velocity caches Velocity macros. XWiki offers a JMX view of the content of the Velocity caches.
156
157 JConsole examples showing the Velocity Cache monitoring:
158
159 {{image reference="jconsole1.png"/}}
160
161 {{image reference="jconsole2.png"/}}
162
163 == JGroups Monitoring ==
164
165 JConsole example showing the JGroups monitoring:
166
167 {{image reference="jgroups.png"/}}
168
169 Interesting things to do on JGroups in the JMX console:
170
171 * Change the log level on the protocols to enable logging
172 * Disconnect a node from the cluster and reconnect it
173
174 == Logback Monitoring ==
175
176 JConsole example showing how to modify the logging level for a category:
177
178 {{image reference="jmx-logging.png"/}}
179
180 = Tomcat JMX Proxy Servlet =
181
182 Tomcat has a JMX Proxy Servlet bundled in their ##manager## webapp (see [[here>>http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html]] and [[here>>http://tomcat.apache.org/tomcat-6.0-doc/monitoring.html]] for more details on Tomcat and JMX]].
183
184 Here's some useful URLs to use the JMX Servlet Proxy to list and set JGroups Protocol Levels:
185
186 * To display the current log level for the TCPPING protocol: {{{http://localhost:8080/manager/jmxproxy?qry=jgroups:type=protocol,cluster=event,protocol=TCPPING}}}
187 * To set the log level to ##info## for the TCPPING protocol: {{{http://localhost:8080/manager/jmxproxy?set=jgroups:type=protocol,cluster=event,protocol=TCPPING&att=Level&val=info}}}
188
189 = Others =
190
191 * It's possible to [[write a Groovy script in a wiki page to access the JMX MBeans>>snippets:Extension.JMX Access]].
192 * [[JMX Monitoring Application>>extensions:Extension.JMX Monitoring Application]]
193 * [[XInit>>extensions:Extension.Xinit]]

Get Connected