From aebe51c9e882c33a4fd28ae498031f4ea7a5d304 Mon Sep 17 00:00:00 2001 From: "Mahlon E. Smith" Date: Mon, 12 Feb 2018 12:49:12 -0800 Subject: [PATCH] Add README. --- README.md | 68 +++++++++++++++++++++++++++++++++++++++++++++ netdata_tsrelay.nim | 2 -- 2 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..f0c4d01 --- /dev/null +++ b/README.md @@ -0,0 +1,68 @@ + +Netdata-TSRelay +=============== + +What's this? +------------ + +This program is designed to accept JSON streams from +[Netdata](http://netdata.io) clients, and write metrics to a PostgreSQL table - +specifically, [Timescale](http://timescale.com) backed tables (though +that's not technically a requirement.) + + +Installation +------------ + +You'll need a working [Nim](http://nim-lang.org) build environment to +create the binary. + +Simply run `make release` to produce the binary. Put it wherever you +please. + + +Configuration +------------- + +There are a few assumptions that should be satisfied before running +this. + +### Database setup + +You'll need to create the destination table. + +```sql +CREATE TABLE netdata ( + time timestamptz default now() not null, + host text not null, + metrics jsonb default '{}'::jsonb not null +); +``` + +Index it however you please based on how you intend to query the data, +including JSON functional indexing, etc. See PostgreSQL documentation +for details. + +Strongly encouraged: Promote this table to a Timescale "hypertable". +See Timescale docs for that. + + + +### Netdata + +You'll likely want to pare down what netdata is sending. Here's an +example configuration for `netdata.conf`: + +``` +[backend] + hostname = your-hostname + enabled = yes + type = json + data source = average + destination = machine-where-netdata-tsrelay-lives:14866 + prefix = n + update every = 10 + buffer on failures = 6 + send charts matching = !cpu.cpu* !ipv6* nfs.rpc net.* net_drops.* net_packets.* !system.interrupts* system.* disk.* disk_space.* disk_ops.* mem.* users.* +``` + diff --git a/netdata_tsrelay.nim b/netdata_tsrelay.nim index 1998790..65a4908 100644 --- a/netdata_tsrelay.nim +++ b/netdata_tsrelay.nim @@ -139,8 +139,6 @@ proc serverloop: void = ## and start serving incoming netdata streams. let db = open( "", "", "", conf.dbopts ) echo "Successfully connected to the backend database." - #SELECT TIMESTAMP WITH TIME ZONE 'epoch' + 982384720 * INTERVAL '1 second';' - #db.close var server = newSocket() echo "Listening for incoming connections on port ", conf.listen_port, "..."