Skip to content

Instantly share code, notes, and snippets.

@andrewbaptist
Last active October 16, 2023 20:29
Show Gist options
  • Save andrewbaptist/89fb7e8e122dfbb49084f7c386014787 to your computer and use it in GitHub Desktop.
Save andrewbaptist/89fb7e8e122dfbb49084f7c386014787 to your computer and use it in GitHub Desktop.
Create graph
echo "graph { ranksep=1 "
cd nodes; for x in * ; do echo "$x -- { "; grep -h "231010 16:40.*unable to connect to" $x/logs/* | grep -o "unable to connect to n[0-9]*" | grep -o '[0-9]*$' | sort | uniq ; echo "}" ; done ; cd ..
cat nodes.json | jq '.nodes[] | select(.updated_at > '`date -v-7d +%s`000000000').desc | {id: .node_id, locality: .locality.tiers[]} | select (.locality.key == "region") | {id: .id, region: .locality.value}' | jq -c -s -r 'group_by(.region)[] | {cluster: (.[0].region), label: (.[0].region), value:[.[] | .id]}' | sed -e 's/"//g' -e 's/{cluster:/subgraph cluster_/' -e 's/,label:/{label=/' -e 's/,value:\[/ /' -e 's/\]//'
echo "}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment