Debian Codegraph @

src/docbkx/protocol/search.xml

raw
1 <?xml version="1.0" encoding="utf-8"?>
2 <!--
3 ~ Copyright 2009-2013 Roland Huss
4 ~
5 ~ Licensed under the Apache License, Version 2.0 (the "License");
6 ~ you may not use this file except in compliance with the License.
7 ~ You may obtain a copy of the License at
8 ~
9 ~ http://www.apache.org/licenses/LICENSE-2.0
10 ~
11 ~ Unless required by applicable law or agreed to in writing, software
12 ~ distributed under the License is distributed on an "AS IS" BASIS,
13 ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ~ See the License for the specific language governing permissions and
15 ~ limitations under the License.
16 -->
17
18 <section id="search">
19 <title>Searching MBeans (search)</title>
20 <para>
21 With the Jolokia search operation the agent can be queried for
22 MBeans with a given pattern. Searching will be performed on every
23 <classname>MBeanServer</classname> found by the agent.
24 </para>
25 <section id="get-search">
26 <title>GET search request</title>
27 <para>
28 The format of the search GET URL is:
29 </para>
30 <synopsis><![CDATA[<base-url>/search/<pattern>]]></synopsis>
31 <para>
32 This mode is used to query for certain MBean. It takes a single
33 argument <literal>pattern</literal> for
34 specifying the search parameter like in
35 <synopsis><![CDATA[http://localhost:8080/jolokia/search/*:j2eeType=J2EEServer,*]]></synopsis>
36 </para>
37 <para>
38 You can use patterns as described <ulink
39 url="http://java.sun.com/j2se/1.5.0/docs/api/javax/management/ObjectName.html">here</ulink>,
40 i.e. it may contain wildcards like <literal>*</literal> and
41 <literal>?</literal>. The Mbean names matching the query
42 are returned as a list within the response.
43 </para>
44 </section>
45
46 <section id="post-search">
47 <title>POST search request</title>
48 <para>
49 A search POST request knows the following keys:
50 </para>
51 <table>
52 <title>POST Search Request</title>
53 <thead>
54 <tr>
55 <td>Key</td>
56 <td>Description</td>
57 <td>Example</td>
58 </tr>
59 </thead>
60 <tr>
61 <td><constant>type</constant></td>
62 <td><emphasis role="bold">search</emphasis></td>
63 <td/>
64 </tr>
65 <tr>
66 <td><constant>mbean</constant></td>
67 <td>The MBean pattern to search for</td>
68 <td><literal>java.lang:*</literal></td>
69 </tr>
70 </table>
71 <para>
72 The following request searches for all MBeans registered in the
73 domain <literal>java.lang</literal>
74 </para>
75 <programlisting><![CDATA[
76 {
77 "type":"SEARCH",
78 "mbean":"java.lang:*"
79 }]]></programlisting>
80 </section>
81
82 <section id="response-search">
83 <title>Search response</title>
84 <para>
85 The answer is a list of MBean names which matches the pattern or an empty
86 list if there was no match.
87 </para>
88 <para>
89 For example, the request
90 <informalexample>
91 <literallayout class="monospaced">http://localhost:8888/jolokia/search/*:j2eeType=J2EEServer,*</literallayout>
92 </informalexample>
93 results in
94 <programlisting><![CDATA[
95 {
96 "value": [
97 "jboss.management.local:j2eeType=J2EEServer,name=Local"
98 ],
99 "status":200,
100 "timestamp":1245305648,
101 "request": {
102 "mbean":"*:j2eeType=J2EEServer,*","type":"search"
103 }
104 }]]></programlisting>
105 </para>
106 <para>
107 The returned MBean names are properly <ulink
108 url="http://download.oracle.com/javase/1.5.0/docs/api/javax/management/ObjectName.html">quoted</ulink>
109 so that they can be directly used as
110 input for other requests.
111 </para>
112 </section>
113 </section>