1
|
1 |
|
|
2 |
Netdata-TSRelay
|
|
3 |
===============
|
|
4 |
|
|
5 |
What's this?
|
|
6 |
------------
|
|
7 |
|
|
8 |
This program is designed to accept JSON streams from
|
|
9 |
[Netdata](http://netdata.io) clients, and write metrics to a PostgreSQL table -
|
|
10 |
specifically, [Timescale](http://timescale.com) backed tables (though
|
|
11 |
that's not technically a requirement.)
|
|
12 |
|
|
13 |
|
|
14 |
Installation
|
|
15 |
------------
|
|
16 |
|
|
17 |
You'll need a working [Nim](http://nim-lang.org) build environment to
|
|
18 |
create the binary.
|
|
19 |
|
|
20 |
Simply run `make release` to produce the binary. Put it wherever you
|
|
21 |
please.
|
|
22 |
|
|
23 |
|
|
24 |
Configuration
|
|
25 |
-------------
|
|
26 |
|
|
27 |
There are a few assumptions that should be satisfied before running
|
|
28 |
this.
|
|
29 |
|
|
30 |
### Database setup
|
|
31 |
|
|
32 |
You'll need to create the destination table.
|
|
33 |
|
|
34 |
```sql
|
|
35 |
CREATE TABLE netdata (
|
|
36 |
time timestamptz default now() not null,
|
|
37 |
host text not null,
|
|
38 |
metrics jsonb default '{}'::jsonb not null
|
|
39 |
);
|
|
40 |
```
|
|
41 |
|
|
42 |
Index it however you please based on how you intend to query the data,
|
|
43 |
including JSON functional indexing, etc. See PostgreSQL documentation
|
|
44 |
for details.
|
|
45 |
|
|
46 |
Strongly encouraged: Promote this table to a Timescale "hypertable".
|
|
47 |
See Timescale docs for that.
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
### Netdata
|
|
52 |
|
|
53 |
You'll likely want to pare down what netdata is sending. Here's an
|
|
54 |
example configuration for `netdata.conf`:
|
|
55 |
|
|
56 |
```
|
|
57 |
[backend]
|
|
58 |
hostname = your-hostname
|
|
59 |
enabled = yes
|
|
60 |
type = json
|
|
61 |
data source = average
|
|
62 |
destination = machine-where-netdata-tsrelay-lives:14866
|
|
63 |
prefix = n
|
|
64 |
update every = 10
|
|
65 |
buffer on failures = 6
|
|
66 |
send charts matching = !cpu.cpu* !ipv6* nfs.rpc net.* net_drops.* net_packets.* !system.interrupts* system.* disk.* disk_space.* disk_ops.* mem.* users.*
|
|
67 |
```
|
|
68 |
|