Last active
October 21, 2021 23:27
-
-
Save glennklockwood/f61f52ed6062e6393804b6f37760c974 to your computer and use it in GitHub Desktop.
Demonstrate accessing ESnet's SNMP GraphQL service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
CSRF_TOK=$(curl --verbose -D - https://my.es.net/ 2>/dev/null | grep -o 'csrftoken=[^;]*' | cut -d= -f2) | |
echo "CSRF token = [$CSRF_TOK]" | |
curl \ | |
--referer https://my.es.net/nersc-400g \ | |
-X POST \ | |
-b "csrftoken=$CSRF_TOK" \ | |
-H "X-CSRFToken: $CSRF_TOK" \ | |
-H "Content-Type: application/json" \ | |
-H "Accept: application/json" \ | |
--data '{"query":"{ mapTopology(name: \"nersc-400g\"){ paths { traffic(beginTime: \"2019-04-01T00:00:00.000Z\", endTime: \"2019-04-01T01:00:00.000Z\") } } }"}' \ | |
https://my.es.net/graphql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment