Projet

Général

Profil

Demande #4439

Demande #4009: Migrer la supervision vers Icinga2

Déployer un grafana ou équivalent

Ajouté par François Poulain il y a presque 4 ans. Mis à jour il y a presque 4 ans.

Statut:
Fermé
Priorité:
Normale
Assigné à:
Catégorie:
-
Version cible:
Début:
25/04/2020
Echéance:
% réalisé:

90%

Temps estimé:
Difficulté:
2 Facile

Description

Les graphes de charge (cup, ram, volumes) renseignent sur les prévisions à faire en termes d'évolutions, et aide à définir si une situation est habituelle (i.e. juste une croissante douce qui passe un seuil) ou inhabituelle (i.e. conséquence d'une potentielle anomalie ou d'un usage inhabituel du service).

Icinga1 s'appuie sur PNP.

Coté Chapril on a adopté grafana.


Demandes liées

Lié à Infra Chapril - Demande #5180: Mettre en forme la doc d'installation de GrafanaFermé02/02/2021

Actions

Historique

#1

Mis à jour par Quentin Gibeaux il y a presque 4 ans

  • Assigné à mis à Quentin Gibeaux
  • Version cible changé de Backlog à Mai 2020
#2

Mis à jour par Quentin Gibeaux il y a presque 4 ans

  • Statut changé de Nouveau à En cours de traitement
  • % réalisé changé de 0 à 90

Fait, doc à faire

Notes d'installation :

git clone https://github.com/Mikesch-mp/icingaweb2-module-grafana /usr/share/icingaweb2/modules/grafana
apt install influxdb influxdb-client
apt-get install -y apt-transport-https
apt-get install -y software-properties-common wget
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main" 

(April) root@admin:~# influx
Connected to http://localhost:8086 version 1.6.4
InfluxDB shell version: 1.6.4
> CREATE DATABASE icinga2;

CREATE USER icinga2 WITH PASSWORD '********';
GRANT ALL ON icinga2 TO icinga2

icinga2 feature enable perfdata

icinga2 feature enable influxdb

vim /etc/icinga2/features-enabled/influxdb.conf
library "perfdata" 

object InfluxdbWriter "influxdb" {
  host = "127.1" 
  port = 8086
  database = "icinga2" 
  username = "icinga2" 
  password = "*****************" 
  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$" 
    }
  }
}

mkdir /etc/icingaweb2/modules/grafana

/etc/grafana/grafana.ini : décommenter compte admin/password (mettre un mot de passe)
systemctl enable grafana-server.service
systemctl start grafana-server

*attendre l'initialisation initiale*

ajouter la conf nginx sur bastion

server {
    listen 80;

    server_name grafana.april.org;

    access_log /var/log/nginx/grafana.april.org/grafana.april.org.access_log;
    error_log /var/log/nginx/grafana.april.org/grafana.april.org.error_log;

    include /etc/nginx/custom_50x;
    include /etc/nginx/deny_.git;
    include /etc/nginx/force-ssl.conf;
}

server {
    listen 443;
    ssl on;

    server_name grafana.april.org;

    access_log /var/log/nginx/grafana.april.org/grafana.april.org.access_log;
    error_log /var/log/nginx/grafana.april.org/grafana.april.org.error_log;

    include /etc/nginx/custom_50x;
    include /etc/nginx/deny_.git;

    location / {
        proxy_pass http://172.16.0.2:3000;
    }
}

ajouter le cname grafana dans la conf dns

se connecter sur l'interface grafana pour ajouter un datasource
se connecter en admin
ajouter un datasource influxdb

url: http://127.0.0.1:8086
Acces: Server
Database: icinga2
user: icinga2
password : *******
http method: GET

Noter le nom du datasource (InfluxDB par défaut)

Save & Test

Générer un token "viewer" et garder la valeur pour la conf du module grafana d'icinga2
Intégrer le dashboard 
https://grafana.com/grafana/dashboards/1572?osource=grafana_getting_started

chown www-data:icingaweb2 /etc/icingaweb2/modules/grafana
vim /etc/icingaweb2/modules/grafana/config.ini
[grafana]
version = "1" 
host = "127.1:3000" 
protocol = "http" 
timerangeAll = "1w/w" 
defaultdashboard = "icinga2-default" 
defaultdashboarduid = "j9hX7K6Wz" 
defaultdashboardpanelid = "1" 
defaultorgid = "1" 
shadows = "0" 
theme = "light" 
datasource = "influxdb" 
accessmode = "proxy" 
height = "280" 
width = "640" 
enableLink = "yes" 
debug = "0" 
authentication = "token" 
apitoken = "************" 
usepublic = "yes" 
publichost = "grafana.april.org" 
publicprotocol = "https" 

#3

Mis à jour par François Poulain il y a presque 4 ans

Pour ne pas afficher de graphe vide, il suffit de désactiver les perfdata au niveau du service icinga :

enable_perfdata = false

J'ai commencé à passer en revue les services concernés.

#4

Mis à jour par François Poulain il y a presque 4 ans

J'ai commencé à passer en revue les services concernés.

J'ai fini de passer en revue les services concernés.

#5

Mis à jour par Quentin Gibeaux il y a presque 4 ans

  • Statut changé de En cours de traitement à Fermé
#6

Mis à jour par Christian P. Momon il y a environ 3 ans

  • Lié à Demande #5180: Mettre en forme la doc d'installation de Grafana ajouté

Formats disponibles : Atom PDF