## Objective

The goal is to create a working monitoring system with TICK (Telegraf + InfluxDB + Chronograf + Kapacitor) plus Grafana on Debian 9.8. It's really straight forward in simple but have to remind you this is really insecure as setup by default. To make it a little better you need to enable authentication, use SSL certificates, and setup some very tight IPTable settings. This will not be covered, this is just something I build on my lab and is this is more of a note taking session as I've chosen to change up the software selection, more on that in another post.

## To Begin

This is based off of a brand new Debian 9.8 install on around April 14-16th. Normal install, no desktop, no printer, yes for SSH server.

First things first, always make sure the system is up to date:

apt-get update && apt-get upgrade


Now we need to install some packages, sudo and net-tools are not needed if you want to ignore them:

apt-get -y install curl sudo apt-transport-https net-tools


After that we're going to need to add the influx apt repo and the grafana repo. First we're going to grab their apt keys, then the repos under /etc/apt/sources.list.d:

curl https://repos.influxdata.com/influxdb.key | apt-key add -
curl https://packages.grafana.com/gpg.key | apt-key add -


Then add the repos:

echo "deb https://repos.influxdata.com/debian stretch stable" > /etc/apt/sources.list.d/influx.list
echo "deb https://packages.grafana.com/oss/deb stable main" > /etc/apt/sources.list.d/grafana.list


In order to use the new repos to install software we need to run apt-get update again, so do that now.

apt-get update


And now we install the TICK stack and Grafana

apt-get -y install influxdb telegraf chronograf kapacitor grafana


## Post Install

At this point everything is installed. InfluxDB, Telegraf, and Kapactior are all enabled (to start on boot) by default, Grafana is not. Also Telegraf and Kapacitor are run upon installation, InfluxDB and Grafana are not. I also like to keep a copy of the config files that are installed by default in the event I need to revert or diff the original. Again, this is all in a lab, this is not production worth but it could be with some more work. So first we're going to backup the config files the traditional way, by adding -dist to them. So we run:

cp /etc/telegraf/telegraf.conf /etc/telegraf/telegraf.conf-dist
cp /etc/influxdb/influxdb.conf /etc/influxdb/influxdb.conf-dist
cp /etc/kapacitor/kapacitor.conf /etc/kapacitor/kapacitor.conf-dist
cp /etc/grafana/grafana.ini /etc/grafana/grafana.ini-dist


Note: Chronograf does not have any external config file (source)

Next we're just going to make sure all of our services are enabled upon reboot. All but Grafana are, but in the event that changes, just's just make sure by enabling everything

systemctl enable telegraf influxdb chronograf kapacitor grafana-server


And let's make sure everything is started, the two that really need it are InfluxDB and Grafana, but if that changes let's just make sure they are all started by running

systemctl start telegraf influxdb chronograf kapacitor grafana-server


## Accessing installed services

So now you're going to want to configure Grafana by going to your ip address on port 3000 like this: http://192.168.100.100:3000 (default login is admin:admin). You can access Chronograf on port 8888 the same way like http://192.168.100.100:8888. To access InfluxDB directly, you will want to use your commandline and type in influx to get a prompt like this

Connected to http://localhost:8086 version 1.7.4
InfluxDB shell version: 1.7.4
Enter an InfluxQL query
>


## Conclusion

This is just something I have been playing with recently. I've used the TICK stack before, still not really a fan of InfluxDB, the rest of it seems alright. Looking through the various guides online I found a lot of inaccurate junk so I decided to put my notes up here. There will be other guides working with Prometheus in high-availability setups as soon as I find the time.

## Further Reading

List of Telegraf plugins
The ones that should be there by default: net, syslog, S.M.A.R.T
InfluxDB Glossary of Terms
Schema Exploration