OpsCenter Configuration

The OpsCenter API exposes REST interfaces that allow you to retrieve, create, update, and delete cluster configurations used by OpsCenter. The configurations sent or received are in JSON format.

The `JSON `configuration used by the API has the following format:

{
  section name: {
      property name: property value,
      property name: property value,
      ...
  },
  ...
}

See the Cassandra connection properties for a complete list of settings.

You can manage the OpsCenter configuration for monitored clusters using these HTTP methods:

OpsCenter Configuration Management Methods URL

List configuration information for all clusters.

GET /cluster-configs

List configuration information for a cluster.

GET /cluster-configs/{cluster_id}

Add a new cluster to OpsCenter.

POST /cluster-configs

Update a cluster configuration.

PUT /cluster-configs/{cluster_id}

Update part of a cluster configuration.

PUT /cluster-configs/{cluster_id}/partial

Remove a cluster from OpsCenter management.

DELETE /cluster-configs/{cluster_id}

Update logging level

PUT /{cluster_id}/log/level/{log_level}

Getting Existing OpsCenter Cluster Configurations

GET /cluster-configs

Retrieve a list of all configured clusters.

Returns a dictionary of cluster id (key), ClusterConfig objects (value). Each cluster configuration includes a seed_hosts entry (required).

The set of configured clusters is defined by the set of <cluster>.conf files in the clusters directory:

  • Packages installs: /etc/opscenter/clusters

  • Tarball installs: /path/to/opscenter/conf/clusters

The cluster ID is based on the name of the configuration file, excluding the .conf extension. Because OpsCenter can manage multiple clusters and these clusters may have the same name defined in cassandra.yaml, cluster IDs (and filenames) must be unique. As a result, the name of this file is typically auto-generated based on the name of the cluster, but might not match the cluster name verbatim. Non-alphanumeric characters in the cluster name are replaced with an underscore in the filename/cluster_id. If two clusters with the same name are configured in OpsCenter, a counter is automatically appended to the cluster ID.

For example, a cluster whose name is defined as "Test Cluster" in cassandra.yaml (the default), has a cluster ID of Test_Cluster and filename of Test_Cluster.conf. If two clusters are configured in OpsCenter with the same name, such as Test Cluster, the first cluster has Test_Cluster` as its cluster ID and the second cluster has Test_Cluster2 as its cluster ID.

Users can rename the cluster configuration files however they choose. Restarting the opscenterd process reflects the updated cluster IDs.

Cluster Config

A Cluster Config object is a JSON representation of the <cluster>.conf configuration file for a single cluster. <section-name> corresponds to sections in the configuration file denoted by square braces (for example [cassandra]). <prop-name> and <prop-value> correspond to properties specified in these sections, to the left and right of the = sign respectively.

{
  <section-name>: {
    <prop-name>: <prop-value>,
      ...
  },
    ...
}

Example:

curl http://127.0.0.1:8888/cluster-configs

Output:

{
  "Test_Cluster": {
    "cassandra": {
      "seed_hosts": "localhost"
    },
    "jmx": {
      "port": 7199
    }
  },
  "Test_Cluster2": {
    "cassandra" {
      "seed_hosts": "2.3.4.5, 2.3.4.6",
      "api_port": 9160
    },
    "jmx": {
      "port": 7199,
      "username": "jmx_user",
      "password": "jmx_pass"
    }
  }
}

GET /cluster-configs/{cluster_id}

Retrieve the configuration for a single cluster.

Path arguments: cluster_id: The ID of a cluster returned from GET /cluster-configs.

Returns a Cluster Config.

Example:

curl http://127.0.0.1:8888/cluster-configs/Test_Cluster

Output:

{
  "agents": {},
  "cassandra": {
    "seed_hosts": "1.2.3.4, 1.2.3.5"
  },
  "cassandra_metrics": {},
  "jmx": {
    "port": 7199
  }
}

Adding, Updating, and Removing Configured Clusters

POST /cluster-configs

Add a new cluster for OpsCenter monitoring and administration.

Body: A configuration in the format of cluster-config. A seed_hosts entry is required.

Responses: 201: Cluster was added successfully.

Returns the ID of the new cluster.

Example:

curl -X POST
  http://127.0.0.1:8888/cluster-configs
  -d '{
    "cassandra": {
      "seed_hosts": "localhost"
    },
    "cassandra_metrics": {},
    "jmx": {
      "port": "7199"
    }
      }'

Output:

"Test_Cluster"

PUT /cluster-configs/{cluster_id}

Update a cluster configuration.

Path arguments: cluster_id: The ID of a cluster returned from get-cluster-configs. Body: A configuration in the same format as cluster-config. A seed_hosts entry is required. Responses: 204: Cluster updated successfully

Example:

curl -X PUT
  http://127.0.0.1:8888/cluster-configs/Test_Cluster
  -d '{
    "cassandra": {
      "seed_hosts": "192.168.1.1, 192.168.1.2"
    },
    "jmx": {
      "port": "7199"
    }
  }'

PUT /cluster-configs/{cluster_id}/partial

Update a cluster configuration with a partial config block. After a successful update of the cluster configuration, OpsCenter restarts all connections to the cluster.

Path arguments: cluster_id: The ID of a cluster returned from get-cluster-configs. Body: A subset of the configuration options in the same format as cluster-config. Responses: 204: Cluster configuration successfully updated

Example:

curl -X PUT
  http://127.0.0.1:8888/cluster-configs/Test_Cluster/partial
  -d '{
    "cassandra_metrics": {
      "ignored_keyspaces": "system, system_traces, system_auth, dse_auth"
    }
  }'

DELETE /cluster-configs/{cluster_id}

Remove a cluster from the list of those to be managed and monitored by OpsCenter.

Path arguments: cluster_id: The ID of a cluster returned from GET /cluster-configs.

Responses: 204: Cluster removed successfully

Example:

curl -X DELETE http://127.0.0.1:8888/cluster-configs/Test_Cluster

Updating OpsCenter and Agent Log Level

PUT /{cluster_id}/log/level/{log_level}

Dynamically update the logging level used in OpsCenter and in all of the OpsCenter agents.

Path arguments: * cluster_id: The ID of a cluster returned from get-cluster-configs. * log_level: A string for the new target log level. Valid values include debug, info, warn, error.

Responses: 200: Log level was updated on OpsCenter and on as many agents as possible. The response includes agents that were updated and those that were skipped.

Example:

curl -X PUT http://127.0.0.1:8888/Test_Cluster/log/level/debug

Output:

 {"updated": ["192.168.1.1", "192.168.1.2"],
 "skipped": ["192.168.1.3"]}

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com