...
Get the Datasource ID by Name: Replace the variables (
HOST
,PORT
,USER
,PASS
,DS_NAME
admin
,10.2.7.100
,adminz-password
,80
,hivemq-prometheus-1
) with your actual Grafana details and run the following command:Code Block language bash curl -s -u "admin:adminz-password" "http://10.2.7.100:80/api/datasources/name/hivemq-prometheus-1" | jq '.id'
Expected Output: The command will return the datasource ID as a JSON response. For example:
Code Block language text 11
Error Messages:
Connection Error:
curl: (7) Failed to connect
Invalid Credentials:
{"message": "invalid username or password"}
Unauthorized:
{"message": "Unauthorized"}
List All Datasources: To list all available datasources, use the following command:
Code Block language bash curl -s -u "admin:adminz-password" "http://10.2.7.100:80/api/datasources"
...