A tool to monitor Wanchain validator running status, including:
Download source code from github
git clone https://github.com/wanchain/validator-monitor.git
cd validator-monitor
Execute the command in the validator-monitor directory:
npm install
The configure file is named config.js, it contains several goups and items:
item | description |
---|---|
smtpServer | required |
smtpPort | required |
secure | required |
authUser | required |
authPassword | required |
receiver | required |
All of above items are required, and should be set according to your email service provider. Please make sure that SMTP is enabled and authentication is correct.
item | description |
---|---|
ipcPath | required |
The monitor communicates with gwan via IPC, so ipcPath should be set according to the gwan startup parameters. The default path is /home/user/.wanchain/gwan.ipc. Please use the absolute path.
item | description |
---|---|
diskName | default is the root directory ("/"), could be changed if gwan uses another disk or partition |
reportName | optional, used to identify different validators if you have more than one |
reportHour | default is 10 o'clock, when to send daily report, based on the monitor server clock |
item | description |
---|---|
cpuUsage | default is 80, in percentage |
memoryUsage | default is 80, in percentage |
diskUsage | default is 80, in percentage |
blockDelay | default is 60, in seconds, equivalent to 12 blocks |
balance | default is 1 WAN, used for gas of PoS transations |
Execute the command in the validator-monitor directory:
npm run test
It will check the email configuration. If correct, the receiver should receive an email with subject "Wanchain Validator Monitor".
The validator-monitor is scheduled by crontab, you need to create a task:
crontab -e
Insert one line at the end of the opened file and save:
*/10 * * * * ~/validator-monitor/start.sh > ~/validator-monitor/validator-monitor.log 2>&1
You can check the task with:
crontab -l
NOTE: please replace "~/validator-monitor" with your own validator-monitor path.
Reports will be sent by email.
If there is any alert, an email will be sent immediately, with subject:
ALERT - Wanchain Validator Monitor
Otherwise, a report email will be sent daily, with subject:
NORMAL - Wanchain Validator Monitor
Make sure the gwan.ipc could be accessed with read and write permissions. Run the command:
sudo chmod 766 gwan.ipc