Photo by Zoltan Tukacs on Unsplash
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.
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 |
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.
The following integrations are optional - chiadog
is not dependent on any of them and can also run standalone. That being said, you'll get the most value out of it, when
you connect with one of the services below to receive real-time notifications about important events. You can also
enable more than one at the same time - please refer to the config-example.yaml.
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.
- Costs: ~$5 one time payment for mobile app after 30 day trial.
- Advantages: Easy setup, high priority notifications can override your phone's silent mode.
You can test if your the setup works correctly with:
PUSHOVER_API_TOKEN=<api_token> PUSHOVER_USER_KEY=<user_key> python3 -m unittest tests.notifier.test_pushover_notifier
This integration uses the Telegram's Bot API. You can create a new bot for yourself by sending a message to BotFather.
For chat_id
you need to enter your Telegram username or ID. For me only ID worked, you can find out your Telegram ID
by messaging the IDBot. You need to also first message your bot to make sure it knows
about you and can send you notifications.
- Costs: $0
- Advantages: It's free and not additional apps are required.
You can test if your bot works correctly with:
TELEGRAM_BOT_TOKEN=<bot_token> TELEGRAM_CHAT_ID=<your_id> python3 -m unittest tests.notifier.test_telegram_notifier
Beware: This feature is in beta stage and future versions might not maintain backward compatibility! Currently, you need to parse out information from the message text which might change. In the future there'll be a different mechanism for identifying message type and payload.
Test your script is called correctly with:
python3 -m unittest tests.notifier.test_script_notifier
These integrations can be easily added. Contributions are welcome!
- UNIX-based OS (Linux/Mac) - contributions to support Windows are welcome!
- Python 3.7+
- Enabled
INFO
logs on your 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
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 wheel && 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
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.
-
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.
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.
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.
On Linux you can use ssh-copy-id:
ssh-copy-id <user>@<ip_address>
which will take your default SSH key, or specify it explicitly:
ssh-copy-id -i "~/.ssh/id_ed25519" <user>@<ip_address>
-
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
The best way to check that everything works on your system is to run the unit tests:
python3 -m unittest
All tests are expected to complete with an OK
status. It's highly recommended to also run the notification specific
tests described in the notification section above.
You can enable more verbose logging from config.yaml
by changing INFO
to DEBUG
. You should see logs for every
keep-alive event from the harvester.
nohup python3 -u main.py --config config.yaml > output.log &
To stop chiadog, you can find the Process ID (PID) via ps aux | grep main.py
and then softly interrupt the process
with kill -SIGINT <pid_here>
.
You might be plotting too hard or your computer cannot keep up for some other reason. You shouldn't be getting more than 10 of these notifications per day. In a future version there'll be configuration to adjust the threshold or to only send a daily summary on skipped signage points.
For now, if you don't want to get bothered by them, I recommend to
replace this line
with return None
. This will only stop the signage point notifications. You still will get notified about more critical
issues.
We're in the early stages of exploring the best way to provide easy to setup sandboxed environment where the chiadog
process is completely isolated from potentially accessing your private keys. Contributions in that direction are very
welcome. Meanwhile you can check out @ajacobson repository
for chiadog-docker.
Contributions are always welcome! Please refer to CONTRIBUTING documentation.