Bootstrap

prometheus安装和部署

—prometheus简介

  1. prometheus是基于go语言开发的一套开源的监控、报警、和时间序列数据库的组合
  2. prometheus于2016年加入CNCF,2018年8月9日称为CNCF继k8s之后毕业的第二个项目

—Prometheus的架构

  1. prometheus server:主服务 接受外部http请求、收集指标数据、存储指标数据、查询指标数据等
  2. prometheus targets:静态发现目标后执行指标数据抓取
  3. service discovery:动态发现目标后执行指标数据抓取
  4. prometheus alerting:调用alertmanager组件实现报警通知
  5. push gateway:数据收集代理服务器
  6. data visualization and export:数据可视化与数据导出

—下载安装包部署并启动Prometheus

wuyang@wuyang-virtual-machine:~$ mkdir prometheus
wuyang@wuyang-virtual-machine:~$ cd prometheus/
wuyang@wuyang-virtual-machine:~/prometheus$ wget https://github.com/prometheus/prometheus/releases/download/v2.40.5/prometheus-2.40.5.linux-amd64.tar.gz
wuyang@wuyang-virtual-machine:~/prometheus$ tar xvf prometheus-2.40.5.linux-amd64.tar.gz 
wuyang@wuyang-virtual-machine:~/prometheus$ cd prometheus-2.40.5.linux-amd64/
wuyang@wuyang-virtual-machine:~/prometheus/prometheus-2.40.5.linux-amd64$ ./prometheus &

—web界面访问

在这里插入图片描述

—安装node-export 并在运行

wuyang@wuyang-virtual-machine:~/prometheus/prometheus-2.40.5.linux-amd64$ cd ~
wuyang@wuyang-virtual-machine:~$ mkdir node-export
wuyang@wuyang-virtual-machine:~$ cd node-export/
wuyang@wuyang-virtual-machine:~/node-export$ wget https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gz
wuyang@wuyang-virtual-machine:~/node-export$ tar xvf node_exporter-1.5.0.linux-amd64.tar.gz
wuyang@wuyang-virtual-machine:~/node-export/node_exporter-1.5.0.linux-amd64$ ./node_exporter &

—web界面访问node-export

在这里插入图片描述

—修改Prometheus配置文件

wuyang@wuyang-virtual-machine:~/node-export/node_exporter-1.5.0.linux-amd64$ cd ~
wuyang@wuyang-virtual-machine:~$ cd prometheus/
wuyang@wuyang-virtual-machine:~/prometheus$ cd prometheus-2.40.5.linux-amd64/
wuyang@wuyang-virtual-machine:~/prometheus/prometheus-2.40.5.linux-amd64$ vim prometheus.yml

在这里插入图片描述

—重启Prometheus服务 登录web界面

wuyang@wuyang-virtual-machine:~/prometheus/prometheus-2.40.5.linux-amd64$ pidof prometheus
10340
wuyang@wuyang-virtual-machine:~/prometheus/prometheus-2.40.5.linux-amd64$ vim prometheus.yml 
wuyang@wuyang-virtual-machine:~/prometheus/prometheus-2.40.5.linux-amd64$ kill -9 10340
wuyang@wuyang-virtual-machine:~/prometheus/prometheus-2.40.5.linux-amd64$ ./prometheus &

在这里插入图片描述

;