Grafana-Setup

Grafana:

Grafana is an open-source monitoring and data visualization tool used by IT organizations to monitor and analyze various components of their IT infrastructure. Grafana allows users to create customizable dashboards that display real-time metrics and data from various sources, including databases, APIs, and other monitoring tools.

Grafana monitoring provides a way to visualize and analyze the performance of different parts of an IT infrastructure. It supports a wide range of data sources, including popular monitoring tools like Prometheus, InfluxDB, Graphite, and Elasticsearch. Grafana can collect and display data on CPU usage, memory utilization, network traffic, response times, and other performance metrics, allowing IT teams to quickly identify and troubleshoot issues before they impact users.

One of the key features of Grafana is its ability to create alerts based on certain thresholds and conditions. This allows IT teams to receive notifications when metrics exceed predefined levels, enabling them to take corrective action before issues escalate. Grafana can also be integrated with other IT tools such as Slack and PagerDuty to provide seamless incident management and communication.

Prerequisites

Install Grafana from APT Repository

Follow the steps below to install Grafana from the APT repository:

1. Install the Prerequisite Packages

Run the following command to install the necessary packages:

sudo apt-get install -y apt-transport-https software-properties-common wget

2. Import the GPG Key

Create a directory for the key and import the GPG key:

sudo mkdir -p /etc/apt/keyrings/
wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg > /dev/null

3. Add the Repository for Stable Releases

To add the repository for stable releases, run the following command:

echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list

4. Add the Repository for Beta Releases (Optional)

To add the repository for beta releases, run the following command:

echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com beta main" | sudo tee -a /etc/apt/sources.list.d/grafana.list

5. Update the List of Available Packages

Run the following command to update the list of available packages:

sudo apt-get update

6. Install Grafana OSS

To install the latest Grafana OSS release, use the following command:

sudo apt-get install grafana

7. Enable and Start the Grafana Service

After installation, you need to enable and start the Grafana service. Use the following commands:

# Enable Grafana to start on boot
sudo systemctl enable grafana-server

# Start the Grafana service
sudo systemctl start grafana-server

8. Check the Status of the Grafana Service

To verify that Grafana is running, use the following command:

sudo systemctl status grafana-server

9. Access Grafana

By default, Grafana listens on IP 0.0.0.0 (all interfaces) and port 3000. You can access the Grafana web interface by opening a browser and navigating to:

http://<your-server-ip>:3000

The default login credentials are:

  • Username: admin
  • Password: admin (you will be prompted to change this on the first login)

Initial we have to login with the default user and password

initial_user

Later we can update password for that user(admin)

update_password