Greets all,

I have written this blog post as a guide on how I got the monit daemon working to monitor the zend daemon. Thanks to Rolf at Blockoperations for all the hard work to get this up and running.

Please ensure that your node is working properly by running zend manually before trying to configure monit

This is how I converted my nodes that originally used crontab to start zend.

First start up crontab and delete the line that starts zend on boot.
crontab -e
delete @reboot zend

Then I installed the monit software by running:
sudo apt install monit

Next we need to create the script that will start/stop zend and generate the Process ID (.pid file). I like to use nano for editing files so my command is:
nano ~/zencash/zen_node.sh

Now this next part is the script that you will need to copy and paste into the zen_node.sh file. Please change the <your_user_name> to the username that you log into node with. I have not included the text of the code, but instead an image of the code, so you will not be able to copy and paste. The script is available on the Blockoperations website here under the monit section.
Screen-Shot-2017-11-03-at-4.08.57-pm

Next is to make the new file an executable script:
chmod u+x ~/zencash/zen_node.sh

Now we need to edit the monitrc configuration file. This is done by editing /etc/monit/monitrc using your favourite editor:

sudo nano /etc/monit/monitrc

I like to have monit service poll my processes once every 10 seconds. To do this find the line that says:
set daemon 120
And change it to:
set daemon 10

Then add the following section to the bottom of the monitrc file:
Screen-Shot-2017-11-04-at-1.09.44-PM
Note: Please replace the <your_user_name> with the username you log into your node with.

If you want to have email notifications, install postfix and add this section below the section above:
Screen-Shot-2017-11-03-at-3.49.44-pm
Note: Please change the your_node and [email protected] to your details

Now reload monit with our new configuration using:
sudo monit reload

And then start zend using the monit service:
sudo monit start zend

To stop the zend daemon run:
sudo monit stop zend

If you find this blog useful, and if you would like to keep it up and running, donations are always appreciated to any of the following addresses:
ZEN: znYjefe2QBfm9HEWfAtpwiBHMHTXwePs48C
ZEC: t1YZxjMEmPPLx1kFVp2zcWRBC4zrmRc71eZ
BTC: 14D1emX2xDeh3zA2myrhCmaWf1ZKAn1QzS
ETH: Ae491f4493F8d051ac23cE0d4aa2B524504eCb84