Icinga2 mit Grafana und Influxdb: Unterschied zwischen den Versionen

Aus xinux.net
Zur Navigation springen Zur Suche springen
Zeile 65: Zeile 65:
  
 
==Configuration==
 
==Configuration==
*vim /etc/icingaweb2/modules/grafana/config.ini
+
*vi /etc/icingaweb2/modules/grafana/config.ini
 
<pre>
 
<pre>
 
[grafana]
 
[grafana]
username = "your grafana username"
+
username = "icinga2"
 
host = "hostname:3000"
 
host = "hostname:3000"
protocol = "https"
+
protocol = "http"
password = "123456"
+
password = "geheim"
 
height = "280"
 
height = "280"
 
width = "640"
 
width = "640"
Zeile 79: Zeile 79:
 
datasource = "influxdb"
 
datasource = "influxdb"
 
defaultdashboardstore = "db"
 
defaultdashboardstore = "db"
accessmode = "proxy"
+
accessmode = "direct"
timeout = "5"
+
directrefresh = "yes"
directrefresh = "no"
+
</pre>
 +
 
 +
*vi /etc/icingaweb2/modules/grafana/graphs.ini
 +
<pre>
 +
[icinga2 default]
 +
dashboard = "icinga2-default.json"
 +
panelId = "1, 2, 3, 5, 6, 8, 9"
 +
height = "280"
 +
width = "460"
 
</pre>
 
</pre>

Version vom 2. Mai 2017, 14:52 Uhr

Vorraussetzungen

InfluxDB

  • apt-get install influxdb influxdb-client
root@localhost:~# influx
Connected to http://localhost:8086 version 0.13.0
InfluxDB shell version: 0.13.0
> create database icinga2;
> create user icinga2 with password ‘geheim’;
> grant all on icinga2 to icinga2;
  • vi /etc/icinga2/features-enabled/influxdb.conf
    object InfluxdbWriter "influxdb" {
    host = "127.0.0.1"
    port = 8086
    database = "icinga2"
    username = "icinga2"
    password = "geheim"
    enable_send_thresholds = true
    enable_send_metadata = true
    host_template = {
    measurement = “$host.check_command$”
    tags = {
    hostname = “$host.name$”
    }
    }

    service_template = {
    measurement = “$service.check_command$”
    tags = {
    hostname = “$host.name$”
    service = “$service.name$”
    }
    }

    }

Feature enabled

  • icinga2 feature enable influxdb
  • systemctl restart icinga2.service

Grafana

Installation

Module hinzufügen

Module enabled

  • icingacli module enable grafana
  • systemctl restart icinga2.service

Configuration

  • vi /etc/icingaweb2/modules/grafana/config.ini
[grafana]
username = "icinga2"
host = "hostname:3000"
protocol = "http"
password = "geheim"
height = "280"
width = "640"
timerange = "3h"
enableLink = "yes"
defaultdashboard = "icinga2-default"
datasource = "influxdb"
defaultdashboardstore = "db"
accessmode = "direct"
directrefresh = "yes"
  • vi /etc/icingaweb2/modules/grafana/graphs.ini
[icinga2 default]
dashboard = "icinga2-default.json"
panelId = "1, 2, 3, 5, 6, 8, 9"
height = "280"
width = "460"