Skip to content

Instantly share code, notes, and snippets.

@garethahealy
Last active December 30, 2016 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garethahealy/0f46aad5d2da41b82aad5af317fad788 to your computer and use it in GitHub Desktop.
Save garethahealy/0f46aad5d2da41b82aad5af317fad788 to your computer and use it in GitHub Desktop.
query-group-test
#!/usr/bin/env bash
wget https://gist.githubusercontent.com/garethahealy/3a156efbebb1a28eb468cafc552cbe4e/raw/397b4c2b6fe73b69252c36a3aa57943acb1462c6/create-prometheus_test.json
wget https://gist.githubusercontent.com/garethahealy/76e6042598ed1b67dba67090616dd854/raw/5ce1ea83bdbc2bab9460d345e36a0c0ae6fec09d/create-datapoints.json
wget https://gist.githubusercontent.com/garethahealy/6c616d4e2c066724790752f47872c3d9/raw/3278d404d19a86b3a8fefcb2b689ceef423f845f/query-param.json
wget https://gist.githubusercontent.com/garethahealy/a3b6df2c580a443dc5c833ddd0cd3c21/raw/667a2f3d0e9683ea9d0b36ae5dcc7c39630f5b26/query-param-with-group.json
HAWKULAR_TENANT="unit-testing"
HAWKULAR_URL="http://192.168.99.100:8080/hawkular/metrics"
METRIC_ID="prometheus_test"
echo "create $METRIC_ID"
cat create-prometheus_test.json | curl -vvv -X POST -u admin:admin -H "Content-Type: application/json" -H "Hawkular-Tenant: $HAWKULAR_TENANT" $HAWKULAR_URL/counters?overwrite=true -d @-
echo "create $METRIC_ID datapoints"
cat create-datapoints.json | curl -vvv -X POST -u admin:admin -H "Content-Type: application/json" -H "Hawkular-Tenant: $HAWKULAR_TENANT" $HAWKULAR_URL/counters/$METRIC_ID/raw -d @-
echo "get $METRIC_ID datapoints to check they were imported with tags"
curl -vvv -X GET -u admin:admin -H "Content-Type: application/json" -H "Hawkular-Tenant: $HAWKULAR_TENANT" $HAWKULAR_URL/counters/$METRIC_ID/raw
echo "use query endpoint"
cat query-param.json | curl -vvv -X POST -u admin:admin -H "Content-Type: application/json" -H "Hawkular-Tenant: $HAWKULAR_TENANT" $HAWKULAR_URL/counters/raw/query -d @-
echo "use query endpoint with group"
cat query-param-with-group.json | curl -vvv -X POST -u admin:admin -H "Content-Type: application/json" -H "Hawkular-Tenant: $HAWKULAR_TENANT" $HAWKULAR_URL/counters/raw/query -d @-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment