Giter Site home page Giter Site logo

armando1514 / polkadot-observer Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 21.69 MB

This project monitors the Polkadot network and notifies users when a specific account's funds fall below a threshold, offering Prometheus queryable metrics for efficient monitoring and alerts.

Dockerfile 4.42% HTML 4.32% JavaScript 15.89% TypeScript 75.36%
blockchain kusama monitoring polkadot prometheus

polkadot-observer's Introduction

Polkadot Observer

This project aims to provide a robust solution for observing the Polkadot network and detecting when a specific account fund goes under a user-defined threshold. The system is designed to be deployed on a Kubernetes platform and offers features like Prometheus queryable metrics, making it suitable for monitoring and alerting purposes.

Architecture Overview

architecture

EXPLANATION VIDEO

You can find a link to the video on my youtube channel, in the video you will find about this repo:

  • How to run locally.
  • Repo structure.
  • Showcase Features.

How to run

Docker-compose

  1. OPTIONAL: Open the file ./dev/docker-compose.yaml, you need to change 2 environment variables

    • Looking at service backend_monitor, you can change the env 'CHAIN_URI' to one of the node endpoints offered at this link to choose at which network you wanna listen to.

    • If you want to send the alert to Discord, it needs to know the webhook url, so go to service alert_manager, and you will find:

              receivers:
                  - name: discord
                  discord_configs:
                      - webhook_url: 'TO-CHANGE'
      
      
  2. From the terminal, go in the folder ./dev and run:

    docker-compose up --build

  3. Wait until all the services are up and running and you can connect to the system: http://localhost:3000/, from there you can insert the addresses to monitor and the thresholds

NOTE: If you do not want to add the list manually from the frontend, you can do so through .csv file that is pre-loaded once the service backendMonitor is started, go in the folder backendMonitor and edit the file 'addresses.csv', with the format 'address,threshold', for instance: 14gAowz3LaAqYkRjqUZkjZUxKFUzLtN2oZJSfr3ziHBRhwgc,2

Run K8S locally

k8s-diagram

  1. OPTIONAL:

    • In the folder ./k8s, in the file monitoring-deployment.yaml at service called alert-manager-container, If you want to send the alert to discord, it needs to know the webhook url (how to set a webhook), so go at service alert_manager, and you will find:

                  receivers:
                    - name: discord
                      discord_configs:
                        - webhook_url: 'TO-CHANGE'
      
    • In the file backend-monitor-deployment:

      name: CHAIN_URI
                    value: TO-CHANGE
      

      you can change the env 'CHAIN_URI' to one of the node endpoints offered at this link to choose at which network you wanna listen.

      If you want to make use of the addresses.csv in backendMonitor, you can change this env with your absolute path to this file:

            - name: local-files
                hostPath:
                  path: TO_CHANGE
      
  2. After the env are set, you need to install Ingress-Nginx-Controller

  3. Type from terminal:

    helm upgrade mongodb-query-exporter --install oci://ghcr.io/raffis/charts/mongodb-query-exporter --set 'mongodb[0]=mongodb://mongodb-cluster-ip-service:27017' --set 'service.enabled=true' --set-file config=./mongoExporter/config.yaml
    
  4. Type: kubectl apply -f ./k8s

  5. WAIT A MINUTE OR MORE, THE SERVICES NEED TO START (It requires more time if is the first time you have installed Ingress-Nginx-Controller ).

  6. Now if you have docker desktop you can access localhost:80 and see the dashboard otherwise type minikube ip to retrieve the IP and type it in your browser. If doesn't work, try to restart the cluster or docker desktop.

Threshold Format

What format am I expecting from the threshold input?

I am expecting the same format as on the dashboard platform, for instance what you retrieve from the chain as 664707494049 converted to unit in 0.6647 (once the account becomes for instance 660007494049, the threshold wiill be triggered) . So on the frontend or csv I expect you to write: 0.6647 for that.

threshold-format

Style Guides

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.