Grafana et Prometheus sont des outils puissants pour surveiller et visualiser des métriques. Suivez ces étapes pour installer Grafana et Prometheus sur votre serveur VPS fonctionnant sous Ubuntu 24.04.
Prérequis
- Un serveur VPS exécutant Ubuntu 24.04
- Accès root ou sudo
- Connaissances de base de la ligne de commande
Étape 1: Mettez à jour votre système
Assurez-vous que votre système est à jour :
sudo apt update && sudo apt upgrade -y
Étape 2: Installez Prometheus
Tout d’abord, créez un utilisateur pour Prometheus :
sudo useradd --no-create-home --shell /bin/false prometheus
Créez les répertoires nécessaires :
sudo mkdir /etc/prometheus
sudo mkdir /var/lib/prometheus
Téléchargez la dernière version de Prometheus :
wget https://github.com/prometheus/prometheus/releases/latest/download/prometheus-*.tar.gz
Décompressez le fichier téléchargé :
tar xvf prometheus-*.tar.gz
Déplacez les fichiers binaires vers le répertoire approprié :
sudo mv prometheus /usr/local/bin/
sudo mv promtool /usr/local/bin/
Déplacez le fichier de configuration et définissez les permissions :
sudo mv prometheus.yml /etc/prometheus/
sudo chown -R prometheus:prometheus /etc/prometheus
sudo chown -R prometheus:prometheus /var/lib/prometheus
Étape 3: Créez un fichier de service pour Prometheus
Créez un fichier de service pour Prometheus :
sudo nano /etc/systemd/system/prometheus.service
Ajoutez le contenu suivant :
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
--config.file /etc/prometheus/prometheus.yml \
--storage.tsdb.path /var/lib/prometheus/ \
--web.listen-address=:9090
[Install]
WantedBy=multi-user.target
Rechargez le démon systemd et démarrez Prometheus :
sudo systemctl daemon-reload
sudo systemctl start prometheus
sudo systemctl enable prometheus
Étape 4: Installez Grafana
Ajoutez le dépôt APT de Grafana :
sudo apt install -y software-properties-common
sudo add-apt-repository ppa:grafana/stable
Installez Grafana :
sudo apt update
sudo apt install grafana
Démarrez et activez Grafana :
sudo systemctl start grafana-server
sudo systemctl enable grafana-server
Étape 5: Accédez à Grafana
Ouvrez votre navigateur web et accédez à http://your_domain.com:3000. Les identifiants par défaut sont :
- Nom d’utilisateur : admin
- Mot de passe : admin
Vous serez invité à changer le mot de passe lors de votre première connexion.
Étape 6: Configurez Prometheus comme source de données dans Grafana
Une fois connecté à Grafana, accédez à Configuration > Sources de données > Ajouter une source de données et sélectionnez Prometheus. Entrez l’URL :
http://localhost:9090
Cliquez sur Enregistrer et Tester pour vérifier la connexion.
Conclusion
Vous avez installé avec succès Grafana et Prometheus sur votre serveur VPS sous Ubuntu 24.04. Vous pouvez maintenant commencer à surveiller vos applications !
Windows VPS Deutschland
Windows VPS España
Windows VPS Nederland
Windows VPS Italia
Windows VPS Portugal
VPS Windows Italia
Windows VPS
Windows VPS
Windows VPS Sverige
Windows VPS Norge
Windows VPS
Windows VPS Türkiye
Windows RDS (Remote Desktop Services)
Windows VPS
Author: Łukasz Bodziony
Website: Windows VPS
Łukasz Bodziony is the CEO and founder of NETCLOUD24, a global VPS hosting brand proudly originating from Poland. With extensive experience in cloud computing, virtualization, and server management, he delivers high-performance Windows VPS and Remote Desktop Services (RDS) solutions to clients across Europe, North America, and beyond.
His expertise covers a wide range of technologies, including Microsoft Azure, Proxmox VE, Amazon Web Services (AWS), and numerous other virtualization and cloud platforms.
Beyond running his hosting business, Łukasz also provides professional paid server configuration and optimization services for companies and individuals. Outside of work, he is dedicated to caring for his children and building a secure future for them.
If you are interested in working with him or need expert assistance with your hosting, cloud environment, or server setup, feel free to reach out via Windows VPS.