【Linux】【Services】【SaaS】Docker+kubernetes(12. 部署prometheus/grafana/Influxdb實現監控)

1.簡介node

1.1. 官方網站:mysql

promethos:https://prometheus.io/linux

grafana:https://grafana.com/git

1.2. 架構圖github

 

2. 環境sql

2.1. 機器列表服務器

 

功能與組件 機器名 Public IP Private IP Processor Cores RAM Storage 備註
DNS/NTP/Ansible/Prometheus服務器 HCTJOSINFRA01 10.30.2.81 172.16.0.81        
DNS/NTP/Ansible/Prometheus服務器 HCTJOSINFRA02 10.30.2.82 172.16.0.82        

2.2. 軟件版本架構

promethos:2.1網站

grafana:5.0lua

3. 安裝與配置

3.1. promethos

下載

https://github.com/prometheus/prometheus/releases/download/v2.1.0/prometheus-2.1.0.linux-amd64.tar.gz

 解壓

tar zxfv prometheus-2.1.0.linux-amd64.tar.gz -C /opt/prometheus/

直接後臺啓動

./prometheus --config.file=prometheus.yml &

3.2. exporter

常見exporter

https://prometheus.io/download/

以node_exporter爲例監控機器

tar zxvf node_exporter-0.15.2.linux-amd64.tar.gz -C /opt/prometheus_exporters/

默認啓動就好

/opt/prometheus_exporters/node_exporter &

修改配置文件/opt/prometheus/prometheus-2.1.0.linux-amd64/prometheus.yml

[root@hctjosinfra01 prometheus-2.1.0.linux-amd64]# grep -E -v "^[[:space:]]*$|^[[:space:]]*#" /opt/prometheus/prometheus-2.1.0.linux-amd64/prometheus.yml
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.
alerting:
  alertmanagers:
  - static_configs:
    - targets:
rule_files:
scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']
  - job_name: 'linux_server'
    static_configs:
    - targets: ['172.16.0.81:9100']
      labels:
        instance: linux_server

重啓下prometheus-server

3.3. grafana

下載

https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.0-1.x86_64.rpm

安裝

yum install grafana-5.0.0-1.x86_64.rpm

修改配置文件/etc/grafana/grafana.ini

[database]
url = mysql://grafana:grafana@172.16.0.25:3306/grafana
[security]
admin_user = admin
admin_password = admin

能夠啓動了

systemctl start grafana-server

輸入機器IP:3000進入界面,添加數據源Prometheus(都是圖形化的,就不贅述了)

相關文章
相關標籤/搜索