Slackbot for Nanopool to watch workers and report mining info
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
pip install virtualenv
virtualenv env
source env/bin/activate
pip install slackclient
- Create a bot named
@nanopoolbot
and save the API token
export BOT_TOKEN="<slack api token>"
- Run the following Python script to get the bot's user ID for
BOT_ID
python print_bot_id.py
- Copy
run.sh.example
torun.sh
cp run.sh.example run.sh
- 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>"
bash run.sh
Recommended to use supervisor
if you want a long running service that is fault tolerant
[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
Thanks to https://www.fullstackpython.com/blog/build-first-slack-bot-python.html for the great starting point/guide