OpsCenter API overview
The OpsCenter API facilitates the development of websites and programs to retrieve data and perform DataStax Enterprise (DSE) administrative actions. The OpsCenter API provides the ability to make RESTful requests for programmatically performing the same set of operations as the OpsCenter UI.
OpsCenter API references
-
Authentication describes how to authenticate when users and roles are configured.
-
OpsCenter Configuration covers methods for getting information about clusters, such as seed hosts and the JMX port, adding a new cluster to OpsCenter, updating a cluster, and removing a cluster.
-
Retrieving Cluster and Node Information describes methods for getting more information about clusters, such as the endpoint snitch and partitioner name, information about a particular cluster property, nodes in the cluster, and node properties.
-
Performing Cluster Operations describes methods for performing garbage compaction, flushing memtables, and other administrative actions on nodes and keyspaces.
-
Managing Keyspaces and Tables describes keyspace and table operations, such as creating new keyspaces and tables.
-
Retrieving Metric Data explains how to measure the performance of clusters, nodes, and tables, as well as generate projected forecasts of performance.
-
Managing Events and Alerts documents methods for getting information about events and alerts and setting alert rules.
-
Schedule management describes methods for dealing with scheduled operations. Currently the type of operations that can be scheduled is limited to backups and best practice rules
-
Backup Management and Restoring from Backups describes methods for running backups, getting information about existing backups, and restoring keyspaces and tables from backups.
-
Best Practice Rules describes methods for getting results of best practice rules as well as running individual rules on demand.
-
Hadoop shows how to get information about the current status of the Hadoop infrastructure in your DSE cluster.
-
Spark shows how to get information about the current status of the Spark infrastructure in your DSE cluster.
-
Managing Performance Service Configuration details methods for configuring the Performance Service and showing results from it.
-
User Interface details methods for interacting with various OpsCenter UI components.
-
Agent Install and Status details methods for installing agents, determining agent health and operations on a node.
-
Cluster Lifecycle Management describes how to provision clusters and manage their configurations.
Use the interactive Swagger UI console for the DataStax Agent API.
Explore the console to learn about the agent APIs available for scripting purposes. You can also interact with the endpoints directly with curl commands, as shown in Troubleshoot with the DataStax Agent API.
-
Edit the
address.yamlfile. The location of this file depends on the type of installation:-
Package installations:
/var/lib/datastax-agent/conf/address.yaml -
Tarball installations:
INSTALL_DIRECTORY/conf/address.yaml
-
-
Set the
swagger_enabledoption totrue. -
Navigate to the UI:
http(s)://AGENT_IP:API_PORT/uiUse
httpsorhttpas appropriate for your environment. ReplaceAGENT_IPwith the IP address of the particular agent. Replace theAPI_PORTwith the port configured for your environment. Typically, theAPI_PORTis61621. -
Configure the API port using the
api_portoption inaddress.yamlor[agents]api_port incluster_name.conf.The location of the
cluster_name.conffile depends on the type of installation:-
Package installations:
/etc/opscenter/clusters/cluster_name.conf -
Tarball installations:
INSTALL_DIRECTORY/conf/clusters/cluster_name.conf
-
Troubleshoot with the DataStax Agent API
Use the DataStax Agent API with cURL commands to directly hit an agent for useful information when troubleshooting an issue. Check the size of a diagnostic file before downloading. Determine the root cause of connection issues.
Some useful curl commands:
-
curl "http://agentIP:61621/v1/check-diagnostics-size"before getting diagnostics, which can take a substantial amount of time usingcurl -X GET --header 'Accept: application/json' 'http://localhost:61621/v1/diagnostics'. -
If you see connection-status failed messages in the
opscenterd.log, run the following command to get more details. Pretty print is optional but makes it easier to read the raw output.curl "http://54.152.37.135:61621/v1/connection-status" | json_pp+% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 935 100 935 0 0 3571 0 --:--:-- --:--:-- --:--:-- 3582 { "storage_cassandra" : { "config" : { "storage-keyspace" : "OpsCenter", "storage-port" : 9042, "storage-hosts" : [ "172.31.6.241" ], "storage-cassandra-user" : null, "error" : "Authentication error on host /172.31.6.241:9042: Host /172.31.6.241:9042 requires authentication, but no authenticator found in Cluster configuration" }, "started" : false }, "install-type" : "package", "stomp" : { "started" : true, "config" : { "error" : null, "stomp-interface" : "172.31.0.97", "stomp-port" : 61620, "use-ssl?" : false } }, "monitored_cassandra" : { "config" : { "monitored-cassandra-user" : null, "monitored-hosts" : [ "172.31.6.241" ], "error" : "Authentication error on host /172.31.6.241:9042: Host /172.31.6.241:9042 requires authentication, but no authenticator found in Cluster configuration", "monitored-port" : 9042 }, "started" : false }, "http" : { "config" : { "agent-rpc-interface" : "172.31.6.241", "api-port" : 61621, "use-ssl" : false } }, "jmx" : { "started" : true, "config" : { "jmx-port" : 7199, "error" : null, "jmx-user" : null } } }