Skip to content

Xicobot/Grafana-Prometheus-Instalation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Grafana-Prometheus-Instalation

This document describes how to install and configure Prometheus and Grafana on a Debian/Ubuntu-based system.

Prerequisites

  • A Debian/Ubuntu-based system.
  • Access to an account with administrative privileges.
  • Internet connection.

Installing Prometheus

  1. Update system repositories:

    apt update
    apt upgrade -y
  2. Install Prometheus:

    Run the following command to install Prometheus from the official repositories:

    apt install prometheus -y
  3. Verify Prometheus status:

    Ensure the service is active and running:

    systemctl status prometheus

    If it is not active, you can start it with:

    systemctl start prometheus
  4. Enable auto-start:

    sudo systemctl enable prometheus
  5. Configuration files:

    The main configuration file is located at:

    /etc/prometheus/prometheus.yml
    

    You can edit it to add custom monitoring targets:

    nano /etc/prometheus/prometheus.yml
  6. Access Prometheus web interface:

    The web interface will be available at:

    http://<SERVER_IP>:9090
    

Installing Grafana

  1. Add Grafana repository:

    Import the GPG key and add the official repository:

    apt install -y software-properties-common
    wget -q -O - https://packages.grafana.com/gpg.key | apt-key add -
    echo "deb https://packages.grafana.com/oss/deb stable main" | tee /etc/apt/sources.list.d/grafana.list
  2. Update repositories and install Grafana:

    apt update
    apt install grafana -y
  3. Start Grafana service:

    systemctl start grafana-server
  4. Enable auto-start:

    systemctl enable grafana-server
  5. Access Grafana web interface:

    The web interface will be available at:

    http://<SERVER_IP>:3000
    

    Default credentials are:

    • Username: admin
    • Password: admin

    You will be prompted to change the password upon first login.


Initial Configuration

Configuring Prometheus in Grafana

  1. Log in to the Grafana interface.

  2. Go to Configuration > Data Sources.

  3. Click Add data source.

  4. Select Prometheus.

  5. Set the Prometheus URL:

    http://<SERVER_IP>:9090
    
  6. Click Save & Test to verify the connection.

Creating Dashboards

  1. Go to Create > Dashboard.
  2. Add a new panel and select metrics from Prometheus.
  3. Customize your graphs as needed.
  4. The code for the Grafana dashboard, which extracts the metrics, is as follows:1860

Additional Notes

  • Scripts: Also, i've created a script to automatice this process, check it out here! (You must be with administrative privileges.)
  • Security: Configure firewalls and authentication to secure your services.
  • Metric Checks: In this link, there are some checks I’ve been doing on the go, in case you want to check that it works
  • Official Documentation:

You are all set! Prometheus and Grafana are now installed and configured on your server.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages