Coder Social home page Coder Social logo

nanopool-slackbot's Introduction

nanopool-slackbot

Slackbot for Nanopool to watch workers and report mining info

Overview

nanopool-slackbot is designed to monitor workers on a Nanopool wallet address, sending alerts when workers are reported to be 'offline' and when new workers come online

Install

pip install virtualenv
virtualenv env
source env/bin/activate
pip install slackclient

Configure

Slack

  1. Create a bot named @nanopoolbot and save the API token

export BOT_TOKEN="<slack api token>"

  1. Run the following Python script to get the bot's user ID for BOT_ID

python print_bot_id.py

Slackbot

  1. Copy run.sh.example to run.sh

cp run.sh.example run.sh

  1. Edit run.sh and fill in the following variables
export WALLET_ID="0xADDRESS"
export OFFLINE_MIN=30
export BOT_ID="<from print_bot_id.py>"
export BOT_TOKEN="<slack api token>"

Running

bash run.sh

Recommended to use supervisor if you want a long running service that is fault tolerant

Supervisord example conf

[program:nanopoolbot]
command=/opt/nanopoolbot/run.sh   ; the program (relative uses PATH, can take args)
numprocs=1                        ; number of processes copies to start (def 1)
directory=/opt/nanopoolbot        ; directory to cwd to before exec (def no cwd)
autostart=true                    ; start at supervisord start (default: true)
autorestart=true                  ; restart on exit
stopasgroup=true                  ; send stop signal to the UNIX process group (default false)
user=nanopoolbot                  ; setuid to this UNIX account to run the program
stderr_logfile=/var/log/nanopoolbot.err.log
stdout_logfile=/var/log/nanopoolbot.out.log

Source

Thanks to https://www.fullstackpython.com/blog/build-first-slack-bot-python.html for the great starting point/guide

nanopool-slackbot's People

Contributors

mike-wendt avatar

Stargazers

 avatar

Watchers

 avatar

nanopool-slackbot's Issues

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.