Accessing cluster information using the REST API
This functionality allows users to access information about the Impact server and cluster through the REST interface.
Users must possess the impactAdminUser
role to access the
REST interface.
The following examples demonstrate its usage with the curl command line tool.
Request the host of the acting Impact primary
To request the host of the acting primary, send a GET
request to any cluster
member:
curl -u <USERNAME>:<PASSWORD> -k https://<HOST>:<PORT>/restui/serverinfo/primaryserverhost
Where:
USERNAME
is the name of the Impact user, such as
impactadmin
.
PASSWORD
is the Impact user's password.
HOST
is the hostname or IP address of the Impact server.
PORT
is the backend port for the Impact server. The default
port is 9081
.
Example
curl -u impactadmin:password -k https://impacthost:9081/restui/serverinfo/primaryserverhost
If the request succeeded, the host of the acting primary is returned in a JSON string:
{"primaryserverhost":"server1.example.com"}
Request the server name of the acting Impact primary
To request the server name of the acting primary, send a GET
request to a
cluster member:
curl -u <USERNAME>:<PASSWORD> -k https://<HOST>:<PORT>/restui/serverinfo/primaryservername
Example
curl -u impactadmin:password -k https://impacthost:9081/restui/serverinfo/primaryservername
If the request succeeded, the server name of the acting primary is returned in a JSON string:
{"primaryservername":"NCI_0"}
Request the list of active secondary servers
To request the list of active secondary servers, send a GET
request to the
acting primary:
curl -u <USERNAME>:<PASSWORD> -k https://<HOST>:<PORT>/restui/serverinfo/secondaryservers
Example
curl -u impactadmin:password -k https://impacthost:9081/restui/serverinfo/secondaryservers
If the request succeeded, a list of acting secondary server names is returned:
{"items":["NCI_1"]}
An empty list will be returned, if there are no active secondary servers or the request wasn't sent to the acting primary:
{"items":[]}
Request JVM memory usage
To request the current memory usage or total memory available to the Java runtime, send a
GET
request to any cluster member:
curl -u <USERNAME>:<PASSWORD> -k https://<HOST>:<PORT>/restui/serverinfo/<SERVERNAME>/memoryusage
curl -u <USERNAME>:<PASSWORD> -k https://<HOST>:<PORT>/restui/serverinfo/<SERVERNAME>/totalmemory
Where:
USERNAME
is the name of the Impact user, such as
impactadmin
.
PASSWORD
is the Impact user's password.
HOST
is the hostname or IP address of the Impact server.
PORT
is the backend port for the Impact server. The default
port is 9081
.
SERVERNAME
is the name of the Impact server, such as
NCI
.
Examples
Returns the current JVM memory usage in bytes of the acting primary:
curl -u impactadmin:password -k https://impacthost:9081/restui/serverinfo/NCI/memoryusage
{"totalmemory":158834984}
Returns the total JVM memory in bytes of the acting primary:
curl -u impactadmin:password -k https://impacthost:9081/restui/serverinfo/NCI/totalmemory
{"totalmemory":2516582400}
Check whether the server is the acting primary
To check whether the current server is the acting primary
and preferred primary, send a GET
request:
curl -u <USERNAME>:<PASSWORD> -k https://<HOST>:<PORT>/restui/serverinfo/isprimary
Example
curl -u impactadmin:password -k https://impacthost:9081/restui/serverinfo/isprimary
If the request succeeded, a JSON message is returned:
{"isPrimary":true,"isPreferredPrimary":false}
Get the server name, cluster name and secondary servers
To get the server name, cluster name, acting primary and
registered secondary servers, send a GET
request:
curl -u <USERNAME>:<PASSWORD> -k https://<HOST>:<PORT>/restui/serverinfo/clustername
Example
curl -u impactadmin:password -k https://impacthost:9081/restui/serverinfo/clustername
If the request succeeded, a JSON message is returned:
{"clusterMemberName":"NCI_0","clusterName":"NCICLUSTER","activeClusterMembers":["NCI_1"],"primaryClusterName":"NCI_0"}
The list of secondary servers, activeClusterMembers is only populated for the acting primary. This list will be empty when querying a secondary server.
Get the Impact version
To retrieve the Impact version, send a GET
request to /restui/serverinfo/version
.
curl -u <USERNAME>:<PASSWORD> -k https://<HOST>:<PORT>/restui/serverinfo/version
Example
curl -u impactadmin:password -k https://impacthost:9081/restui/serverinfo/version
If the request succeeded, a JSON
message is returned:
{"patch":31,"buildlevel":"202307121259v71031b1234","r":1,"v":7,"vrmp":"7.1.0.31","m":0,"vrmpMax":"7.1.0.31"}