grafana-util docs

grafana-util-datasource-add.1

Browser-readable rendering of a generated roff manpage.

This page renders the generated roff manpage into readable HTML for browser use. For richer per-subcommand detail, prefer the command-reference pages.

NAME

grafana-util-datasource-add - Create one live Grafana datasource through the Grafana API.

SYNOPSIS

grafana-util datasource add [OPTIONS]

DESCRIPTION

Create one live Grafana datasource through the Grafana API.

Use this when you want to create a new datasource directly, or dry-run the create step before applying it.

BEFORE / AFTER

  • Before: datasource creation often lived in UI clicks or hand-written API payloads.
  • After: one command can scaffold the create payload, preview it, and show the exact fields you are about to send.

COMMON OPTIONS

--uid
stable datasource identity.
--name
datasource name.
--type
Grafana datasource plugin type id.
--datasource-url
datasource target URL.
--access
proxy or direct access mode.
--default
mark as the default datasource.
--preset-profile and --apply-supported-defaults
scaffold supported defaults.
--json-data, --secure-json-data, --secure-json-data-placeholders, --secret-values
configure custom fields and secrets.
--dry-run, --table, --json, --output-format, --no-header
preview output controls.

SUCCESS CRITERIA

  • the type id and URL are explicit before the live create
  • --dry-run shows the payload shape you expect
  • secret placeholders and defaults are resolved the same way every time

FAILURE CHECKS

  • if the create preview looks wrong, confirm the type id and datasource URL before going live
  • if a secret field remains unresolved, check whether --secret-values or the chosen preset profile is complete
  • if the live create fails, compare the preview payload against the datasource rules for that plugin type

EXAMPLES

Create one live Grafana datasource through the Grafana API.

grafana-util datasource add --url http://localhost:3000 --basic-user admin --basic-password admin --name prometheus-main --type prometheus --datasource-url http://prometheus:9090 --dry-run --table

SEE ALSO

grafana-util(1), grafana-util-datasource(1)