cd /tmp
wget -c https://github.com/prometheus/prometheus/releases/download/v2.13.1/prometheus-2.13.1.linux-amd64.tar.gz
tar zxvf prometheus-2.13.1.linux-amd64.tar.gz
mv prometheus-2.13.1.linux-amd64 /opt/prometheus-server
cd /opt/prometheus-server
vim config.yml
# 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=` to any timeseries scraped from this config.
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'openstack-sd'
openstack_sd_configs:
- identity_endpoint: https://keystone-url:5000/v3
username: username
project_id: projectid
password: password
role: instance
region: region-name
domain_name: domain-name
port: 9100
vim /etc/systemd/system/prometheus-server.service
[Unit]
Description=Prometheus Server
[Service]
User=root
ExecStart=/opt/prometheus-server/prometheus --config.file=/opt/prometheus-server/config.yml --web.external-url=http://ip-server:9090/
[Install]
WantedBy=default.target
systemctl daemon-reload
systemctl enable prometheus-server.service
systemctl start prometheus-server.service
systemctl status prometheus-server.service
ss -tulpn |grep 9090
cd /tmp
wget -c https://dl.grafana.com/oss/release/grafana_6.4.3_amd64.deb
dpkg -i grafana_6.4.3_amd64.deb
systemctl daemon-reload
systemctl start grafana-server
systemctl enable grafana-server
systemctl status grafana-server
ss -tulpn | grep 3000
- Login to Grafana
- Add data source
- Choose Prometheus
Name: Prometheus
Http settings
URL: http://localhost:9090
- Save and Test
- Add Dashboard
cd /tmp/
wget -c https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz
tar zxvf node_exporter-0.18.1.linux-amd64.tar.gz
mv node_exporter-0.18.1.linux-amd64 /opt/node_exporter
cat << EOF >/etc/systemd/system/node_exporter.service
[Unit]
Description=Node Exporter
[Service]
User=root
ExecStart=/opt/node_exporter/node_exporter
[Install]
WantedBy=default.target
EOF
systemctl daemon-reload
systemctl enable node_exporter.service
systemctl start node_exporter.service
systemctl status node_exporter.service