author | Mahlon E. Smith <mahlon@laika.com> |
Sun, 18 Feb 2018 23:40:34 -0800 | |
changeset 10 | 252cdb26f76b |
parent 5 | a1276c3d39eb |
child 11 | 475c9942eb15 |
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 |
|
10
252cdb26f76b
Fix the netdata link to point the the right spot.
Mahlon E. Smith <mahlon@laika.com>
parents:
5
diff
changeset
|
9 |
[Netdata](https://my-netdata.io/) clients, and write metrics to a |
252cdb26f76b
Fix the netdata link to point the the right spot.
Mahlon E. Smith <mahlon@laika.com>
parents:
5
diff
changeset
|
10 |
PostgreSQL table - specifically, [Timescale](http://timescale.com) |
252cdb26f76b
Fix the netdata link to point the the right spot.
Mahlon E. Smith <mahlon@laika.com>
parents:
5
diff
changeset
|
11 |
backed tables (though that's not technically a requirement.) |
1 | 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 |
|
10
252cdb26f76b
Fix the netdata link to point the the right spot.
Mahlon E. Smith <mahlon@laika.com>
parents:
5
diff
changeset
|
59 |
example configuration for `netdata.conf` -- you will want to season |
252cdb26f76b
Fix the netdata link to point the the right spot.
Mahlon E. Smith <mahlon@laika.com>
parents:
5
diff
changeset
|
60 |
this to taste. |
1 | 61 |
|
62 |
``` |
|
63 |
[backend] |
|
64 |
hostname = your-hostname |
|
65 |
enabled = yes |
|
66 |
type = json |
|
67 |
data source = average |
|
68 |
destination = machine-where-netdata-tsrelay-lives:14866 |
|
69 |
prefix = n |
|
70 |
update every = 10 |
|
71 |
buffer on failures = 6 |
|
5 | 72 |
send charts matching = !cpu.cpu* !ipv6* !users* nfs.rpc net.* net_drops.* net_packets.* !system.interrupts* system.* disk.* disk_space.* disk_ops.* mem.* |
1 | 73 |
``` |
74 |