Sei testnet, setup Panic Alerter monitoring system

Blockscope
4 min readAug 18, 2022

--

If you don’t know Panic is a Cosmos networks monitoring tool for validator nodes developed by SimplyVC. We’ve using Panic for quite a while now, and it have worked pretty good for our servers in mainnet and testnet. So we are doing a small tutorial on how to setup Panic on your monitoring server to monitor your Sei atlantic-1 testnet node.

First step is to log into your monitoring server to do the installation. Make sure that your server package repository is up to date.

sudo apt-get update
sudo apt-get upgrade

Panic runs on Python so you’ll need to install that in the first place. Execute this to install it and its package manager (pip) using

sudo apt-get install python3.8 python3-pip
pip install pipenv

You can check if you have Python installed correctly by executing and checking the output of the 3 of them.

python3 — version
pip — version
pipenv — version

You would also need Redis database for Panic to store the data it needs. To install it you can do the following.

sudo apt-get install redis-server
sudo systemctl enable redis-server.service

If you need a specific configuration for your Redes instance, you can check the config in /etc/redis/redis.conf file.

Now, we’re ready to set up Panic. First thing is to download the code from the repository.

cd ~
git clone https://github.com/SimplyVC/panic_cosmos.git panic
cd panic

Panic requires a setup process that sets its config files, you can do that by running the setup script.

pipenv sync
pipenv run python run_setup.py

This will guide you with instructions to set up your servers and config options. You can skip this step and setup directly the config files in config/ folder (you can look at the example files and work on that config/example_***.ini), we’re taking this step.

Modify your config files with your needs, in our case we are just settting Telegram alerts but you have other options like email, Twillio, we are also setting the ping option to 2 hours (periodic_alive_reminder) and config our redis database:

config/user_config_main.ini

[general]
unique_alerter_identifier = blockscope-monitor

[telegram_alerts]
enabled = True
bot_token = 9300283302:sY6KtgwAAHl2vkkADp8ZyMwXQaYb5KQJSmI
bot_chat_id = 1230808763

[email_alerts]
enabled = False
smtp =
from =
to =
user =
pass =

[twilio_alerts]
enabled = False
account_sid =
auth_token =
twilio_phone_number =
phone_numbers_to_dial =

[periodic_alive_reminder]
enabled = True
interval_seconds = 7200
email_enabled = False
telegram_enabled = True

[telegram_commands]
enabled = True
bot_token = 1971270329:AAHl2Yb5KQJSvkkADp8ZyMwsY6KtgwXQamI
bot_chat_id = 1252858258

[redis]
enabled = True
host = localhost
port = 6379
password =

We are not covering how to create a Telegram bot, but there’s plenty of tutorials out there to create TG bots.

Now we’re declaring our Sei validator node in the configuration file, make sure that your validator node RPC service (by default on por 26657) is accessible from you monitoring server. You can do that by curling the status method and checking that the output is correct.

IP=’10.10.10.44’
PORT:26657
curl http://$IP:$PORT/status

config/user_config_nodes.ini

[node_1]
node_name = set-test-val
node_rpc_url = http://10.10.10.44:26657
node_is_validator = true
include_in_node_monitor = true
include_in_network_monitor = true

you can also tweak Panic general configuration by editing the file config/internal_config.ini, so have a look at it and edit to your needs.

Panic is ready to go, but we are creating a specific user and a Linux server to run it.

Create the user and give to permissions to folders

PANIC_USER=panic
DIR=/home/panic/panic
sudo adduser $PANIC_USER
sudo chown -R $PANIC_USER:$PANIC_USER $DIR/
sudo chmod -R 700 $DIR/logs
sudo chmod +x $DIR/run_setup.py
sudo chmod +x $DIR/run_alerter.py
#create a virtual environment with pipenv
cd $DIR
su PANIC_USER -c “pipenv sync”

Create the service file in /etc/systemctl/system/panicd.service

[Unit]
Description=PANIC
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
User=panic
TimeoutStopSec=90s
WorkingDirectory=/home/panic/panic/
ExecStart=/usr/local/bin/pipenv run python /home/panic/panic/run_alerter.py

[Install]
WantedBy=multi-user.target

Now enable the service on boot, start the service, and check the alert logs.

sudo systemctl enable panicd.service
sudo systemctl start panicd.service
tail -f ~/panic/logs/alerts/alerts.log

Now enjoy being alerted of any issues on your node with messages to your telegram bot.

If you don’t know Sei or Panic visit the websites to learn about this awesome projects. Cheers!

--

--

Blockscope

We're a company of Blockchain passionate individuals that aim to help decentralize the world while having fun with technology.