1 |
|
2 | ## How to Install
|
3 |
|
4 |
|
5 | ```js
|
6 |
|
7 | $ npm install pm2-monitor
|
8 | $ npm install -g pm2-monitor
|
9 |
|
10 | ```
|
11 |
|
12 | ### Options
|
13 |
|
14 | Pm2-monitor has several options, in order to change them access the config.js file
|
15 | ```js
|
16 | server:{
|
17 | port:10021, //port that pm2 will be hosted
|
18 | host:'localhost' //if access is outside closed network, use real Ip Address,
|
19 | refresh: 2 //(seconds) refresh rate
|
20 |
|
21 | },
|
22 | startup:{
|
23 | path:'./scripts/pm2_startup.json' //location and name for startup script
|
24 | },
|
25 | auth:
|
26 | {
|
27 | required:false, // true for basic http authentication,false for no authentication
|
28 | file:'./pm2_authfile' //do not change
|
29 | },
|
30 | notification:
|
31 | {
|
32 | email:{
|
33 | active:false, //activates notification by email
|
34 | limits:{
|
35 |
|
36 | memory:50, //Memory usage limit to send email
|
37 | cpu:50 //Cpu usage limit to send email
|
38 |
|
39 | },
|
40 |
|
41 | smtp:{
|
42 | host: 'smtp.yourserver.com', //setup your email provider
|
43 | port: 587, //provider port
|
44 | secure:false, //provider uses ssl or not
|
45 | ignoreTLS:true,
|
46 | auth: {
|
47 | user: 'username@email.com',
|
48 | pass: 'password'
|
49 |
|
50 | }
|
51 | },
|
52 | emailTo:'recipient', //email that will receive notifications
|
53 | emailFrom:'no-reply@email.com' //email to appear as sender
|
54 | },
|
55 | sms:{
|
56 |
|
57 | active:false, //activates notification by SMS
|
58 | tels:[
|
59 | {"gsm":"telephone"}, //celulars to receive notification
|
60 | {gsm:"telephone2"}
|
61 | ],
|
62 | limits:{
|
63 | memory:80,
|
64 | cpu:80
|
65 | },
|
66 | auth:{
|
67 | user:'username', //infoBIP username
|
68 | pass:'password' //infoBIP password
|
69 | }
|
70 | //In order to receive SMS, an infobip account must be created ...
|
71 | //http://br.infobip.com/
|
72 |
|
73 | },
|
74 | frequency:60 //(seconds) frequency that notifications will be sent (if limits are reached)
|
75 | }
|
76 |
|
77 | ```
|
78 |
|
79 | ### Starting pm2-monit
|
80 |
|
81 | To start the process, you need to have pm2 up and running.
|
82 | ```js
|
83 |
|
84 | $ sudo node pm2_monitor.js
|
85 | $ sudo node pm2_monitor.js user password //to create user
|
86 |
|
87 | //note that pm2_monitor may be started within pm2
|
88 | // sudo pm2 start pm2_monitor.js
|
89 |
|
90 | ```
|
91 |
|
92 | ### Graphs Description
|
93 |
|
94 |
|
95 | ```js
|
96 |
|
97 | Total Memory Usage //displays the memory usage of the server running pm2-monitor
|
98 | Total Cpu Usage //displays the cpu usage of the server running pm2-monitor
|
99 |
|
100 | ```
|
101 |
|
102 |
|
103 | ## License
|
104 |
|
105 | MIT |
\ | No newline at end of file |