You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+80-67Lines changed: 80 additions & 67 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,54 +27,36 @@
27
27
- Temperature, speed, latency, and memory tracking
28
28
- Process monitoring
29
29
30
-
# Quick start
30
+
##Quick start
31
31
32
-
Install dependencies
32
+
### Install dependencies
33
33
34
34
```
35
35
npm install chronos-tracker
36
36
```
37
37
38
-
Create `chronos-config.js` within the **same directory** as your `server.js`
38
+
### Create a `chronos-config.js`
39
39
40
40
```js
41
+
// An example `chronos-config.js` file
42
+
41
43
constchronos=require('chronos-tracker');
42
44
43
-
cmd.use({
44
-
microservice:'chronos-mon-2',
45
-
interval:3000,
45
+
chronos.use({
46
+
microservice:'payments',
47
+
interval:2000,
46
48
dockerized:true,
47
49
database: {
48
50
type:'MongoDB',
49
-
URI:/* NEW DATABASE URI */,
51
+
URI:process.env.MONGO_URI,
50
52
},
51
-
notifications: [
52
-
{
53
-
type:'slack',
54
-
settings: {
55
-
slackurl:/* YOUR SLACK WEBHOOK URL*/,
56
-
},
57
-
},
58
-
{
59
-
type:'email',
60
-
settings: {
61
-
emails:/* EMAIL RECIPIENT LIST */,
62
-
emailHost:/* EMAIL HOST */,
63
-
emailPort:/* EMAIL PORT */,
64
-
user:/* SENDER EMAIL ADDRESS */,
65
-
password:process.env.EMAIL_PASSWORD,
66
-
},
67
-
},
68
-
],
53
+
notifications: [],
69
54
});
70
55
```
71
56
72
-
Refer to section setup for more information on these properties
73
-
74
-
75
-
_NOTE: Email notification settings may require alternative security settings to work_
57
+
**More information on configuring Chronos and setting up notifications below**
76
58
77
-
Initialize chronos
59
+
### Initialize chronos
78
60
79
61
```js
80
62
constcmd=require('chronos-tracker');
@@ -84,14 +66,14 @@ cmd.propagate();
84
66
app.use('/', cmd.track());
85
67
```
86
68
87
-
Download Chronos to view your application data [here]()
69
+
**Download Chronos** to start monitoring your application data [here]()
88
70
89
71
<!-- # Installation
90
72
91
73
Chronos consists of a [Node](https://nodejs.org/en/) module available through the
92
74
[npm registry](https://www.npmjs.com/) and a lightweight [Electron](https://electronjs.org/) desktop application. -->
93
75
94
-
#Containerized Applications Using Docker
76
+
## Docker - Containerized Applications
95
77
96
78
IMPORTANT: Give your containers the same names you use for arguments for microservice names. Read more about it under the INSTALLATION section below.
97
79
@@ -111,25 +93,76 @@ volumes:
111
93
\*Note: This module leverages the features of [systeminformation](https://systeminformation.io/).
112
94
113
95
114
-
## Configuration Setup
115
-
116
-
-[1] microserviceName: To identify the microservice (i.e. "payments").
117
-
- Make sure this name matches your container name. More details more below (param #6).
118
-
- Your input name for the microservice will be turned to an all-lowercase string.
119
-
-[2] databaseType: Enter either "mongo" or "sql".
120
-
-[3] databaseURL: Enter the URL of your database.
121
-
-[4] wantMicroHealth: Do you want to monitor the health of this microservice? Enter "yes" or "no".
122
-
- Note: If you choose "yes" for this param, the middleware will NOT log container stats. In other words, if you want container stats instead, input "no" here and "yes" for param #6.
123
-
-[5] queryFrequency (optional): How frequently do you want to log the health of this microservice? It defaults to every minute, but you can choose:
124
-
- "s" : every second
125
-
- "m" : every minute (default)
126
-
- "h" : every hour
127
-
- "d" : once per day
128
-
- "w" : once per week
96
+
## Configuration
97
+
98
+
The `microservice` property takes in a string. This should be the name of your server or microservice. For **Docker** containers, the same name of the microservice should reflect the name of the corresponding Docker container.
99
+
100
+
The `interval` property is optional and takes in an integer in milliseconds. This controls the monitoring frequency between data points. If this is omitted, Chronos will defualt to recording server health every 2000 ms or 2 seconds.
101
+
102
+
The `dockerized` property is optional and should be specified as `true` if the server is running inside of a Docker container. Otherwise, this should be `false`. If omitted, Chronos will assume this server is not running in a container.
103
+
104
+
The `database` property is required. T takes in the following:
105
+
-`type` which should be a string and only supports 'MongoDB' and 'PostgreSQL'.
106
+
-`URI` which should be a connection string the database you intend Chronos to write and record data regarding health, communication, and container infomation to. A `.env` is recommended.
107
+
129
108
-[6] isDockerized: Is this microservice running in a Docker container? Enter "yes" or "no". (Defaults to "no".)
130
109
- IMPORTANT: When starting up the container, give it the same name that you used for the microservice, because the middleware finds the correct container ID of your container by matching the container name to the microservice name you input as 1st argument.
131
110
- Don't forget to bind mount to Docker socket. See NEW FEATURE section above.
132
111
112
+
## Notifications
113
+
114
+
The `notifications` property is optional and allows developers to set up notifications when the monitored server responds to request with status codes >= 400. To set up notifications, set the value of the `notifications` property to an array of objects each with a `type` and `settings` property.
115
+
116
+
Chronos only supports Slack and email notifications.
117
+
118
+
### Slack
119
+
120
+
Chronos uses the **Slack API** to send messages to a Slack channel and only requires the **webhook url**. Learn how to set up [Slack webhooks](https://api.slack.com/messaging/webhooks) for your team.
121
+
122
+
An example of configured **slack** settings:
123
+
124
+
```js
125
+
// ...
126
+
notifications: [
127
+
{
128
+
type:'email',
129
+
settings: {
130
+
slackurl:process.env.WEBHOOK
131
+
}
132
+
}
133
+
]
134
+
// ...
135
+
```
136
+
137
+
### Email
138
+
139
+
Chronos provides the option to send emails. The properties that should be provided are the following
140
+
-`emails` - The recipient list (string) can be a single email address or multiple as comma seprated values.
141
+
-`emailHost` - The smtp host (string) of your email server
142
+
-`emailPort` - The email port (integer) is either **465** or **587** depending on the sender email security settings. Learn more about email ports at the [nodemailer docs](https://nodemailer.com/smtp/)
143
+
-`user` - The email address (string) of the sender
144
+
-`password` - The password (string) of the sender email
145
+
146
+
_NOTE: Email notification settings may require alternative security settings to work_
0 commit comments