Have you spent the big bucks and setup a masternode? Setting up a masternode can be a huge investment, so you don't just start your masternode and forget about it. If you don't have anything checking to make sure it's running you will lose out on your rewards! If your masternode hits 'EXPIRED' status you will lose out on your queue position, and can lose days or weeks of payments!
This document will focus on a GENERIC masternode. I won't go into specifics for any coin, but for examples I'll use both XZC (Zcoin) and BTDX (Bitcloud). We will call this coin 'generic' and the coin process 'genericd'.
We will be using a two pronged approach to make sure your masternode stays up. First, we will use a tool called 'monit' to make sure that genericd is running. If your genericd should die, monit will restart it. Secondly, we will use Status Cake (of statuscake.com) to monitor both the vps and genericd externally and send us alerts.
So first, setup an account with statuscake.com. It's simple, free, and I'm in no way associated with it, except for the fact I use it as well.
You will need to create a new test and configure it with the external IP of your VPS and the port of your coin.
Here's an example:
Replace '192.168.1.1' with the external IP of your VPS, and '8168' (Which is the port for Zcoin) with whatever port your own coin uses.
Now, let's setup monit. I will be using details from my previous doc on setting up masternodes ( https://steemit.com/masternode/@koguma/bitcloud-masternode-for-dummies-be-a-crypto-pro ):
Install monit to monitor your masternode! # apt-get update && apt-get install monit
cd /etc/monit/conf.d/*
Create a config file, we can call it coin.conf. This is for monit to control the genericd process:
check process genericd with pidfile /home/generic/genericd.pid
start program = "/home/generic/start-genericd.sh"
as uid generic and gid generic
stop program = "/home/generic/stop-genericd.sh"
as uid generic and gid generic
if failed host 127.0.0.1 port XXXX for 10 cycles then restart
if 5 restarts within 50 cycles then timeout
group Masternode
Above, you will need to change all the generic's to whatever user you're running your genericd under. Do NOT, ever, run your coin as the root user. NEVER
Change the pid location, and port to ones that match your coin. You can get these details from the masternode guide you used to setup the coin.
Make sure, and this is critical to change the 'as uid' to and actual user and group that the coin is running under. Otherwise, bad things will happen.
Finally, you will need to make those start-* and stop-* scripts. These can be involved, but let's keep them minimum.
start-genericd.sh should at least contain:
#!/bin/bash
cd /home/generic
./genericd-cli -pid=/home/generic/genericd.pid -logtimestamps
and stop-genericd.sh should contain:
#!/bin/bash
cd /home/generic
./genericd-cli stop
Remeber to do a
$*chmod +x start-genericd.sh*
and
$*chmod +x stop-genericd.sh*
You can also edit /etc/monit/monitrc to tune some settings and setup email options. For that, you will need to go to https://mmonit.com/monit/ and read up on the configuration options. You will also need have email working, but that's beyond the scope of this doc and not crucial since you have statuscake monitoring.
Now, you're ready to start your genericd. If it's already running, just do:
sudo monit monitor genericd
If you want to start it:
sudo monit start genericd
And so forth.
If you've found these guides useful, come join me on the Zcoin and Bitcloud Telegram groups:
Zcoin:
https://t.me/zcoinproject
Bitcloud:
https://t.me/bitcloud_btdx
Awesome guide for setup monitoring for your Masternode!
I will implement this on Virtus https://bitcointalk.org/index.php?topic=2983251