Monitorings

Telegraf

wget https://dl.influxdata.com/telegraf/releases/telegraf_1.1.1_amd64.deb
sudo dpkg -i telegraf_1.1.1_amd64.deb
sudo systemctl start telegraf

sudo mv /etc/telegraf/telegraf.conf /etc/telegraf/telegraf.conf.old sudo vim /etc/telegraf/telegraf.conf

[tags]
 
# Configuration for telegraf agent
[agent]
  debug = false
  flush_buffer_when_full = true
  flush_interval = "15s"
  flush_jitter = "0s"
  hostname = "hostname_de_ma_machine"
  interval = "15s"
  round_interval = true

sudo vim /etc/telegraf/telegraf.d/outputs.conf

[[outputs.influxdb]]
  database = "telegraf"
  precision = "s"
  urls = [ "http://127.0.0.1:8086" ]
  username = "telegraf"
  password = "password"

sudo vim /etc/telegraf/telegraf.d/inputs_system.conf

# Read metrics about CPU usage
[[inputs.cpu]]
  percpu = false
  totalcpu = true
  fieldpass = [ "usage*" ]
 
# Read metrics about disk usagee
[[inputs.disk]]
  fielddrop = [ "inodes*" ]
  mount_points=["/","/home"]
 
# Read metrics about diskio usage
[[inputs.diskio]]
  devices = ["sda2","sda3"]
  skip_serial_number = true
 
# Read metrics about network usage
[[inputs.net]]
  interfaces = [ "eth0" ]
  fielddrop = [ "icmp*", "ip*", "tcp*", "udp*" ]
 
# Read metrics about memory usage
[[inputs.mem]]
  # no configuration
 
# Read metrics about swap memory usage
[[inputs.swap]]
  # no configuration
 
# Read metrics about system load & uptime
[[inputs.system]]
  # no configuration

InfluxDB

wget https://dl.influxdata.com/influxdb/releases/influxdb_1.1.0_amd64.deb
sudo dpkg -i influxdb_1.1.0_amd64.deb
sudo systemctl start influxdb

sudo influx
>CREATE DATABASE telegraf
>CREATE USER telegraf WITH PASSWORD 'password'
>GRANT ALL ON telegraf TO telegraf
>CREATE RETENTION POLICY thirty_days ON telegraf DURATION 30d REPLICATION 1 DEFAULT
>exit

Kapacitor

wget https://dl.influxdata.com/kapacitor/releases/kapacitor_1.1.0_amd64.deb
sudo dpkg -i kapacitor_1.1.0_amd64.deb
sudo systemctl start kapacitor

Chronograf

wget https://dl.influxdata.com/chronograf/nightlies/chronograf_nightly_amd64.deb
sudo dpkg -i chronograf_nightly_amd64.deb
sudo systemctl start chronograf
http://localhost:8888

Grafana

$ wget https://grafanarel.s3.amazonaws.com/builds/grafana_4.0.0-1480439068_amd64.deb
$ sudo apt-get install -y adduser libfontconfig
$ sudo dpkg -i grafana_4.0.0-1480439068_amd64.deb

Grafana is a fantastic dashboard/graph tool for Graphite, InfluxDB & OpenTSDB.

Everyone knows that the standard configuration of graphite is terrible and well…really ugly. I used Grafana 2.0.2 in this tutorial. If you want to run Grafana in a subdirectory you have to change the Grafana configuration and add a apache configuration.

Open the file vi /etc/grafana/grafana.ini and go to the following line:

;root_url = %(protocol)s:%(domain)s:%(http_port)s/ Remove the comma in the beginning of the line and add after the backslash the name of the subdirectory. e.g.: root_url = %(protocol)s:%(domain)s:%(http_port)s/grafana/

Restart the grafana server:

/etc/init.d/grafana-server restart

The direct access via port number 3000 is now no longer possible. You get a page, but because of our change of the root_url the base_path is wrong.

For the apache configuration go to: /etc/apache2/sites-available Create a new file (like grafana.conf) with the following content:

  ProxyPreserveHost On
  ProxyPass /grafana http://0.0.0.0:3000
  ProxyPassReverse /grafana http://0.0.0.0:3000

Replace “grafana” with the name of your subdirectory.

For those who want to run grafana with a subdomain can ignore the changes I made in the grafana.ini and just create a grafana.conf file in /etc/apache2/sites-available with the following content

<VirtualHost *:80>

  ProxyPreserveHost On
  ProxyPass / http://localhost:3000/
  ProxyPassReverse / http://localhost:3000/
  Servername grafana.wiretime.de

</VirtualHost>

Don't forget to change the Servername!

The apache modules proxy and proxy_http have to be enabled so that this configuration can work.

a2enmod proxy_http a2enmod proxy

Enable the grafana.conf

a2ensite Apache grafana.conf

and restart/reload apache

/etc/init.d/apache2 reload

Questions are welcome!

Source


QR Code
QR Code monitoring (generated for current page)