Установка InfluxDB для Icinga2
28 Apr 2017Небольшая инстррукция по установке и настройке InfluxDB для хранения perfdata сервисов Icinga2, а также по настройке модуля icingaweb2 для отображения графиков из grafana и influxdb.
InfluxDB
Добавляем репозиторий InfluxDB:
curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/lsb-release
echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
Устанавливаем и запускаем InfluxDB:
sudo apt-get update && sudo apt-get install influxdb
sudo service influxdb start
Создаем базу для метрик Icinga2:
root@icinga2:~# influx
Connected to http://localhost:8086 version 1.2.2
InfluxDB shell version: 1.2.2
> create database icinga2;
> create user icinga2 with password 'supersecret';
> grant all on icinga2 to icinga2;
> exit
Настройка Icinga2
Включаем InfluxdbWriter в Icinga2:
icinga2 feature enable influxdb
Настраиваем в файле /etc/icinga2/features-enabled/influxdb.conf:
/**
* The InfluxdbWriter type writes check result metrics and
* performance data to an InfluxDB HTTP API
*/
library "perfdata"
object InfluxdbWriter "influxdb" {
host = "127.0.0.1"
port = 8086
database = "icinga2"
username = "icinga"
password = "supersecret"
host_template = {
measurement = "$host.check_command$"
tags = {
hostname = "$host.name$"
}
}
service_template = {
measurement = "$service.check_command$"
tags = {
hostname = "$host.name$"
service = "$service.name$"
}
}
enable_send_thresholds = true
enable_send_metadata = true
}
Модуль icingaweb2-module-grafana
Установливаем модуль для отображения графиков в icingaweb2:
cd /usr/share/icingaweb2/modules
git clone https://github.com/Mikesch-mp/icingaweb2-module-grafana.git grafana
icingacli module enable grafana
Импортируем следующие dashboard в grafana (из архива модуля):
- base-metrics.json
- icinga2-default.json
Ссылки
- http://www.andremiller.net/content/grafana-and-influxdb-quickstart-on-ubuntu
- https://github.com/Mikesch-mp/icingaweb2-module-grafana
- https://www.icinga.com/2016/08/31/icinga-2-meets-influxdb/
- http://www.datacentred.co.uk/blog/integrating-icinga2-with-influxdb-and-grafana/
- https://docs.influxdata.com/influxdb/v1.2/tools/web_admin/


