PROMETHEUS SETUP ON CENTOS-7
======================================================================================
prerequisites:- server, node1, node2.
======================================================================================
video name:- Installing prometheus on centos
======================================================================================
step 1:- download Prometheus wget https://github.com/prometheus/prometheus/releases/download/v2.3.1/prometheus-2.3.1.linux-amd64.tar.gz #in central server
step 2:- unzip the Prometheus tar file using
tar xvf prometheus-2.3.0.linux-amd64.tar.gz
step 3:- cd prometheus-2.3.0.linux-amd64
step 4:- vi Prometheus.yml
step 5:- now add below code to the Prometheus.yml file
# 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).
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:
alerting:
alertmanagers:
# – static_configs:
# – targets:
# – alertmanager:9093
# – 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”
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’
scrape_interval: 5s
# metrics_path defaults to ‘/metrics’
# scheme defaults to ‘http’.
# 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’
scrape_interval: 5s
# metrics_path defaults to ‘/metrics’
# scheme defaults to ‘http’.
static_configs:
– targets: [‘192.168.22.110:9090‘] #server ip port
– targets: [‘192.168.22.110:9090‘] #server ip port
– job_name: ‘export_node’
scrape_interval: 5s
# metrics_path defaults to ‘/metrics’
# scheme defaults to ‘http’.
scrape_interval: 5s
# metrics_path defaults to ‘/metrics’
# scheme defaults to ‘http’.
static_configs:
– targets: [‘node1′,’node2’] #node ip of other system
– targets: [‘node1′,’node2’] #node ip of other system
#save prometheus.yml
======================================================================================
[Lab 39] Monitoring Tools – Setup Prometheus and Grafana Using Docker
======================================================================================
step 1:- now download node_exporter to mentioned node1, node2.
#download node_exporter:-
wget https://github.com/prometheus/node_exporter/releases/download/v0.16.0/node_exporter-0.16.0.linux-amd64.tar.gz
step 2:- extract the node_exporter-0.16.0.linux-amd64.tar.gz by using
tar xvf node_exporter-0.16.0.linux-amd64.tar.gz
step 3:- cd node_exporter && ./node_exporter
step 4:- now on the server run
by executing :- ./prometheus
it accessible on https://serverIP:9090 port
step 5:- check whether targets are in up state or not in the
“status –> targets”
if it in up state its running successfully.
======================================================================================
task 2:- now add Prometheus to grafana board:
======================================================================================
======================================================================================
step 1:- download grafana docker image
docker pull grafana/grafana #in server
and run
docker run -d -it –name grafana -p 3000:3000 grafana/grafana
step 2:- now it accessible on
http://serverip:3000 #port and login with
user name: admin
password : admin
user name: admin
password : admin
step 3:- add dash board, add graph and empty board
step 4:- on empty board edit –> metrics –> add data from
(Prometheus server:- node_filesystem_size_bytes #you will get data of nodes, copy particular node data and paste) and do changes as required.
change metrics to Prometheus
measures into bits
now it show the space in Gb
step 5:- edit graph board –> metrics –>
A:- mount point from prometheus( node_filesystem_size_bytes{device=”/dev/mapper/centos_devops01-root”,fstype=”xfs”,instance=“node1”,job=”export_node”,mountpoint=”/”})
legend format:- {{device}}-{{mountpoint}}
data source :- Prometheus
data source :- Prometheus
B:- node_filesystem_size_bytes{device=”/dev/sda1″,fstype=”xfs”,instance=“node1”,job=”export_node”,mountpoint=”/boot”}
legend format:- {{device}}-{{mountpoint}}
now save
=================================================================================
now to see the result goto the Dashboards –> manage –> it displays list of dashboards add access your dashboard
No comments:
Post a Comment