Created
September 16, 2021 18:04
-
-
Save blockpane/cd7644a347379696f41e8cc51b7a92e5 to your computer and use it in GitHub Desktop.
monit checks for osmosis
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
#!/bin/bash | |
PROMETHEUS=http://localhost:26660 | |
NUM_PEERS=$(curl -s ${PROMETHEUS}/stats |grep 'p2p_peers{' |awk '{print $NF}') | |
# if we can't connect don't alarm, that is done in another check. | |
[ -z $NUM_PEERS ] && exit 0 | |
if [ $NUM_PEERS -eq 0 ] ; then | |
echo NO PEERS ARE CONNECTED | |
exit 1 | |
fi | |
echo $NUM_PEERS peers are connected. | |
exit 0 |
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
# /etc/monit/conf.d/osmosis.conf | |
check process osmosisd matching osmosisd | |
start program = "/usr/bin/systemctl start osmosisd.service" | |
restart program = "/usr/bin/systemctl restart osmosisd.service" | |
stop program = "/usr/bin/systemctl stop osmosisd.service" | |
check host osmosisd-syncing with address 127.0.0.1 | |
if failed | |
port 26657 protocol http | |
request /status with content = '"catching_up": false' | |
then alert | |
depends on osmosisd | |
check program osmosisd-peers with path "/etc/monit/scripts/no-peers.sh" | |
restart program = "/usr/bin/systemctl restart osmosisd.service" | |
if status != 0 then alert | |
IF status != 0 FOR 2 CYCLES THEN RESTART | |
depends on osmosisd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment