-
-
Save swissrouting/111d4a615d670ddf8d11eaa8a60eacca to your computer and use it in GitHub Desktop.
Shell script that sends a health check ping to the Amboss API
This file contains 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
#!/bin/bash | |
# Sends a health check ping to the Amboss API. | |
# Docs: https://docs.amboss.space/api/monitoring/health-checks | |
URL="https://api.amboss.space/graphql" | |
NOW=$(date -u +%Y-%m-%dT%H:%M:%S%z) | |
echo "Timestamp: ${NOW}" | |
SIGNATURE=$(lightning-cli signmessage "$NOW" | jq -r .zbase) | |
echo "Signature: ${SIGNATURE}" | |
JSON="{\"query\": \"mutation HealthCheck(\$signature: String!, \$timestamp: String!) { healthCheck(signature: \$signature, timestamp: \$timestamp) }\", \"variables\": {\"signature\": \"$SIGNATURE\", \"timestamp\": \"$NOW\"}}" | |
echo "Sending ping..." | |
echo "$JSON" | curl -sSf --data-binary @- -H "Content-Type: application/json" -X POST $URL |
Hint: Use curl -sSf
so that you get an error description (instead of no output) when curl
fails.
Hint: Use
curl -sSf
so that you get an error description (instead of no output) whencurl
fails.
Thanks for the hint @erikarvstedt! I updated the gist with these flags.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This version is for CLN/c-lightning/Core Lightning.
For the original LND version see: https://gist.github.com/C-Otto/cd5d7b0e67fc2e3e212cf13a558b101f