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
Move the plugin installatin logic to the configuration
* Enable console and patternMatcher plugins by default
* Keep old way to extend the frontend (via plugins/index.js) for BC
* Rewrite the plugin documentation
Copy file name to clipboardExpand all lines: README.md
+45-19
Original file line number
Diff line number
Diff line change
@@ -12,17 +12,20 @@ Features
12
12
--------
13
13
14
14
* Monitor thousands of websites (powered by [Node.js asynchronous programming](http://dotheweb.posterous.com/nodejs-for-php-programmers-1-event-driven-pro))
15
-
* Check the presence of a pattern in the response body
16
15
* Tweak frequency of monitoring on a per-check basis, up to the second
17
-
* Receive on screen notifications whenever a check goes down (powered by [socket.io](http://socket.io/))
18
-
* Receive email notifications whenever a check goes down
16
+
* Check the presence of a pattern in the response body
17
+
* Receive notifications whenever a check goes down
18
+
* On screen (powered by [socket.io](http://socket.io/))
19
+
* By email
20
+
* On the console
19
21
* Record availability statistics for further reporting (powered by [MongoDB](http://www.mongodb.org/))
20
22
* Detailed uptime reports with animated charts (powered by [Flotr2](http://www.humblesoftware.com/flotr2/))
21
23
* Monitor availability, responsiveness, average response time, and total uptime/downtime
22
24
* Get details about failed checks (HTTP error code, etc.)
23
25
* Group checks by tags and get reports by tag
24
26
* Familiar web interface (powered by [Twitter Bootstrap 2.0](http://twitter.github.com/bootstrap/index.html))
25
27
* Complete API for integration with third-party monitoring services
28
+
* Powerful plugin system to ease extension and customization
26
29
* Easy installation and zero administration
27
30
28
31
Installing Uptime
@@ -91,6 +94,11 @@ autoStartMonitor: true
91
94
92
95
server:
93
96
port: 8082
97
+
98
+
plugins:
99
+
- ./plugins/console
100
+
- ./plugins/patternMatcher
101
+
# - ./plugins/email
94
102
```
95
103
96
104
To modify this configuration, create a `development.yaml` or a `production.yaml` file in the same directory, and override just the settings you need. For instance, to run Uptime on port 80 in production, create a `production.yaml` file as follows:
@@ -100,7 +108,7 @@ server:
100
108
port: 80
101
109
```
102
110
103
-
Node that Uptime works great behind a proxy - it uses the http_proxy environment variable transparently.
111
+
Node that Uptime works great behind a proxy - it uses the `http_proxy` environment variable transparently.
104
112
105
113
Architecture
106
114
------------
@@ -128,37 +136,55 @@ You can even run several monitor servers in several datacenters to get average r
128
136
Using Plugins
129
137
-------------
130
138
131
-
Uptime provides plugins that you can enable to add more functionality. Plugins can add more notification types, more poller types, new routes to the webapp, etc. To enable plugins, create a `plugins/index.js` module. Uptime automatically requires this module when starting the webapp and the monitor, and tries to call the two following functions:
139
+
Plugins can add more notification types, more poller types, new routes to the webapp, etc. Uptime currently bundles three plugins:
132
140
133
-
* `initWebApp()` when starting the webapp
134
-
* `initMonitor()` when starting the monitor
141
+
* [`console`](https://github.com/fzaninotto/uptime/blob/master/plugins/console/index.js): log pings and events in the console in real time
142
+
* [`email`](https://github.com/fzaninotto/uptime/blob/master/plugins/email/index.js): notify events (up, down pause) by email
143
+
* [`patternMatcher`](https://github.com/fzaninotto/uptime/blob/master/plugins/patternMatcher/index.js): allow HTTP & HTTPS pollers to test the response body against a pattern
135
144
136
-
For instance, to enable the `console` plugin:
145
+
To enable plugins, just add a line to the `plugins:` section of the configuration file.
146
+
Two of the bundled plugins are already enabled by default:
137
147
138
-
```js
139
-
// in plugins/index.js
140
-
exports.initWebApp = function() {
141
-
require('./console').init();
142
-
};
148
+
```yaml
149
+
# in config/default.yaml
150
+
plugins:
151
+
- ./plugins/console
152
+
- ./plugins/patternMatcher
153
+
# - ./plugins/email
143
154
```
144
155
145
-
Uptime currently bundles three plugins. Check their documentation for installation/configuration instructions:
156
+
You can override these settings in your environment configuration, for instance:
146
157
147
-
* [`console`](https://github.com/fzaninotto/uptime/blob/master/plugins/console/index.js): log pings and events in the console in real time
148
-
* [`email`](https://github.com/fzaninotto/uptime/blob/master/plugins/email/index.js): notify events (up, down pause) by email
149
-
* [`patternMatcher`](https://github.com/fzaninotto/uptime/blob/master/plugins/patternMatcher/index.js): allow HTTP & HTTPS pollers to test the response body against a pattern
158
+
```yaml
159
+
# in config/production.yaml
160
+
# disable the console plugin and enable the email plugin
161
+
plugins:
162
+
# - ./plugins/console
163
+
- ./plugins/patternMatcher
164
+
- ./plugins/email
165
+
```
150
166
151
167
Third-party plugins:
152
168
153
169
* [`webhooks`](https://github.com/mintbridge/uptime-webhooks): notify events to an URL by sending an HTTP POST request
154
170
* [`campfire`](https://gist.github.com/dmathieu/5592418): notify events to Campfire
155
171
156
-
You can also create your own plugins. For instance, if you had to recreate a simple version of the `console` plugin, you could write it as follows:
172
+
Writing Plugins
173
+
---------------
174
+
175
+
A plugin is a simple Node.js module which hooks into predefined extension points. Uptime automatically requires plugin modules when starting the webapp and the monitor, and tries to call the two following functions:
176
+
177
+
* `initWebApp(options)` when starting the webapp
178
+
* `initMonitor(options)` when starting the monitor
179
+
180
+
Check the [app.js](https://github.com/fzaninotto/uptime/blob/master/app.js#L97) and [monitor.js](https://github.com/fzaninotto/uptime/blob/master/monitor.js#L8) to see a detail of the options passed to each hook. Also, check the code of existing plugins to understand how they can add new pollers, new notification types, etc.
181
+
182
+
For instance, if you had to recreate a simple version of the `console` plugin, you could write it as follows:
157
183
158
184
```js
159
185
// in plugins/console/index.js
160
186
var CheckEvent = require('../../models/checkEvent');
0 commit comments