1 | # Server Interface
|
2 |
|
3 | Server modules are Node.js [modules][nodemods] that receive metrics for StatsD.
|
4 | Server interfaces can be distributed and installed via systems such as NPM.
|
5 |
|
6 | Each server module should export the following initialization function:
|
7 |
|
8 | * `start(config, callback)`: This method is invoked from StatsD to initialize
|
9 | and start the server module listening for metrics. It accepts two
|
10 | parameters: `config` is the parsed config file hash and `callback` is a
|
11 | function to call with metrics data, when it's available.
|
12 |
|
13 | The callback function accepts two parameters: `packet` contains one or more
|
14 | metrics separated by the \n character, and `rinfo` contains remote address
|
15 | information.
|
16 |
|
17 | The server module should return `true` from start() to indicate
|
18 | success. A return of `false` indicates a failure to load the module
|
19 | (missing configuration?) and will cause StatsD to exit.
|
20 |
|
21 | # Available third-party interfaces
|
22 |
|
23 | * [http-interface](https://github.com/msiebuhr/statsd-http-interface) Accepts data over HTTP.
|