Time Series1 databases are all the rage right now.
They were explicitly designed to store data sequentially, the same way time passes. For this playground, I’ve chosen InfluxDB. Prometheus2 is also very popular, and you could use the PostgreSQL extensions3 for time series as well.
Influx has its own dialect of SQL. Make sure you look at the docs4.
Setup
There isn’t much to configure when you set it up. I only modified the section for graphite (uncommenting if its already there, or pasting it in). Everything else is default.
1[[graphite]]
2 enabled = true
3 database = "graphite"
4 retention-policy = ""
5 bind-address = ":2003"
6 protocol = "tcp"
7 consistency-level = "one"
The whole config (with comments stripped out) looks like this:
1root@monitoring:~ # grep -v '^#' /usr/local/etc/influxd.conf | grep -v ' #' | grep -v '^$'
2[meta]
3 dir = "/var/db/influxdb/meta"
4[data]
5 dir = "/var/db/influxdb/data"
6 wal-dir = "/var/db/influxdb/wal"
7 series-id-set-cache-size = 100
8[coordinator]
9[retention]
10[shard-precreation]
11[monitor]
12[http]
13[logging]
14[subscriber]
15[[graphite]]
16 enabled = true
17 database = "graphite"
18 retention-policy = ""
19 bind-address = ":2003"
20 protocol = "tcp"
21 consistency-level = "one"
22[[collectd]]
23[[opentsdb]]
24[[udp]]
25[continuous_queries]
26[tls]
27root@monitoring:~ #
When we start it up
1root@monitoring:~ # sysrc influxd_enable=YES
2root@monitoring:~ # service influxd start
3root@monitoring:~ #
and then check what is listening, we can see
1root@monitoring:~ # sockstat -46l
2USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
3influxd influxd 66684 6 tcp4 127.0.0.1:8088 *:*
4influxd influxd 66684 7 tcp46 *:8086 *:*
5influxd influxd 66684 8 tcp46 *:2003 *:*
6root@monitoring:~ #
We can see that in addition to listening on the default 8088, and 8086, its also listening on 2003, as we configured above.
Creating a DB
1$ influx
2Connected to http://localhost:8086 version 1.8.0
3InfluxDB shell version: 1.8.0
4>
1CREATE DATABASE graphite WITH DURATION 52w
Hopefully this does the obvious. We now have a database created called graphite and it has a retention policy of 52w (data is rotoated out when it becomes that old).
Conclusion
OK, we have a database setup that we can use. What next? We have 2 more things to do (not an ordered list).
- Setup an agent that will collect information and put it in the database
- Setup grafana so we can visualize the information we’re collecting
Comments