Skip to content

Instantly share code, notes, and snippets.

@glennklockwood
Last active October 21, 2021 23:27
Show Gist options
  • Save glennklockwood/f61f52ed6062e6393804b6f37760c974 to your computer and use it in GitHub Desktop.
Save glennklockwood/f61f52ed6062e6393804b6f37760c974 to your computer and use it in GitHub Desktop.
Demonstrate accessing ESnet's SNMP GraphQL service
#!/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
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment