Home » How to Configure Pm2 Health for sending mails if any issue in services

How to Configure Pm2 Health for sending mails if any issue in services

by Salman Chawhan
0 comment

Note: Replace yourdomain.com with you domain

pm2 config

sudo su

pm2 install pm2-health
vim ~/.pm2/module_conf.json

{
“pm2-logrotate”: {
“max_size”: “500M”,
“retain”: “200”,
“compress”: “true”,
“dateFormat”: “YYYY-MM-DD_HH-mm-ss”,
“workerInterval”: “30”,
“rotateInterval”: “* * * * 30”,
“rotateModule”: “true”
},
“module-db-v2”: {
“pm2-logrotate”: {},
“pm2-health”: {}
},
“pm2-health”: {
“smtp”: {
“host”: “mail.yourdomain.com“,
“port”: 465,
“user”: “notifications@yourdomain.com“,
“password”: “Email id password“,
“secure”: true,
“disabled”: false
},
“mailTo”: “developer@yourdomain.com“,
“replyTo”: “”,
“batchPeriodM”: 0,
“batchMaxMessages”: 0,
“events”: [
“exit”
],
“exceptions”: true,
“messages”: true,
“messageExcludeExps”: [],
“metric”: {},
“metricIntervalS”: 60,
“aliveTimeoutS”: 300,
“addLogs”: true,
“appsExcluded”: [],
“snapshot”: {
“url”: “”,
“token”: “”,
“auth”: {
“user”: “”,
“password”: “”
},
“disabled”: false
}
}
}

pm2 restart pm2-health

For testing mail is working or not

pm2 trigger pm2-health mail

You may also like

Leave a Comment

eighteen − eight =

Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?
-
00:00
00:00
Update Required Flash plugin
-
00:00
00:00