Why Choose Prometheus Over Zabbix? A Step‑by‑Step Installation and Monitoring Guide
This article compares Prometheus and Zabbix, explains how to install and configure Prometheus, set up exporters like node_exporter, integrate with Grafana, and visualize system metrics, providing practical commands and configuration examples for effective monitoring.
1. Prometheus vs Zabbix
Like Zabbix, Prometheus is a popular open‑source monitoring framework, but it is more modular and flexible. Its server and client are ready‑to‑run out of the box, whereas Zabbix requires a heavyweight installation.
Zabbix agents pull data via scripts, while Prometheus uses language‑specific SDKs or exporters that push metrics over HTTP (pull model). Prometheus stores data locally on the client side, and the server scrapes it periodically. The UI of Prometheus is minimalistic; pairing it with Grafana provides a richer experience.
2. Install Prometheus
Prometheus can be installed by downloading and extracting a tarball; no additional installer is needed.
<code>$ wget https://github.com/prometheus/prometheus/releases/download/v2.7.2/prometheus-2.7.2.linux-amd64.tar.gz
$ tar xvfz prometheus-2.7.2.linux-amd64.tar.gz</code>Enter the extracted directory and run the server:
<code>$ cd prometheus-2.7.2.linux-amd64
$ ./prometheus --version # check version
$ ./prometheus --config.file=prometheus.yml # start server</code>The
prometheus.ymlfile is the main configuration file.
3. Configure Prometheus
The configuration file is concise; an example is shown below.
<code>$ cat prometheus.yml
# my global config
global:
scrape_interval: 15s
evaluation_interval: 15s
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
# Load rule files
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
# Scrape configurations
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']</code>The file consists of four main sections:
global : defines
scrape_intervaland
evaluation_interval.
alerting : configures Alertmanager (not installed in this guide).
rule_files : lists alert rule files.
scrape_configs : specifies targets to scrape; each
job_namerepresents a monitoring target.
4. Prometheus UI
After starting the server, open
http://<IP>:9090in a browser to view the Prometheus UI.
The interface shows tabs such as Alerts, Graph, and Status. The Graph tab can display metrics like
promhttp_metric_handler_requests_total.
5. Add Machine‑Status Monitoring
Install the
node_exporterto monitor CPU, disk, network, etc.
<code>// Download latest release
$ wget https://github.com/prometheus/node_exporter/releases/download/v0.17.0/node_exporter-0.17.0.linux-amd64.tar.gz
// Extract
$ tar xvfz node_exporter-0.17.0.linux-amd64.tar.gz
// Enter directory
$ cd node_exporter-0.17.0.linux-amd64
// Run exporter
$ ./node_exporter</code>The exporter listens on port 9100. Add it as a target in
prometheus.yml:
<code>scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'server'
static_configs:
- targets: ['localhost:9100']</code>Restart Prometheus and verify the new target shows status “UP”.
6. Install Grafana
Grafana provides a powerful visualization layer for Prometheus data.
<code>$ wget https://dl.grafana.com/oss/release/grafana-6.0.0.linux-amd64.tar.gz
$ tar -zxvf grafana-6.0.0.linux-amd64.tar.gz</code>Run Grafana:
<code>$ cd grafana-6.0.0
$ ./bin/grafana-server web</code>Grafana runs on port 3000 by default; the port can be changed via
custom.ini.
7. Display Monitoring Data in Grafana
Access
http://<IP>:3000(default credentials admin/admin). Add a Prometheus data source pointing to
http://localhost:9090. Import ready‑made dashboards (e.g., “Prometheus 2.0 Stats” or node_exporter dashboards) to visualize system metrics.
Plugins can be installed with the Grafana CLI:
<code>// inside Grafana/bin
./grafana-cli plugins install [plugin_name]
// restart Grafana</code>Efficient Ops
This public account is maintained by Xiaotianguo and friends, regularly publishing widely-read original technical articles. We focus on operations transformation and accompany you throughout your operations career, growing together happily.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.