Photo by Zoltan Tukacs on Unsplash
Watchdog for your Chia farm
So you've become a Chia farmer and want to maximize the probability of getting a reward? Chiadog helps with automated monitoring and sends you a mobile notification in case something appears to malfunction.
Supported Notifications
Subsystem | Notification (example values) | Priority |
---|---|---|
Harvester | Your harvester appears to be offline! No events for the past 400 seconds. | HIGH |
Harvester | Disconnected HDD? The total plot count decreased from 100 to 40. | HIGH |
Harvester | Experiencing networking issues? Harvester did not participate in any challenge for 120 seconds. It's now working again. | NORMAL |
Harvester | Seeking plots took too long: 40 seconds! | NORMAL |
Harvester | Found 1 proof(s)! | LOW |
Full Node | Experiencing networking issues? Skipped some signage points! Last 12/64, current 43/64. | NORMAL |
How it works?
It parses the debug.log
generated by the chia process and runs various checks to determine the health of your farmer. Among others, it can detect if your node has lost sync and the farmer is no longer participating in challenges, or if one of your external HDDs disconnected and your harvester doesn't have access to the full amount of plots you have.
Supported Integrations for Notifications
Pushover
Pushover is available for both Android and iOS. High priority notifications can be configured from the Pushover app to overwrite any Silence or Do-Not-Disturb modes on your phone and sound a loud alarm at any time of the day to make you aware of any issues in a timely manner.
Slack, WhatsApp, E-Mail, ...?
These integrations can be easily added. Contributions are welcome!
Getting started
Pre-requisites
- UNIX-based OS (Linux/Mac) - contributions to support Windows are welcome!
- Python 3.7+
- Enabled
INFO
logs on your chia farmer
How to enable INFO logs on chia farmer?
First configure the log level to INFO
. This ensures that all logs necessary for chiadog to operate are available under ~/.chia/mainnet/log/debug.log
.
chia configure -log-level=INFO
Then restart your farmer to apply the changes:
chia start --restart farmer
Check that logs are coming in:
cat ~/.chia/mainnet/log/debug.log
Installation
For updating from previous version, see section below.
- Clone the repository
git clone https://github.com/martomi/chiadog.git
cd chiadog
- Create virtual env (Recommended)
python3 -m venv venv
. ./venv/bin/activate
- Install the dependencies:
pip3 install -r requirements.txt
- Copy the example config file
cp config-example.yaml config.yaml
- Open up
config.yaml
in your editor and configure Pushover.- Enable Pushover Notifier
- Set your Pushover API token
- Set your Pushover user key
Updating to the latest release
Skip this if you followed above section.
cd chiadog
. ./venv/bin/activate
git fetch
git checkout main
git pull
pip3 install -r requirements.txt
Important: Automated migration of config is not supported. Please check that your
config.yaml
has all new fields introduced inconfig-example.yaml
and add anything missing.
Monitoring a local harvester / farmer
-
Open
config.yaml
and configurefile_log_consumer
:- You need to enable the file log consumer to read local chia log files
- Double-check that the path to your chia logs is correct
-
Start the watchdog
python3 main.py --config config.yaml
- Verify that your plots are detected. Within a few seconds you should see INFO log:
Detected new plots. Farming with 42 plots.
Remote monitoring of multiple harvesters
You can run multiple instances of chiadog
on a single machine and monitor all your harvesters remotely. The logs on remote machines are accessed through SSH, so you'll have to setup ssh-key based authentication with your harvesters.
Setting up SSH keys
This step only takes a minute, follow Github's guide on Generating a new SSH key . If you specify password for your key, you'll also need to follow the second step in the guide and add your SSH key to the ssh-agent. The ssh-agent should remember and manage your password because chiadog
doesn't know it.
Copy SSH key to all machines running a harvester
On Linux you can use ssh-copy-id:
ssh-copy-id @
which will take your default SSH key, or specify it explicitly:
ssh-copy-id -i "~/.ssh/id_ed25519" @
Prepare configs for each harvester
-
Open
config.yaml
in your editor and enablenetwork_log_consumer
.- Make sure that
file_log_consumer
is disabled (or delete that section) - Configure
remote_user
for your remote harvester machine - Configure
remote_host
for your remote harvester machine - Double check that
remote_file_path
exists on the remote machine
- Make sure that
-
Copy
config.yaml
into multiple configs for each remote harvester, e.g.:
cp config.yaml config-harvester-1.yaml
cp config.yaml config-harvester-2.yaml
cp config.yaml config-harvester-3.yaml
-
Adjust the
remote_user
andremote_host
for each machine.- You can also specify different
notification_title_prefix
so that you can more easily distinguish between notification from each of your harvesters.
- You can also specify different
-
Start
chiadog
for each harvester in a separate terminal. I recommend tmux as it allows you to split your terminal in multiple windows and have a cockpit-like overview.
python3 main.py --config config-harvester-1.yaml
python3 main.py --config config-harvester-2.yaml
python3 main.py --config config-harvester-3.yaml
Troubleshooting
The best way to check that everything works on your system is to run the unit tests:
PUSHOVER_API_TOKEN= PUSHOVER_USER_KEY= python3 -m unittest
If your Pushover API token and user key are correctly set in the snippet above, you should receive notifications on your phone and the tests should complete with an OK
status:
You can also enable more verbose logging from config.yaml
by changing INFO
to DEBUG
. Then you'll be able to see logs for every keep-alive event from the harvester.
Contributing
Contributions are always welcome! Please refer to CONTRIBUTING documentation.