DEV Community

Cover image for Installing Grafana for Monitoring 😎
tj_27
tj_27

Posted on

Installing Grafana for Monitoring 😎

Grafana is a powerful open-source platform for monitoring and observability that allows you to visualize and analyze data from various sources in real time. Here are a few key reasons why you should consider installing Grafana:

1. Centralized Data Visualization

Grafana supports a wide range of data sources, including databases (like MySQL, PostgreSQL), time-series databases (such as Prometheus, InfluxDB), and cloud-based sources. By integrating these sources, you can create unified dashboards to visualize data from multiple systems in one place.

2. Real-Time Monitoring and Alerts

Grafana provides real-time monitoring capabilities with customizable dashboards. You can set up alerts based on certain thresholds or conditions, and Grafana can notify you via email, Slack, or other channels, allowing you to respond to incidents quickly.

3. Customizable and Flexible Dashboards

Grafana offers highly customizable dashboards, allowing you to create and modify graphs, heatmaps, and other visualization tools to suit your specific needs. You can design tailored dashboards to track the metrics that are most important to your organization.

4. Ease of Use

With its intuitive interface and rich set of features, Grafana is relatively easy to set up and use, even for those who are not deeply familiar with data visualization or monitoring tools. It also has a large community and comprehensive documentation to support new users.

5. Performance and Scalability

Grafana is built to handle large-scale data and is optimized for performance. It can be used in environments ranging from small personal projects to large enterprise-level applications, scaling effectively as your needs grow.

6. Open Source and Extensible

Being an open-source tool, Grafana allows you to benefit from community-contributed plugins and integrations. You can also create custom plugins to meet unique visualization needs.

7. Enhance Observability and Decision Making

Grafana helps you gain deep insights into your system’s performance, detect anomalies, and understand trends, which enhances observability and enables better decision-making for IT operations and business strategies.

Installing Grafana is a great step if you aim to improve monitoring capabilities, consolidate data visualization, or simply gain a clearer understanding of your system's performance.

Image description

Steps

  1. Configure the proxy settings to enable access, then proceed to download the Grafana latest release from the official source.
sudo yum install -y https:dl.grafana.com/oss/releases/grafana-10.0.0-1.x86_64.rpm
Enter fullscreen mode Exit fullscreen mode
  1. Start and verify the service.
systemctl start grafana-server.service
systemctl status grafana-server.service
Enter fullscreen mode Exit fullscreen mode
  1. Install Prometheus that will serve as the data source.
  2. download the package
wget https://github.com/prometheus/prometheus/releases/download/v2.49.1/prometheus-2.49.1.linux-amd64.tar.gz
Enter fullscreen mode Exit fullscreen mode
  • extract the file
tar -xzvf prometheus-2.49.1.linux-amd64.tar.gz
Enter fullscreen mode Exit fullscreen mode
  • make it a soft link
ln -s prometheus-2.49.1.linux-amd64 prometheus
Enter fullscreen mode Exit fullscreen mode
  • create a prometheus sercive file
vim /usr/lib/systemd/system/prometheus.service
Enter fullscreen mode Exit fullscreen mode

prometheus.service

[Unit]
Description=prometheus
After=network.target

[Service]
Type=simple
PIDFile=/var/run/prometheus.pid
WorkingDirectory=/usr/local/prometheus
ExecStart=/usr/local/prometheus/prometheus --web.listen=09090 --storage.tsdb.path=/data/prometheus --web.enable-admin-api --storage.tsdb.retention=7d
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
Restart=on-failure
RestartSec=5
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target
Enter fullscreen mode Exit fullscreen mode
  • start the service and verify
systemctl start prometheus.service; systemctl status prometheus.service
Enter fullscreen mode Exit fullscreen mode

To log in to your grafana on web, follow the instruction from the official documentation.

To connect the data source, follow the steps on the official documentation as well.


References:

Top comments (0)