Skip to content

endorphinestake/story-validator-watcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

watcher screen

About Story Validator Watcher

  • Cosmos Validator Watcher is set to streamline monitoring and interaction with Cosmos-based blockchains and validators by Kiln.
  • This custom tool does not allow you to receive data from the blockchain in real time and distribute it to the watcher.
  • Therefore, our team create pars_script which adds active validators to the watcher configuration in real time.
  • The script collects data from the x/staking API module and the /validators RPC.

Grafana Dashboard Demo by

  • watcher as default username and password

If you want to set up your own Story Validator Watcher - let's continue!

Install Grafana

Import the GPG key for Grafana:

wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -

Add the Grafana repository to the APT sources:

sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"

Update the package lists:

sudo apt update

Install the Grafana:

sudo apt install grafana

Start and enable service:

sudo systemctl start grafana-server
sudo systemctl enable grafana-server

Check status grafana-server:

sudo systemctl status grafana-server
  • If everything works fine, enter your Public IP:3000 in searchbar. You will see the login page: admin as default username and password.

Install Cosmos Validator Watcher

Install go:

sudo apt-get install -y snapd
sudo snap install go --classic
sudo apt install make

Build cosmos-validator-watcher:

git clone https://github.com/kilnfi/cosmos-validator-watcher
cd cosmos-validator-watcher
git checkout v0.14.0
make build
cd build
mv cosmos-validator-watcher /usr/local/bin/

Instal Pars Script

git clone https://github.com/endorphinestake/story-validator-watcher
apt install python3-pip
pip install vk_api
pip install schedule
cd story-validator-watcher/pars_script
python3 main.py

To run in the background, use screen:

rm -rf $HOME/story-validator-watcher/pars_script/rpc.db
screen -S main
cd pars_script
python3 main.py

Install Prometheus

Download Prometheus:

sudo wget https://github.com/prometheus/prometheus/releases/download/v2.47.0/prometheus-2.47.0.linux-amd64.tar.gz

Extract Files:

sudo tar vxf prometheus*.tar.gz

Create a user for prometeus:

sudo groupadd --system prometheus
sudo useradd -s /sbin/nologin --system -g prometheus prometheus

Create directories for prometheus:

sudo mkdir /etc/prometheus
sudo mkdir /var/lib/prometheus
cd prometheus*/

Move the binary files:

sudo mv prometheus /usr/local/bin
sudo mv promtool /usr/local/bin
sudo mv console* /etc/prometheus
sudo mv prometheus.yml /etc/prometheus

Set owner:

sudo chown prometheus:prometheus /usr/local/bin/prometheus
sudo chown prometheus:prometheus /usr/local/bin/promtool
sudo chown prometheus:prometheus /etc/prometheus
sudo chown -R prometheus:prometheus /etc/prometheus/consoles
sudo chown -R prometheus:prometheus /etc/prometheus/console_libraries
sudo chown -R prometheus:prometheus /var/lib/prometheus

Change config:

sudo nano /etc/prometheus/prometheus.yml
global:
  scrape_interval: 15s
  evaluation_interval: 15s

scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']

  - job_name: 'watcher'
    static_configs:
      - targets: ['localhost:8080']  # Adjust the target to your node exporter endpoint

  - job_name: 'story node'
    static_configs:
      - targets: ['135.181.208.245:26660']  # Adjust the target to your story node exporter endpoint

Create prometeus service:

sudo nano /etc/systemd/system/prometheus.service
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target

[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
 --config.file /etc/prometheus/prometheus.yml \
 --storage.tsdb.path /var/lib/prometheus/ \
 --web.console.templates=/etc/prometheus/consoles \
 --web.console.libraries=/etc/prometheus/console_libraries

[Install]
WantedBy=multi-user.target

Start and enable service:

sudo systemctl daemon-reload
sudo systemctl enable prometheus
sudo systemctl start prometheus
  • If everything works fine, enter your Public IP:3000 in searchbar. You will see the login page: admin as default username and password.

  • Click Dashboard - New - Import.

grafana-watcher-1

  • Download json for Grafana dashboard.
  • Click Upload dashboard JSON file and drop here your file.

grafana-watcher-2

  • Be sure to specify the data source - prometheus-1 and click Import.

grafana-watcher-3

  • Completed, if everything is done correctly, your dashboard will start displaying data.

grafana-watcher-4

Features Parse Script

  • By default, script scans the API every 3 seconds. You can change this:
nano $HOME/story-validator-watcher/pars_script/main.py
schedule.every(1).seconds.do(main) 
schedule.every(1).minutes.do(main)
schedule.every(1).hours.do(main)
schedule.every(1).days.do(main) 
schedule.every(1).weeks.do(main) 

schedule_main

  • You must clear the database before each restart parse_script:
rm -rf $HOME/story-validator-watcher/pars_script/rpc.db
  • To add multiple RPC to watcher:
nano $HOME/story-validator-watcher/pars_script/parse/get_subprocess_link.py

get_subprocess_link

  • Edit API for parse_script:
nano $HOME/story-validator-watcher/pars_script/parse/parse.py

parse

Story Validator Watcher Demo Online

You can download the Grafana dashboard here:

Grafana Dashboard Demo by

watcher as default username and password

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages