OpsCenter configuration
Get, create, update, and delete the OpsCenter configuration for monitored clusters. You can also set the OpsCenter and agent log level.
Cluster configuration object
A cluster configuration object is a JSON representation of the .conf file for a given cluster.
These .conf files are named after each cluster, and they are stored in /etc/opscenter/clusters (package installations) or INSTALL_DIRECTORY/path/to/opscenter/conf/clusters (tarball installations).
Each section in the configuration file, such as [cassandra], is represented by a nested JSON object within the cluster configuration object.
The properties for each section are set within the section’s nested object using the appropriate data type structure for each property’s value.
For example, [cassandra] section in the configuration file with properties seed_hosts and api_port would be represented as follows in the cluster configuration object:
{
cassandra: {
seed_hosts: "localhost",
api_port: 7000,
...
},
section: {
property: value,
property: value,
...
},
...
}
A seed_hosts entry is required for all cluster configuration objects.
For all properties, see Cassandra connection properties.
GET /cluster-configs
Retrieve a list of all configured clusters.
Returns a dictionary of cluster IDs (keys) and cluster configuration objects (values).
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, the first cluster’s ID is Test_Cluster, and the second cluster’s ID is Test_Cluster2.
You can rename cluster configuration files to change cluster IDs.
Restart the opscenterd process to apply the new cluster IDs.
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 configuration object.
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
}
}
POST /cluster-configs
Add a new cluster for OpsCenter Monitoring and administration.
Body: A cluster configuration object.
Returns 201 and the ID of the new cluster if successful.
Example:
curl -X POST
http://127.0.0.1:8888/cluster-configs
-d '{
"cassandra": {
"seed_hosts": "localhost"
},
"cassandra_metrics": {},
"jmx": {
"port": "7199"
}
}'
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 cluster configuration object.
Returns 204 response code if the cluster configuration was 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 cluster configuration object.
Returns 204 response code if the cluster configuration was updated successfully.
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.
Returns 204 response code if the cluster was removed successfully.
Example:
curl -X DELETE http://127.0.0.1:8888/cluster-configs/Test_Cluster
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.
Returns 200 response code if the log level was updated successfully on OpsCenter and as many agents as possible.
The response includes updated agents and skipped agents.
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"]
}