Skip to main content
POST
Update datasource

Restrictions

Usage

  • This is a full replace, not a patch: send type_ident, name, edge_cluster_name, payload and (except for Elasticsearch cloud) address on every call. note, address and payload overwrite the stored values, so an omitted note is cleared.
  • Omitting enabled, alerting_enabled, manage_team_id or readonly_team_ids keeps the current value. null for enabled or alerting_enabled is rejected; null for the two team fields clears them.
  • Secrets: for the diagnostic types, omit the password (and the Kafka tls_key) to keep the stored value or send an empty string to clear it. For tencent_cls, an omitted or empty secret_key keeps the stored key. Other types need their credentials resent.
  • Setting enabled or alerting_enabled to false, or changing type_ident or edge_cluster_name, closes open alerts of the rules that use this datasource. Renaming it closes open alerts of rules whose ds_list name pattern no longer matches the new name.
  • Turning alerting_enabled off fails with HTTP 409 UndonedOrderExist while an enabled alert rule still selects the datasource.
  • Only the account owner, Admin members, the creator and members of the managing team can update a datasource (anyone with the permission when no managing team is set); others get AccessDenied. An unknown ID, or one in another account, returns ResourceNotFound.
  • Every call is recorded in the account audit log.

Authorizations

app_key
string
query
required

APP Key created in the Flashduty console under My → APP Key. Send it as the app_key query parameter or in the Fd-App-Key request header. Its effective access is the intersection of the key's permission scope and the creator's current role permissions. Keep it secret.

Body

application/json

Request body for creating or updating a datasource. id is required for update and ignored on create. An update replaces type_ident, name, note, address, payload and edge_cluster_name with the values sent, so resend them all; only enabled, alerting_enabled, manage_team_id and readonly_team_ids keep their current value when omitted. address is required for all types except Elasticsearch with deployment=cloud.

type_ident
enum<string>
required

Datasource type.

Alerting types (can evaluate alert rules):

  • prometheus: Prometheus-compatible metrics.
  • loki: Grafana Loki logs.
  • mysql: MySQL.
  • oracle: Oracle Database.
  • postgres: PostgreSQL.
  • clickhouse: ClickHouse.
  • elasticsearch: Elasticsearch.
  • sls: Alibaba Cloud Simple Log Service.
  • tencent_cls: Tencent Cloud Log Service (CLS).
  • victorialogs: VictoriaLogs.

Diagnostic-only types (cannot evaluate alerts, alerting_enabled is always false):

  • redis_node: a single Redis node.
  • redis_sentinel: Redis Sentinel.
  • mongodb_mongod: a MongoDB mongod instance.
  • mongodb_mongos: a MongoDB mongos router.
  • kafka: a Kafka cluster.

The payload key that holds the type-specific settings has the same name as the type.

Available options:
prometheus,
loki,
mysql,
oracle,
postgres,
clickhouse,
elasticsearch,
sls,
tencent_cls,
victorialogs,
redis_node,
redis_sentinel,
mongodb_mongod,
mongodb_mongos,
kafka
name
string
required

Datasource name; required and unique within the account across all types. This is the name referenced as ds_name in query APIs. Duplicates fail with InvalidParameter.

payload
object
required

Type-specific configuration block; must include the key named by type_ident. An update replaces the whole payload, so resend every setting you want to keep (including credentials of non-diagnostic types, which the info endpoint returns). Exceptions: for the diagnostic types, omit the password (and the Kafka tls_key) to keep the stored value or send an empty string to clear it; for tencent_cls, an omitted or empty secret_key keeps the stored key. Stored secrets are not carried over when type_ident changes. The serialized JSON may not exceed 65,535 bytes.

edge_cluster_name
string
required

Name of the Monitors edge cluster that evaluates rules and runs queries for this datasource. It must be an existing edge cluster of the account, otherwise the call fails with InvalidParameter. Changing it on update closes open alerts of rules that use this datasource.

id
integer<uint64>

Datasource ID. Required for update (an unknown ID, or one in another account, fails with ResourceNotFound); ignored on create.

note
string

Free-text note. On update, an omitted or empty value clears the stored note.

address
string

Connection address, required for every type except elasticsearch with deployment: cloud. At most 4096 characters after normalization. Format by type:

  • prometheus, loki, victorialogs: HTTP URL; http:// is prepended when the value does not start with http.
  • mysql, oracle, postgres: host:port.
  • clickhouse: one or more comma-separated host:port endpoints; duplicates are rejected.
  • elasticsearch with self-managed: one or more comma-separated HTTP(S) URLs (scheme defaults to http://) that share identical query parameters; duplicates are rejected. Not needed for cloud.
  • sls: endpoint without the http:// or https:// prefix.
  • tencent_cls: exactly cls.tencentcloudapi.com or cls.internal.tencentcloudapi.com (requires Monitors edge >= v0.66.0).
  • redis_node, redis_sentinel, mongodb_mongod, mongodb_mongos: a single host:port (bracket IPv6) with no URI, userinfo or query.
  • kafka: 1-32 unique comma-separated host:port bootstrap addresses (the payload has no broker list).
Maximum string length: 4096
enabled
boolean

Whether business execution is enabled. Omitted on create: true; omitted on update: preserve the current value. Explicit false disables execution; null is invalid. Does not change alerting_enabled.

alerting_enabled
boolean

Whether this datasource may evaluate alerts. Omitted on create: true for alerting types, false for diagnostic-only types; omitted on update: preserve current value. null is invalid. redis_node, redis_sentinel, mongodb_mongod, mongodb_mongos and kafka reject true. Disabling is rejected with conflict when enabled rules reference the datasource.

manage_team_id
integer<uint64> | null

ID of the managing team (see the response field of the same name). On create, omitted means no managing team. On update, omitted keeps the current value, while null or 0 clears it. Required whenever readonly_team_ids is non-empty.

readonly_team_ids
integer<uint64>[] | null

IDs of the teams allowed to query and reference the datasource (see the response field of the same name). On create, omitted means unrestricted. On update, omitted keeps the current value, while null or an empty array clears it (everyone can query). Duplicates and 0 are dropped. Requires manage_team_id: a non-empty list without a managing team fails with InvalidParameter.

Response

Success

Success response envelope. On every 2xx response, request_id identifies the call (also mirrored in the Flashcat-Request-Id header) and data holds the endpoint-specific payload. Failure responses use a different shape — see ErrorResponse.

request_id
string
required

Unique ID for this request. Mirrored in the Flashcat-Request-Id response header. Include it when reporting issues.

Example:

"01HK8XQE3Z7JM2NTFQ5YJ8P9R4"

data
object

A monitoring datasource.