Skip to main content
POST
Create datasource

Restrictions

Usage

  • type_ident must be one of: prometheus, loki, mysql, oracle, postgres, clickhouse, elasticsearch, sls, tencent_cls, victorialogs, redis_node, redis_sentinel, mongodb_mongod, mongodb_mongos, kafka. The last five (redis_node, redis_sentinel, mongodb_mongod, mongodb_mongos, kafka) are diagnostic-only: they cannot evaluate alerts, so alerting_enabled must not be true.
  • name must be unique within the account across all types; a duplicate fails with InvalidParameter.
  • edge_cluster_name must be an existing Monitors edge cluster of the account; that cluster evaluates rules and runs queries for the datasource.
  • Put the type-specific settings in payload.<type_ident>. For elasticsearch, payload.elasticsearch.deployment is required (cloud or self-managed). tencent_cls requires every edge instance in the cluster to run Monitors edge v0.66.0 or later.
  • Omitted enabled defaults to true; omitted alerting_enabled defaults to true for alerting types and false for diagnostic-only types. Explicit null for either is rejected.
  • manage_team_id and readonly_team_ids restrict who can manage or query the datasource; omit both to leave it open to every member.
  • Responses return credentials of non-diagnostic types (for example Prometheus Basic Auth passwords) as stored. Diagnostic passwords and Kafka private keys are returned only when they are ${env:NAME} references. Treat responses as sensitive.
  • 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.