【Linux】【Services】【SaaS】Docker+kubernetes(12. 部署prometheus/grafana/Influxdb实现监控)...

1.简介

1.1. 官方网站:

promethos:https://prometheus.io/

grafana:https://grafana.com/

1.2. 架构图

 

2. 环境

2.1. 机器列表

 

功能与组件机器名Public IPPrivate IPProcessor CoresRAMStorage备注
DNS/NTP/Ansible/Prometheus服务器HCTJOSINFRA0110.30.2.81172.16.0.81    
DNS/NTP/Ansible/Prometheus服务器HCTJOSINFRA0210.30.2.82172.16.0.82    

2.2. 软件版本

promethos:2.1

grafana:5.0

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(都是图形化的,就不赘述了)

转载于:https://www.cnblogs.com/demonzk/p/8418583.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值