maanantai 11. heinäkuuta 2016

Monitor your applications and servers with Telegraf, InfluxDB and Grafana

Grafana with graphs from cpu, memory, mongodb

Telegraf

I stumbled upon a nice go project Telegraf which saves metrics from various sources to InfluxDB among others. I already had InfluxDB running so I gave it a shot.

There are two servers, Babylon, the internet facing and an other one named Black Pearl. Latter one is the Kubernetes master for a Raspberry Pi cluster. Installing Telegraf is easy enough.

Installation instructions from packages: https://github.com/influxdata/telegraf

I want to install this on docker images too so I did it like this:
sudo mkdir -p /work
cd /work
sudo curl -LO https://dl.influxdata.com/telegraf/releases/telegraf-1.0.0-beta2_linux_armhf.tar.gz
sudo tar xvzf telegraf-1.0.0-beta2_linux_armhf.tar.gz
cd telegraf
sudo cp etc/logrotate.d/* /etc/logrotate.d/
sudo mkdir -p /var/log/telegraf
sudo cp usr/bin/telegraf /usr/bin
sudo bash -c "telegraf -sample-config -input-filter cpu:mem:net:swap:mongodb -output-filter influxdb > 
/etc/telegraf/telegraf.conf"
sudo mkdir -p /etc/telegraf
sudo bash -c "nohup telegraf > /var/log/telegraf/telegraf.log 2>1 &"

On the raspberry pi, I also had to change the config line a bit,
cpu:mem:net:swap:mongodb -> cpu:mem:net:swap
since there is no mongodb on that instance.

Grafana

Grafana is a tool for making graph dashboards. Installing Grafana is easy. Adding a datasource is done straight from the UI, no need for config handling.
Adding a graph to a dashboard is easy too.
The main tab adding the graph is Metrics. You add the query there.

With Telegraf it's easy to get all metrics to a database and from there on using Grafana is a breeze.

Adding InfluxDB datasource to Grafana: http://docs.grafana.org/datasources/influxdb/
Telegraf: https://github.com/influxdata/telegraf
InfluxDB: https://influxdata.com/time-series-platform/influxdb/

Ei kommentteja:

Lähetä kommentti

Huomaa: vain tämän blogin jäsen voi lisätä kommentin.