author | Mahlon E. Smith <mahlon@laika.com> |
Mon, 12 Feb 2018 13:00:25 -0800 | |
changeset 3 | f34855556f4d |
parent 1 | 160338bb2822 |
child 5 | a1276c3d39eb |
permissions | -rw-r--r-- |
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". |
|
3
f34855556f4d
Add timescale creation example.
Mahlon E. Smith <mahlon@laika.com>
parents:
1
diff
changeset
|
47 |
See Timescale docs for that, but a quick example to partition |
f34855556f4d
Add timescale creation example.
Mahlon E. Smith <mahlon@laika.com>
parents:
1
diff
changeset
|
48 |
automatically at weekly boundaries would look something like: |
f34855556f4d
Add timescale creation example.
Mahlon E. Smith <mahlon@laika.com>
parents:
1
diff
changeset
|
49 |
|
f34855556f4d
Add timescale creation example.
Mahlon E. Smith <mahlon@laika.com>
parents:
1
diff
changeset
|
50 |
```sql |
f34855556f4d
Add timescale creation example.
Mahlon E. Smith <mahlon@laika.com>
parents:
1
diff
changeset
|
51 |
SELECT create_hypertable( 'netdata', 'time', chunk_time_interval => 604800000000 ); |
f34855556f4d
Add timescale creation example.
Mahlon E. Smith <mahlon@laika.com>
parents:
1
diff
changeset
|
52 |
``` |
1 | 53 |
|
54 |
||
55 |
||
56 |
### Netdata |
|
57 |
||
58 |
You'll likely want to pare down what netdata is sending. Here's an |
|
59 |
example configuration for `netdata.conf`: |
|
60 |
||
61 |
``` |
|
62 |
[backend] |
|
63 |
hostname = your-hostname |
|
64 |
enabled = yes |
|
65 |
type = json |
|
66 |
data source = average |
|
67 |
destination = machine-where-netdata-tsrelay-lives:14866 |
|
68 |
prefix = n |
|
69 |
update every = 10 |
|
70 |
buffer on failures = 6 |
|
71 |
send charts matching = !cpu.cpu* !ipv6* nfs.rpc net.* net_drops.* net_packets.* !system.interrupts* system.* disk.* disk_space.* disk_ops.* mem.* users.* |
|
72 |
``` |
|
73 |