Searching MBeans (search)
With the Jolokia search operation the agent can be queried for
MBeans matching a given pattern. Searching will be performed on every
MBeanServer
found by the agent.
GET search request
The format of the search GET URL is:
<base-url>/search/<pattern>
This mode is used to query for certain MBean. It takes a single
argument pattern
for
specifying the search parameter like in
http://localhost:8080/jolokia/search/*:j2eeType=Servlet,*
You can use patterns as described
here,
i.e. it may contain wildcards like *
and
?
. The Mbean names matching the query
are returned as a list within the response.
POST search request
A search POST request knows the following keys:
Key | Description | Example |
---|---|---|
|
|
|
|
The MBean pattern to search for |
|
The following request searches for all MBeans registered in the
domain java.lang
{
"type": "search",
"mbean": "java.lang:*"
}
Search response
The answer is a list of MBean names which matches the pattern or an empty list if there was no match.
For example, the request
http://localhost:8888/jolokia/search/*:j2eeType=Servlet,*
{
"request": {
"mbean": "*:j2eeType=Servlet,*",
"type": "search"
},
"value": [
"Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/manager,j2eeType=Servlet,name=Status",
"Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/manager,j2eeType=Servlet,name=JMXProxy",
"Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/manager,j2eeType=Servlet,name=jsp",
"Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/manager,j2eeType=Servlet,name=HTMLManager",
"Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/jolokia,j2eeType=Servlet,name=jsp",
"Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/,j2eeType=Servlet,name=default",
"Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/jolokia,j2eeType=Servlet,name=jolokia-agent",
"Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/,j2eeType=Servlet,name=jsp",
"Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/jolokia,j2eeType=Servlet,name=default",
"Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/manager,j2eeType=Servlet,name=Manager",
"Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/manager,j2eeType=Servlet,name=default"
],
"status": 200,
"timestamp": 1702458409
}
The returned MBean names are properly quoted so that they can be directly used as input for other requests.