Skip to main content

Installer un serveur Prometheus et Grafana

Prometheus :

Installation des paquets nécessaires : 

apt-get install prometheus curl
nano /etc/prometheus/prometheus.yml
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 5s
    scrape_timeout: 5s

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ['localhost:9090']

  - job_name: node
    # If prometheus-node-exporter is installed, grab stats about the local
    # machine by default.
    static_configs:
      - targets: ['172.31.65.70:9090', '172.31.64.10:9182', '172.31.64.30:9182'$


 

On se rend sur le site web  http://172.31.65.70:9090/graph :

image-1619224547004.png

Dans Status--> Targets 

image-1619284282586.png

 

Pour installer un agent node_exporter (pour linux) : 

Url de metrics : 

Ou installation un agent windows exporter (pour Windows) :

Scripte automatique : 
Url de metrics : 

 

 

Garfana :

Installation des paquets nécessaires : 

apt-get install gnupg gnupg2 gnupg1

apt-get install -y apt-transport-https
apt-get install -y software-properties-common wget
wget -q -O - https://packages.grafana.com/gpg.key | apt-key add -

echo "deb https://packages.grafana.com/oss/deb stable main" | tee -a /etc/apt/sources.list.d/grafana.list

sudo apt-get update
sudo
apt-get install grafana

service grafana-server start

Fichier de configuration  /etc/grafana/grafana.ini 

On se rend sur le site web  http://172.31.65.70:3000 :

image-1619229539244.png

Identifiants et mot de passe par défaut : admin
Vous pouvez choisir de conserver ou de modifier le mot de passe admin  :

image-1619229645651.png

Puis, on ajoute une source de données : 

image-1619229716751.png

On nous proposer d'ajouter Prometheus comme source de données  : 

image-1619229795541.png

 

On entre les informations ci-dessous puis on sauvegarde :

 

image-1619230106159.png

Puis, on se rend sur Grafana et on import un dashboard : 

image-1619259962766.png

 

Puis on précise les informations comme ci-dessous  :

image-1619260005877.png