Skip to main content
  1. Projects/

Miner Health-Check Script

·391 words·2 mins· loading · loading ·
Sysadmin Monitoring Python Windows
This project is not in active development anymore

screenshot.png

Installation
#

1. Enable API in SGMiner
#

If you don’t want SGMiner checks or use different miner - disable this feature (don’t use --sgminer key).

To enable SGMiner API add following parameters to sgminer.exe command-line:

1sgminer.exe --api-listen <your-other-parameters>

2. Download fresh version
#

You can get it from:

3. Get keys
#

You need two keys:

StatusCake Integration
#

Each started instance of miner-healthcheck will send push messages to this URL every X seconds. If StatusCake won’t receive this messages for some time - you will get notification.

So this is check - is your RIG alive or not?

How to get your STATUSCAKE_PUSH_URL: https://github.com/soar/miner-healthcheck/wiki/StatusCake-Integration

IFTTT Integration
#

When your RIG have some troubles - push notification will be sent to IFTTT webhook URL. This URL is common for all your RIGs.

How to get your YOUR_IFTTT_WEBHOOK_KEY: https://github.com/soar/miner-healthcheck/wiki/IFTTT-Integration

4. First run and check
#

Perform test running with next command line:

1miner-healthcheck.exe ^
2    --health-report-url "STATUSCAKE_PUSH_URL" ^
3    --ifttt-check ^
4    --ifttt-key YOUR_IFTTT_WEBHOOK_KEY

If test was successful - you should see message in Telegram:

1Event: check_integration
2Message: success

5. Run in production mode
#

1miner-healthcheck.exe ^
2    --health-report-url "STATUSCAKE_PUSH_URL" ^
3    --ifttt-key YOUR_IFTTT_WEBHOOK_KEY ^
4    --sgminer ^
5    --gpu-hashrate-threshold 0.3 

Logic
#

  1. Script should be started at system startup
  2. It has infinite loop and runs forever
  3. Every X seconds - it performs checks:
    • if SGMiner checks are enabled:
      • SGMiner is alive
      • SGMiner answers on API requests
      • Each GPU is alive
      • GPUs hash-rate is above threshhold
  4. If checks passed successfully - it makes remote HTTP request to report about it health to STATUSCAKE_PUSH_URL
  5. If remote endpoint doesn’t receive health check report in Y seconds - StatusCake sends notification to configured targets (see Web-UI for settings)

Parameters
#

  • --help - show help
  • --debug - show debug messages (not recommended for every-day use)
  • --sleep X - time between checks, 10 seconds by default, recommended
  • --sgminer - enable specific checks for SGMiner (via API, see Installation)
  • --gpu-hashrate-threshold X.X - when one of installed GPUs will gave hashrate lower, than this value (in KHash/sec) - notification will be sent

Examples
#

1miner-healthcheck.exe --health-report-url "https://push.statuscake.com/?PK=XXXXXXXX&TestID=00000&time=0" --sgminer --gpu-hashrate-threshold 0.36 --ifttt-key lk9y6DOXXXXXXXXX

Building
#

1pyinstaller --onefile --icon miner.ico --name miner-healthcheck-v1.2.exe run.py
@soar
Author
@soar
Senior SRE/DevOps engineer

Related

6-years old issue in Python CSV module
·419 words·2 mins· loading · loading
Development Python
BIND9 + SNMP + Cacti
·408 words·2 mins· loading · loading
Sysadmin Monitoring Dns Like
ssh-copy-id for Windows (Powershell)
·993 words·5 mins· loading · loading
Sysadmin Windows Powershell