Skip to content

Instantly share code, notes, and snippets.

@naamahdaemon
Created August 5, 2023 21:24
Show Gist options
  • Save naamahdaemon/e54f9a249671825e904eaccc4fad47fa to your computer and use it in GitHub Desktop.
Save naamahdaemon/e54f9a249671825e904eaccc4fad47fa to your computer and use it in GitHub Desktop.
Check and highlight uptime problems with your mina bloc producer
#!/bin/bash
journalctl --user-unit mina -f -S "72h ago" | sed -E 's/.*: (.*)/\1/g; s/(.* Uptime service will attempt to send a block and SNARK work.*)/\x1b[37m\x1b[48;5;22m\1\x1b[0m/g; s/(.*Sent block with state.*)/\x1b[48;5;52m\1\x1b[0m/g; s/(.* Uptime service did not get a produced block within.*)/\x1b[1;37;41m\1\x1b[0m/g; /.*[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+/!d; /.* Duplicate producer and slot.*/d; /.*Received a block from \$sender.*/d; /.*time service.*/!d;;'
@naamahdaemon
Copy link
Author

naamahdaemon commented Aug 5, 2023

Description

Really simple bash script to display and hightlight specific uptime problems with your Mina node.
You can also just launch the command line from your shell prompt :

journalctl --user-unit mina -f -S "72h ago" | sed -E 's/.*: (.*)/\1/g; s/(.* Uptime service will attempt to send a block and SNARK work.*)/\x1b[37m\x1b[48;5;22m\1\x1b[0m/g; s/(.*Sent block with state.*)/\x1b[48;5;52m\1\x1b[0m/g; s/(.* Uptime service did not get a produced block within.*)/\x1b[1;37;41m\1\x1b[0m/g;  /.*[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+/!d; /.* Duplicate producer and slot.*/d; /.*Received a block from \$sender.*/d; /.*time service.*/!d;;'

You can also change the time frame of 72h for something that better suits your needs.

Usage

./check_mina_uptime.sh

Result

Colored output of uptime highligthing request/response from the uptime server.

Example - Normal Output (no problem)

image

Example 2 - Recoverable / temporary Error

image

Example 3 - Unrecoverable error

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment