<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://serverrental.store/index.php?action=history&amp;feed=atom&amp;title=Installing_Grafana_and_Prometheus</id>
	<title>Installing Grafana and Prometheus - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://serverrental.store/index.php?action=history&amp;feed=atom&amp;title=Installing_Grafana_and_Prometheus"/>
	<link rel="alternate" type="text/html" href="https://serverrental.store/index.php?title=Installing_Grafana_and_Prometheus&amp;action=history"/>
	<updated>2026-04-15T01:08:47Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.36.1</generator>
	<entry>
		<id>https://serverrental.store/index.php?title=Installing_Grafana_and_Prometheus&amp;diff=5777&amp;oldid=prev</id>
		<title>Admin: New server guide</title>
		<link rel="alternate" type="text/html" href="https://serverrental.store/index.php?title=Installing_Grafana_and_Prometheus&amp;diff=5777&amp;oldid=prev"/>
		<updated>2026-04-12T20:01:15Z</updated>

		<summary type="html">&lt;p&gt;New server guide&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Installing Grafana and Prometheus =&lt;br /&gt;
&lt;br /&gt;
This guide details the installation and initial configuration of Prometheus and Grafana, a powerful open-source monitoring and alerting stack. Prometheus collects and stores metrics, while Grafana visualizes this data through interactive dashboards. This setup is crucial for understanding your server's performance and identifying potential issues before they impact users. For robust performance, consider dedicated servers from [https://powervps.net/?from=32 PowerVPS] that offer full root access for complete control over your monitoring infrastructure.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
Before you begin, ensure you have the following:&lt;br /&gt;
&lt;br /&gt;
*   A Linux server (this guide assumes a Debian/Ubuntu-based system).&lt;br /&gt;
*   Root or sudo privileges.&lt;br /&gt;
*   Basic understanding of Linux command line.&lt;br /&gt;
*   Internet connectivity to download packages.&lt;br /&gt;
*   A firewall configured to allow access to Prometheus (default port 9090) and Grafana (default port 3000).&lt;br /&gt;
&lt;br /&gt;
== Installing Prometheus ==&lt;br /&gt;
&lt;br /&gt;
Prometheus is a time-series database and monitoring system.&lt;br /&gt;
&lt;br /&gt;
=== Download Prometheus ===&lt;br /&gt;
First, navigate to the Prometheus releases page (https://prometheus.io/download/) to find the latest stable version. We'll download the pre-compiled binaries.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget https://github.com/prometheus/prometheus/releases/download/v2.49.1/prometheus-2.49.1.linux-amd64.tar.gz&lt;br /&gt;
tar xzvf prometheus-2.49.1.linux-amd64.tar.gz&lt;br /&gt;
cd prometheus-2.49.1.linux-amd64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Move Binaries and Configuration Files ===&lt;br /&gt;
It's good practice to move the Prometheus binaries to a standard location and create dedicated directories for its data and configuration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mv prometheus promtool /usr/local/bin/&lt;br /&gt;
sudo mkdir /etc/prometheus&lt;br /&gt;
sudo mkdir /var/lib/prometheus&lt;br /&gt;
sudo mv prometheus.yml /etc/prometheus/prometheus.yml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Create Prometheus User ===&lt;br /&gt;
For security, run Prometheus under a dedicated non-root user.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo useradd --no-create-home --shell /bin/false prometheus&lt;br /&gt;
sudo chown -R prometheus:prometheus /etc/prometheus&lt;br /&gt;
sudo chown -R prometheus:prometheus /var/lib/prometheus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure Prometheus ===&lt;br /&gt;
Edit the Prometheus configuration file to define scrape targets. For now, we'll configure it to scrape itself.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/prometheus/prometheus.yml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the contents with the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
global:&lt;br /&gt;
  scrape_interval: 15s # How frequently to scrape targets by default.&lt;br /&gt;
&lt;br /&gt;
scrape_configs:&lt;br /&gt;
  - job_name: 'prometheus'&lt;br /&gt;
    static_configs:&lt;br /&gt;
      - targets: ['localhost:9090']&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the file.&lt;br /&gt;
&lt;br /&gt;
=== Create Systemd Service File ===&lt;br /&gt;
To manage Prometheus as a service, create a systemd unit file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/systemd/system/prometheus.service&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following content:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=Prometheus&lt;br /&gt;
Wants=network-online.target&lt;br /&gt;
After=network-online.target&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
User=prometheus&lt;br /&gt;
Group=prometheus&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/prometheus \&lt;br /&gt;
  --config.file /etc/prometheus/prometheus.yml \&lt;br /&gt;
  --storage.tsdb.path /var/lib/prometheus/ \&lt;br /&gt;
  --web.console.templates=/etc/prometheus/consoles \&lt;br /&gt;
  --web.console.libraries=/etc/prometheus/console_libraries&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit. Now, enable and start the Prometheus service:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo systemctl daemon-reload&lt;br /&gt;
sudo systemctl start prometheus&lt;br /&gt;
sudo systemctl enable prometheus&lt;br /&gt;
sudo systemctl status prometheus&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see `active (running)`. Access Prometheus at `http://your_server_ip:9090`.&lt;br /&gt;
&lt;br /&gt;
== Installing Grafana ==&lt;br /&gt;
&lt;br /&gt;
Grafana is a popular open-source platform for monitoring and observability.&lt;br /&gt;
&lt;br /&gt;
=== Download Grafana ===&lt;br /&gt;
Grafana provides official Debian/Ubuntu packages, which simplifies installation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt update&lt;br /&gt;
sudo apt install -y apt-transport-https software-properties-common wget&lt;br /&gt;
wget -q -O - https://apt.grafana.com/gpg.key | sudo apt-key add -&lt;br /&gt;
echo &amp;quot;deb https://apt.grafana.com stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/grafana.list&lt;br /&gt;
sudo apt update&lt;br /&gt;
sudo apt install grafana&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Start and Enable Grafana Service ===&lt;br /&gt;
Start the Grafana service and ensure it starts on boot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo systemctl daemon-reload&lt;br /&gt;
sudo systemctl start grafana-server&lt;br /&gt;
sudo systemctl enable grafana-server&lt;br /&gt;
sudo systemctl status grafana-server&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see `active (running)`. Access Grafana at `http://your_server_ip:3000`. The default login is `admin` with the password `admin`. You will be prompted to change this password on first login.&lt;br /&gt;
&lt;br /&gt;
== Connecting Prometheus to Grafana ==&lt;br /&gt;
&lt;br /&gt;
Now, let's configure Grafana to use Prometheus as a data source.&lt;br /&gt;
&lt;br /&gt;
=== Add Prometheus Data Source ===&lt;br /&gt;
1.  Log in to your Grafana instance (`http://your_server_ip:3000`).&lt;br /&gt;
2.  Navigate to the Configuration menu (gear icon on the left sidebar).&lt;br /&gt;
3.  Click on &amp;quot;Data sources&amp;quot;.&lt;br /&gt;
4.  Click &amp;quot;Add data source&amp;quot;.&lt;br /&gt;
5.  Select &amp;quot;Prometheus&amp;quot;.&lt;br /&gt;
6.  In the &amp;quot;URL&amp;quot; field, enter `http://localhost:9090` (or `http://your_server_ip:9090` if Grafana is on a different server).&lt;br /&gt;
7.  Leave &amp;quot;Access&amp;quot; as &amp;quot;Server (default)&amp;quot;.&lt;br /&gt;
8.  Click &amp;quot;Save &amp;amp; test&amp;quot;. You should see a &amp;quot;Data source is working&amp;quot; message.&lt;br /&gt;
&lt;br /&gt;
=== Import a Pre-built Dashboard ===&lt;br /&gt;
Grafana has a vast library of community-contributed dashboards. Importing one is a quick way to visualize your data.&lt;br /&gt;
&lt;br /&gt;
1.  Go to the &amp;quot;Dashboards&amp;quot; menu (four squares icon).&lt;br /&gt;
2.  Click &amp;quot;Import&amp;quot;.&lt;br /&gt;
3.  In the &amp;quot;Import via grafana.com&amp;quot; field, enter a dashboard ID. A good starting point is the &amp;quot;Node Exporter Full&amp;quot; dashboard (ID: 1860).&lt;br /&gt;
4.  Click &amp;quot;Load&amp;quot;.&lt;br /&gt;
5.  On the next screen, select your Prometheus data source from the dropdown.&lt;br /&gt;
6.  Click &amp;quot;Import&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
You should now see a dashboard displaying your server's system metrics!&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
*   **Prometheus not starting:** Check the systemd status with `sudo systemctl status prometheus`. Examine logs with `journalctl -u prometheus`. Common issues include incorrect configuration file paths or permissions.&lt;br /&gt;
*   **Grafana not starting:** Check `sudo systemctl status grafana-server` and `journalctl -u grafana-server`. Ensure the Grafana user has the necessary permissions.&lt;br /&gt;
*   **Data not appearing in Grafana:**&lt;br /&gt;
    *   Verify Prometheus is running and accessible from Grafana (`http://localhost:9090`).&lt;br /&gt;
    *   Check Prometheus's &amp;quot;Targets&amp;quot; page (`http://your_server_ip:9090/targets`) to ensure it's successfully scraping your targets.&lt;br /&gt;
    *   Ensure your firewall is not blocking communication between Grafana and Prometheus.&lt;br /&gt;
*   **Firewall issues:** Ensure ports 9090 (Prometheus) and 3000 (Grafana) are open.&lt;br /&gt;
&lt;br /&gt;
== Further Steps ==&lt;br /&gt;
&lt;br /&gt;
*   **Install Node Exporter:** To get detailed system metrics (CPU, memory, disk, network), install the Node Exporter on your servers and add it as a target in Prometheus. See [[Installing Node Exporter]].&lt;br /&gt;
*   **Configure Alerts:** Set up alerting rules in Prometheus and integrate Grafana with alert managers for proactive notifications.&lt;br /&gt;
*   **Explore other exporters:** Prometheus supports exporters for various services like databases, web servers, and applications.&lt;br /&gt;
&lt;br /&gt;
This setup provides a solid foundation for monitoring your server infrastructure. For demanding workloads or large-scale deployments, consider the high-performance dedicated servers offered by [https://powervps.net/?from=32 PowerVPS].&lt;br /&gt;
&lt;br /&gt;
[[Category:Monitoring]]&lt;br /&gt;
[[Category:Server Administration]]&lt;br /&gt;
[[Category:Linux]]&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>