Install Grafana with Prometheus on Ubuntu 22.04
Prometheus is an open-source systems monitoring and alerting toolkit designed to collect and store metrics as time series data.
Prerequisite:
Ubuntu 22.04
Prometheus: 2.31.2
Grafana: 11.0
To update and upgrade the package lists from the repositories, run the following command:
Install Prometheus using the following command:
Install Grafana:
Add the Grafana repository to your system. Open a terminal and run the following commands:
Add the Grafana package signing key and Install Grafana
Start the Grafana/Prometheus service and enable it to start automatically at system reboot using the following commands:
Start and enable Grafana service:
Checking the Grafana Version
To check the version of Grafana, run the curl command using the server IP and Grafana port number.
curl http://your_server_ip:3000/api/health
Check the version of Prometheus
To check the version of Prometheus, run these commands.
Access Grafana through a web browser: Open a web browser and go to http://Your_Server_IP:3000. Log in with the default username and password (admin/admin). Follow the on-screen instructions to set up Grafana. Once loaded, you should see the Grafana login page. The default credentials are:
username: admin
password: admin
You'll be prompted to create a new password. Input a secure password, confirm it, and click the "Submit" button.
Configure Prometheus as a data source in Grafana:
Go to Configuration -> Data Sources -> Add data source.
Choose Prometheus as the type.
Set the URL to http://Your_Server_IP:9090
Click Save & Test.
Key Features of Prometheus:
Multi-dimensional Data Model: Uses key-value pairs for labels to identify metrics uniquely.
Powerful Query Language (PromQL): Allows for flexible and high-dimensional querying of the data.
Pull-based Collection: Scrapes metrics from HTTP endpoints at the targets' intervals.
Alerting: Integrated alert manager that handles alerts based on PromQL expressions.
Compatibility: Works well with containerized environments like Kubernetes.\
Last updated