I'm trying to get a very simple example of pushing Graphite metrics to Grafana Cloud using their HTTP API to work.
This example comes straight from the Graphite HTTP API documentation:
user_id=<USER_ID>
api_key=<API_KEY>
url=https://<SERVER_INSTANCE>.grafana.net/graphite/metrics
timestamp_now_rounded=$(($(date +%s) / 10 * 10))
timestamp_prev_rounded=$((timestamp_now_rounded - 10))
curl -X POST -H "Authorization: Bearer $user_id:$api_key" -H "Content-Type: application/json" "$url" -d '[{
"name": "test.metric.tagged",
"interval": 10,
"value": 2,
"tags": ["foo=bar", "baz=quux"],
"time": '$timestamp_now_rounded'
}]'
When I run this script I get:
{"status":"error","error":"authentication error: invalid authentication credentials"}
I am not sure which credentials to use. I have already tried creating a service account and a cloud access policy with write permissions, and none of the credentials seem to work.
To use the Graphite HTTP API, you need to:
User ID
Access Policyunder the Security section in the left sidebar.With this user id and api key, you can make curl requests to your Grafana Cloud instance. You can then visualize the metrics by creating a dashboard connected to the
grafanacloud-<ORG_NAME>-graphitedata source.References: