Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Get the Datasource ID by Name: Replace the variables (HOST, PORT, USER, PASS, DS_NAMEadmin, 10.2.7.100, adminz-password, 80, hivemq-prometheus-1) with your actual Grafana details and run the following command:

    Code Block
    languagebash
    curl -s -u "admin:adminz-password" "http://10.2.7.100:80/api/datasources/name/hivemq-prometheus-1" | jq '.id'
  2. Expected Output: The command will return the datasource ID as a JSON response. For example:

    Code Block
    languagetext
    11
  3. Error Messages:

    • Connection Error: curl: (7) Failed to connect

    • Invalid Credentials: {"message": "invalid username or password"}

    • Unauthorized: {"message": "Unauthorized"}

  4. List All Datasources: To list all available datasources, use the following command:

    Code Block
    languagebash
    curl -s -u "admin:adminz-password" "http://10.2.7.100:80/api/datasources"

...