Using the curl command to access the Elasticsearch MBean

You can use the curl command to query the Elasticsearch service MBean attributes that are in read-only mode.

Querying all the MBean attributes for the Elasticsearch service

All the remotely accessible MBean attributes for the Elasticsearch Service are returned by the REST API endpoint: GET /IBMJMXConnectorREST/mbeans/{MBean objectName}/attributes. The corresponding curl command to access this endpoint is:
curl –X GET -s -u user:password -k 'https://hostname:port/IBMJMXConnectorREST/mbeans/com.ibm.bpm.federation.server%3Aname%3DElasticSearchService%2Ctype%3DElasticSearch/attributes’
  • user is the user name, and password is the password of a Liberty user that has an administrative role.
  • hostname is the Process Federation Server hostname.
  • port is the HTTPS port.
This command returns the MBean attributes for the retriever as an array of JSON objects such as::
[
{"name": attributeName1,"value":{"value":attributeValue1,"type":attributeType1}},
{"name": attributeName2,"value":{"value":attributeValue2,"type": attributeType2}},
 …
]
This command returns an exception encapsulated in a JSON object when:
  • the MBean is not yet registered on Process Federation Server.
  • the federated system ID refers to a federated system that does not exist, or that is not running.

Querying a specific MBean attribute for the Elasticsearch service

The value of a specific MBean attribute for the Elasticsearch Service is returned by the REST API endpoint: GET /IBMJMXConnectorREST/mbeans/{MBean objectName}/attributes/{attributeName}. The corresponding curl command to access this endpoint is:
curl –X GET -s -u user:password -k 'https://hostname:port/IBMJMXConnectorREST/mbeans/com.ibm.bpm.federation.server%3Aname%3DElasticSearchService%2Ctype%3DElasticSearch/attributes/attributeName
  • user is the user name, and password is the password of a Liberty user that has an administrative role.
  • hostname is the Process Federation Server hostname.
  • port is the HTTPS port.
  • attributeName is a valid attribute that is remotely accessible by the Elasticsearch service MBean.
This command returns the MBean attributes for the indexer as a JSON object such as::
{"value": attributeValue,"type": attributeType}
Example
curl –X GET -s -u uid=admin,o=defaultWIMFileBasedRealm:admin -k 'https://pfsHost.com:9443 /IBMJMXConnectorREST/mbeans/com.ibm.bpm.federation.server%3Aname%3DElasticSearchService%2Ctype%3DElasticSearch/attributes/serviceState'
{"value":"RUNNING","type":"java.lang.String"}
Note: The attribute name is case sensitive.
This command returns an exception encapsulated in a JSON object when:
  • the MBean is not yet registered on Process Federation Server.
  • the attribute name does not exist