This tutorail will show you how you can create a Grafana Server and how to download Grafana agents and Prometheus to your servers.
Start Prometheus Main server
wget https://github.com/prometheus/prometheus/releases/download/v2.48.0/prometheus-2.48.0.linux-amd64.tar.gz
tar xvfz prometheus-*.tar.gz
cd prometheus-*-amd64/
screen -S prometheus
=> creates a new screen in you serverUpdate prometheus yaml file:
nano /prometheus-2.48.0.linux-amd64/prometheus.yml
Example:
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: "prometheus"
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ["localhost:9090"]
# configs for scraping node exporter metrics
- job_name: node
static_configs:
- targets: ['localhost:9100']
Run ./prometheus --config.file=prometheus.yml
-
http://public ip:9090/metrics
You should be able to see Prometheus metrics.
(Use Ctrl a+d = go to main screen)
Download Node exporter:
screen -S node-exporter
wget https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gz
tar xvfz node_exporter-*.*-amd64.tar.gz
cd node_exporter-*.*-amd64
./node_exporter
-
http://<public ip>:9100/metrics
Prometheus metrics
(Ctrl a+d = Go to main screen)
- Install Grafana
sudo yum install -y https://dl.grafana.com/enterprise/release/grafana-enterprise-9.5.2-1.x86_64.rpm sudo systemctl start grafana-server.service
This is your Grafana server: http://public ip:3000/
Setup your admin name and pass
- Username: admin
- Password: mypass
Note: service grafana-server restart
= If you make any changes to the main server's configuration, be sure to run this command afterwards.
Resources:
The upcoming tutorials will cover the topics of creating dashboards, alerting systems, and integrating with Slack.
Top comments (0)