diff --git a/pages/public_cloud/compute/install_prometheus_agent_on_instance/guide.en-gb.md b/pages/public_cloud/compute/install_prometheus_agent_on_instance/guide.en-gb.md new file mode 100644 index 00000000000..c1e72bf36e0 --- /dev/null +++ b/pages/public_cloud/compute/install_prometheus_agent_on_instance/guide.en-gb.md @@ -0,0 +1,265 @@ +--- +title: 'Installing Prometheus Agent on an instance' +excerpt: 'Find out how to install a Prometheus agent on an OVHcloud Public Cloud instance to gather metrics' +updated: 2025-09-15 +--- + +## Objective + +Prometheus is a monitoring system and time series database. You can install and use its agent on OVHcloud Public Cloud instances to gather metrics from your servers and applications. + +**Find out how to install a Prometheus agent on an OVHcloud Public Cloud instance.** + +> [!warning] +> +> OVHcloud provides services which you are responsible for. In fact, as we do not have administrative access to these machines, we are not administrators and we cannot provide you with support. This means that it is up to you to manage the software and security daily. +> +> We have provided you with this guide in order to help you with common tasks. However, we advise contacting a specialist provider if you experience any difficulties or doubts about administration, usage, or server security. Feel free to visit our [community forum](/links/community) to interact with other users. +> + +## Requirements + +- [An instance created via the OVHcloud Control Panel](/pages/public_cloud/public_cloud_cross_functional/create_a_public_cloud_project) +- [Administrative access to the instance](/pages/public_cloud/compute/public-cloud-first-steps#connect-instance) +- A Prometheus server running and reachable from the instance + +## Instructions + +Follow these steps to install a Prometheus agent (Node Exporter) on your OVHcloud Public Cloud instance to collect metrics. + +### Step 1: Connect to Your Instance + +Connect to your instance via SSH: + +```bash +ssh root@ +``` + +Replace `` with the public IP address of your instance. + +> [primary] +> +> For Windows, use PowerShell with SSH or an SSH client like [PuTTY](/pages/web_cloud/web_hosting/ssh_using_putty_on_windows) if you prefer command line. +> +> For Windows Server with GUI, you can also use RDP (Remote Desktop). +> + +### Step 2: Update Your System + +Make sure your system packages are up to date: + +> [!tabs] +> For Debian/Ubuntu +>> ```bash +>> sudo apt update && sudo apt upgrade -y +>> ``` +>> +> For CentOS/RHEL +>> ```bash +>> sudo yum update -y +>> ``` +>> +> For macOS +>> Use [Homebrew](https://brew.sh/?utm_source=chatgpt.com){.external} to update packages: +>> +>> ```bash +>> brew update +>> brew upgrade +>> ``` +>> +> For Windows +>> No system update is required specifically for Node Exporter. Optionally, ensure your system is up to date via Windows Update. +>> + +### Step 3: Create a Prometheus User (Optional) + +Creating a dedicated user for Node Exporter improves security on Linux, but is optional on macOS and Windows. + +> [!tabs] +> For Linux +>> ```bash +>> sudo useradd --no-create-home --shell /bin/false prometheus +>> ``` +>> +>> - This creates a user with limited permissions to run Node Exporter. +>> - Recommended for production to reduce security risks. +>> - You can then start Node Exporter under this user via systemd +>> +> For macOS +>> ```bash +>> sudo dscl . -create /Users/prometheus +>> sudo dscl . -create /Users/prometheus UserShell /usr/bin/false +>> sudo dscl . -create /Users/prometheus NFSHomeDirectory /var/empty +>> ``` +>> +>> - **Optional:** Node Exporter can run under your current user without issues. +>> - Creating a dedicated user is only for stricter separation, not required. +>> +> For Windows +>> > [!primary] +>> > +>> > **Note:** Run these PowerShell commands inside the VM via SSH. +>> > +>> +>> ```powershell +>> New-LocalUser "prometheus" -NoPassword -Description "User for Node Exporter" +>> +>> Add-LocalGroupMember -Group "Users" -Member "prometheus" +>> ``` +>> +>> **Note:** Node Exporter/Windows Exporter can run under the current user; creating a dedicated user is optional for stricter access control. +>> + +### Step 4: Download Node Exporter + +> [!tabs] +> For Linux/macOS +>> ```bash +>> # Replace VERSION with the latest release, e.g., 1.9.1 +>> VERSION="1.7.0" +>> wget https://github.com/prometheus/node_exporter/releases/download/v$VERSION/node_exporter-$VERSION.linux-amd64.tar.gz +>> tar xvf node_exporter-$VERSION.linux-amd64.tar.gz +>> cd node_exporter-$VERSION.linux-amd64 +>> ``` +>> +> For Windows (via SSH/PowerShell on the VM) +>> > [!primary] +>> > +>> > `Invoke-WebRequest` require PowerShell 3.0+. +>> > +>> +>> ```powershell +>> mkdir C:\windows_exporter +>> cd C:\windows_exporter +>> +>> Invoke-WebRequest -Uri "https://github.com/prometheus-community/windows_exporter/releases/download/v0.31.3/windows_exporter-0.31.3-amd64.msi" -OutFile "windows_exporter.msi" +>> ``` +>> +>> Everything is done directly inside the VM, no need to transfer files from your local machine. +>> + +### Step 5: Run Node Exporter + +> [!tabs] +> For Linux +>> ```bash +>> ./node_exporter +>> ``` +>> +>> - **Optional:** set up a systemd service to run Node Exporter automatically. +>> - If using the dedicated prometheus user, ensure the service runs under this account. +>> +> For macOS +>> ```bash +>> ./node_exporter +>> ``` +>> +>> **Optional:** run under a dedicated user for stricter separation, but current user works fine. +>> +> For Windows (via SSH/PowerShell) +>> ```powershell +>> msiexec /i windows_exporter.msi ENABLED_COLLECTORS=cpu,cs,logical_disk,net,os,service,system,textfile /qn +>> ``` +>> +>> - On Desktop or Core, you can run it directly in PowerShell or configure as a Windows service. +>> +>> It is possible to customize collectors; see the [official documentation](https://github.com/prometheus-community/windows_exporter?utm_source=chatgpt.com#collectors) for the list. +>> + +### Step 6: Verify Node Exporter + +> [!primary] +> +> Node Exporter listen on 9100 port by default. +> +> Windows Exporter listen on port 9182 by default +> +> Replace with 9100 for Linux/macOS or 9182 for Windows. +> + +You should see metrics such as CPU, memory, disk, and network usage using this curl command: + +```bash +curl http://:/metrics +``` + +> [!primary] +> +> On Windows Desktop, you could also open a browser if desired, but via SSH/PowerShell, use `curl` or `Invoke-WebRequest`. +> + +### Step 7: Firewall/Security Rules (OVHcloud) + +Ensure that the port used by the exporter is open in both the VM firewall and your OVHcloud Security Group. + +Restrict access to only your Prometheus server for security. + +> [!tabs] +> For Linux (Debian/Ubuntu with UFW) +>> ```bash +>> sudo ufw allow 9100/tcp +>> sudo ufw status +>> ``` +>> +>> **Note:** If UFW shows Status: inactive, it means the firewall is not enabled on the VM. The port rule is added but not enforced. +>> +>> Security is mainly handled by your OVHcloud Security Group. +>> +>> If you want UFW active, first allow SSH to avoid being locked out: +>> +>> ```bash +>> sudo ufw allow ssh +>> sudo ufw enable +>> sudo ufw status +>> ``` +>> +> For macOS +>> macOS does not enable a firewall by default. +>> +>> If you are using the built-in firewall, open port 9100: +>> +>> ```bash +>> sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add ./node_exporter +>> sudo /usr/libexec/ApplicationFirewall/socketfilterfw --unblockapp ./node_exporter +>> ``` +>> +> For Windows +>> Open port 9182 in Windows Firewall: +>> +>> ```powershell +>> netsh advfirewall firewall add rule name="Windows Exporter" dir=in action=allow protocol=TCP localport=9182 +>> ``` +>> +>> You can also verify rules via: +>> +>> ```powershell +>> netsh advfirewall firewall show rule name=all | findstr "9182" +>> ``` +>> + +### Step 8: Connect Node Exporter to Prometheus + +1. Edit Prometheus config on your Prometheus server (prometheus.yml): + +```yaml +scrape_configs: + - job_name: 'node_exporter' # or 'windows_exporter' + static_configs: + - targets: [':9100'] # or 9182 for windows exporter +``` + +2. Reload Prometheus: + +```bash +sudo systemctl reload prometheus +``` + +3. Node Exporter metrics from your OVHcloud instance should now appear in Prometheus. + +## Go further + +[Official Node Exporter documentation](https://github.com/prometheus/node_exporter){.external}. + +[Creating and configuring a security group in Horizon](/pages/public_cloud/compute/setup_security_group) + +Join our [community of users](/links/community). diff --git a/pages/public_cloud/compute/install_prometheus_agent_on_instance/guide.fr-fr.md b/pages/public_cloud/compute/install_prometheus_agent_on_instance/guide.fr-fr.md new file mode 100644 index 00000000000..d5f0d59361c --- /dev/null +++ b/pages/public_cloud/compute/install_prometheus_agent_on_instance/guide.fr-fr.md @@ -0,0 +1,265 @@ +--- +title: 'Installer l’agent Prometheus sur une instance' +excerpt: 'Découvrez comment installer un agent Prometheus sur une instance OVHcloud Public Cloud pour collecter des métriques' +updated: 2025-09-15 +--- + +## Objectif + +Prometheus est un système de supervision et une base de données de séries temporelles. Vous pouvez installer et utiliser son agent sur des instances OVHcloud Public Cloud pour collecter des métriques depuis vos serveurs et applications. + +**Découvrez comment installer un agent Prometheus sur une instance OVHcloud Public Cloud.** + +> [!warning] +> +> OVHcloud fournit les services, mais vous en êtes responsable. En effet, nous n’avons pas d’accès administrateur à ces machines, nous ne sommes donc pas administrateurs et ne pouvons pas vous fournir de support. Cela signifie que vous devez gérer quotidiennement le logiciel et la sécurité. +> +> Nous avons fourni ce guide pour vous aider dans les tâches courantes. Cependant, nous vous conseillons de contacter un prestataire spécialisé si vous rencontrez des difficultés ou avez des doutes concernant l’administration, l’utilisation ou la sécurité du serveur. N’hésitez pas à visiter notre [forum communautaire](/links/community) pour interagir avec d’autres utilisateurs. +> + +## Prérequis + +- [Avoir créé une instance depuis l'espace client OVHcloud](/pages/public_cloud/public_cloud_cross_functional/create_a_public_cloud_project). +- [Disposer d'un accès administrateur](/pages/public_cloud/compute/public-cloud-first-Étapes#connect-instance). +- Un serveur Prometheus en fonctionnement et accessible depuis l’instance + +## En pratique + +Suivez ces étapes pour installer un agent Prometheus (Node Exporter ou Windows Exporter) sur votre instance OVHcloud Public Cloud afin de collecter des métriques. + +### Étape 1 : Se connecter à votre instance + +Connectez-vous à votre instance via SSH : + +```bash +ssh root@ +``` + +Remplacez `` par l’adresse IP publique de votre instance. + +> [primary] +> +> Pour Windows, utilisez PowerShell avec SSH ou un client SSH comme [PuTTY](/pages/web_cloud/web_hosting/ssh_using_putty_on_windows) si vous préférez la ligne de commande. +> +> Pour Windows Server avec interface graphique, vous pouvez également utiliser le RDP (Remote Desktop). +> + +### Étape 2: Mettre à jour le système + +Assurez-vous que les paquets de votre système sont à jour : + +> [!tabs] +> Pour Debian/Ubuntu +>> ```bash +>> sudo apt update && sudo apt upgrade -y +>> ``` +>> +> Pour CentOS/RHEL +>> ```bash +>> sudo yum update -y +>> ``` +>> +> Pour macOS +>> Utilisez [Homebrew](https://brew.sh/?utm_source=chatgpt.com){.external} pour mettre à jour les paquets : +>> +>> ```bash +>> brew update +>> brew upgrade +>> ``` +>> +> Pour Windows +>> Aucune mise à jour spécifique n’est requise pour Node Exporter. Vous pouvez éventuellement vous assurer que le système est à jour via Windows Update. +>> + +### Étape 3: Créer un utilisateur Prometheus (optionnel) + +La création d’un utilisateur dédié pour Node Exporter améliore la sécurité sur Linux, mais est optionnelle sur macOS et Windows. + +> [!tabs] +> Pour Linux +>> ```bash +>> sudo useradd --no-create-home --shell /bin/false prometheus +>> ``` +>> +>> - Cela crée un utilisateur avec des permissions limitées pour exécuter Node Exporter. +>> - Recommandé en production pour réduire les risques de sécurité. +>> - Vous pouvez ensuite lancer Node Exporter sous cet utilisateur via systemd. +>> +> Pour macOS +>> ```bash +>> sudo dscl . -create /Users/prometheus +>> sudo dscl . -create /Users/prometheus UserShell /usr/bin/false +>> sudo dscl . -create /Users/prometheus NFSHomeDirectory /var/empty +>> ``` +>> +>> - **Optionnel :** Node Exporter peut s’exécuter avec votre utilisateur actuel sans problème. +>> - La création d’un utilisateur dédié n’est nécessaire que pour une stricte séparation. +>> +> Pour Windows +>> > [!primary] +>> > +>> > **Note:** Exécutez ces commandes PowerShell à l’intérieur de la VM via SSH. +>> > +>> +>> ```powershell +>> New-LocalUser "prometheus" -NoPassword -Description "User for Node Exporter" +>> +>> Add-LocalGroupMember -Group "Users" -Member "prometheus" +>> ``` +>> +>> **Note:** Node Exporter/Windows Exporter peut s’exécuter avec l’utilisateur actuel, la création d’un utilisateur dédié est optionnelle pour un contrôle d’accès plus strict. +>> + +### Étape 4: Télécharger Node Exporter + +> [!tabs] +> Pour Linux/macOS +>> ```bash +>> # Remplacez VERSION par la dernière version, par exemple 1.9.1 +>> VERSION="1.7.0" +>> wget https://github.com/prometheus/node_exporter/releases/download/v$VERSION/node_exporter-$VERSION.linux-amd64.tar.gz +>> tar xvf node_exporter-$VERSION.linux-amd64.tar.gz +>> cd node_exporter-$VERSION.linux-amd64 +>> ``` +>> +> Pour Windows (via SSH/PowerShell sur la VM) +>> > [!primary] +>> > +>> > `Invoke-WebRequest` require PowerShell 3.0+. +>> > +>> +>> ```powershell +>> mkdir C:\windows_exporter +>> cd C:\windows_exporter +>> +>> Invoke-WebRequest -Uri "https://github.com/prometheus-community/windows_exporter/releases/download/v0.31.3/windows_exporter-0.31.3-amd64.msi" -OutFile "windows_exporter.msi" +>> ``` +>> +>> Tout se fait directement à l’intérieur de la VM, aucun transfert de fichiers depuis votre machine locale n’est nécessaire. +>> + +### Étape 5 : Lancer Node Exporter + +> [!tabs] +> Pour Linux +>> ```bash +>> ./node_exporter +>> ``` +>> +>> - **Optionnel :** configurez un service systemd pour exécuter Node Exporter automatiquement. +>> - Si vous utilisez l’utilisateur dédié prometheus, assurez-vous que le service s’exécute sous ce compte. +>> +> Pour macOS +>> ```bash +>> ./node_exporter +>> ``` +>> +>> - **Optionnel :** vous pouvez l’exécuter sous un utilisateur dédié pour une séparation stricte, mais l’utilisateur actuel fonctionne parfaitement. +>> +> Pour Windows (via SSH/PowerShell) +>> ```powershell +>> msiexec /i windows_exporter.msi ENABLED_COLLECTORS=cpu,cs,logical_disk,net,os,service,system,textfile /qn +>> ``` +>> +>> Sur Windows Desktop ou Core, vous pouvez l’exécuter directement dans PowerShell ou le configurer en tant que service Windows. +>> +>> Il est possible de personnaliser les collectors ; consultez la [documentation officielle](https://github.com/prometheus-community/windows_exporter?utm_source=chatgpt.com#collectors){.external} pour la liste complète. +>> + +### Étape 6 : Vérifier Node Exporter + +> [!primary] +> +> Node Exporter écoute par défaut sur le port 9100. +> +> Windows Exporter écoute par défaut sur le port 9182. +> +> Remplacez `` par 9100 pour Linux/macOS ou 9182 pour Windows. +> + +Vous devriez voir des métriques telles que l’utilisation du CPU, de la mémoire, du disque et du réseau avec cette commande : + +```bash +curl http://:/metrics +``` + +> [!primary] +> +> Sur Windows Desktop, vous pouvez également ouvrir un navigateur pour vérifier, mais via SSH/PowerShell, utilisez `curl` ou `Invoke-WebRequest`. +> + +### Étape 7 : Règles Firewall/Sécurité (OVHcloud) + +Assurez-vous que le port utilisé par l’exporter est ouvert à la fois dans le firewall de la VM et dans votre Security Group OVHcloud. + +Limitez l’accès uniquement au serveur Prometheus pour plus de sécurité. + +> [!tabs] +> Pour Linux (Debian/Ubuntu with UFW) +>> ```bash +>> sudo ufw allow 9100/tcp +>> sudo ufw status +>> ``` +>> +>> **Note:** si UFW indique Status: inactive, cela signifie que le firewall n’est pas activé sur la VM. La règle de port est ajoutée mais non appliquée. +>> +>> La sécurité est principalement gérée par votre Security Group OVHcloud. +>> +>> Si vous souhaitez activer UFW, commencez par autoriser SSH pour éviter de bloquer votre connexion : +>> +>> ```bash +>> sudo ufw allow ssh +>> sudo ufw enable +>> sudo ufw status +>> ``` +>> +> Pour macOS +>> macOS n’active pas le firewall par défaut. +>> +>> Si vous utilisez le firewall intégré, ouvrez le port 9100 : +>> +>> ```bash +>> sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add ./node_exporter +>> sudo /usr/libexec/ApplicationFirewall/socketfilterfw --unblockapp ./node_exporter +>> ``` +>> +> Pour Windows +>> Ouvrez le port 9182 dans le firewall Windows : +>> +>> ```powershell +>> netsh advfirewall firewall add rule name="Windows Exporter" dir=in action=allow protocol=TCP localport=9182 +>> ``` +>> +>> Vous pouvez également vérifier les règles avec : +>> +>> ```powershell +>> netsh advfirewall firewall show rule name=all | findstr "9182" +>> ``` +>> + +### Étape 8 : Connecter Node Exporter à Prometheus + +1. Éditez le fichier de configuration de Prometheus sur votre serveur Prometheus (prometheus.yml) : + +```yaml +scrape_configs: + - job_name: 'node_exporter' # ou 'windows_exporter' + static_configs: + - targets: [':9100'] # ou 9182 pour windows exporter +``` + +2. Rechargez Prometheus : + +```bash +sudo systemctl reload prometheus +``` + +3. Les métriques Node Exporter de votre instance OVHcloud devraient maintenant apparaître dans Prometheus. + +## Aller plus loin + +[Documentation officielle de Node Exporter](https://github.com/prometheus/node_exporter){.external}. + +[Créer et configurer un groupe de sécurité dans Horizon](/pages/public_cloud/compute/setup_security_group) + +Échangez avec notre [communauté d'utilisateurs](/links/community). \ No newline at end of file diff --git a/pages/public_cloud/compute/install_prometheus_agent_on_instance/meta.yaml b/pages/public_cloud/compute/install_prometheus_agent_on_instance/meta.yaml new file mode 100644 index 00000000000..1d1532d09b1 --- /dev/null +++ b/pages/public_cloud/compute/install_prometheus_agent_on_instance/meta.yaml @@ -0,0 +1,2 @@ +id: e8f273c1-b77c-497f-8730-12b8f4924f59 +full_slug: public-cloud-compute-install-prometheus-agent \ No newline at end of file