grafana-util docs

grafana-util-datasource-modify.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-modify - Modify one live Grafana datasource through the Grafana API.

SYNOPSIS

grafana-util datasource modify [OPTIONS]

DESCRIPTION

Modify one live Grafana datasource through the Grafana API.

Use this when a datasource already exists and you need to update its URL, auth, JSON payload, or other live settings.

BEFORE / AFTER

  • Before: updating a live datasource usually meant editing a blob of JSON or clicking through multiple UI tabs.
  • After: one command can preview the exact live update and keep the change reviewable before it lands.

COMMON OPTIONS

--uid
datasource UID to modify.
--set-url
replace the datasource URL.
--set-access
replace the datasource access mode.
--set-default
set or clear the default datasource flag.
--basic-auth, --basic-auth-user, --basic-auth-password
update basic auth settings.
--user, --password, --with-credentials, --http-header
update supported request settings.
--tls-skip-verify, --server-name
update TLS-related settings.
--json-data, --secure-json-data, --secure-json-data-placeholders, --secret-values
update structured fields and secrets.
--dry-run, --table, --json, --output-format, --no-header
preview output controls.

SUCCESS CRITERIA

  • the UID identifies the intended datasource before the mutation starts
  • --dry-run shows the new URL, auth, or JSON fields you expect
  • default flags and secret updates are visible before the live change

FAILURE CHECKS

  • if the preview touches the wrong datasource, confirm the UID before retrying
  • if auth or TLS changes are incomplete, compare the previewed payload against the current live settings first
  • if a secret field does not resolve, check the placeholder mapping or the chosen profile defaults

EXAMPLES

Modify one live Grafana datasource through the Grafana API.

grafana-util datasource modify --url http://localhost:3000 --basic-user admin --basic-password admin --uid prom-main --set-url http://prometheus-v2:9090 --dry-run --json

SEE ALSO

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