栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

prometheus监控部署

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

prometheus监控部署

prometheus
    • 1.prometheus简介
      • 1.1 prometheus特点
      • 1.2 组件
    • 2.安装

1.prometheus简介

Prometheus是由SoundCloud开发的开源监控报警系统和时序列数据库(TSDB)。Prometheus使用Go语言开发,是Google BorgMon监控系统的开源版本

1.1 prometheus特点
  • 多维度数据模型。
  • 灵活的查询语言。
  • 不依赖分布式存储,单个服务器节点是自主的。
  • 通过基于HTTP的pull方式采集时序数据。
  • 可以通过中间网关进行时序列数据推送。
  • 通过服务发现或者静态配置来发现目标服务对象。
  • 支持多种多样的图表和界面展示,比如Grafana等。
1.2 组件
名称功能
Server主要负责数据采集和存储,提供PromQL查询语言的支持。
alertmanager警告管理器,用来进行报警。
Push Gateway支持临时性Job主动推送指标的中间网关。
2.安装

安装go 语言环境
https://golang.google.cn/dl/

[root@localhost ~]# wget https://dl.google.com/go/go1.17.3.linux-amd64.tar.gz
[root@localhost ~]# tar xf go1.17.3.linux-amd64.tar.gz -C /usr/local/

[root@localhost ~]# tail -1 /etc/profile
export PATH=$PATH:/usr/local/go/bin
[root@localhost ~]# source /etc/profile
[root@localhost ~]# go version
go version go1.17.3 linux/amd64

安装prometheus
https://prometheus.io/download/

[root@localhost ~]# ls
anaconda-ks.cfg  go1.17.3.linux-amd64.tar.gz  prometheus-2.31.1.linux-amd64.tar.gz  wget-log

//解压
[root@localhost ~]# tar xf prometheus-2.31.1.linux-amd64.tar.gz -C /usr/local/
[root@localhost ~]# ls /usr/local/
bin  etc  games  go  include  lib  lib64  libexec  prometheus-2.31.1.linux-amd64  sbin  share  src

//重命名
[root@localhost ~]# mv /usr/local/prometheus-2.31.1.linux-amd64/ /usr/local/prometheus
[root@localhost ~]# ls /usr/local/
bin  etc  games  go  include  lib  lib64  libexec  prometheus  sbin  share  src

//启动
[root@localhost ~]# cat /usr/lib/systemd/system/prometheus.service
[Unit]
Description=prometheus service

[Service]
User=root
ExecStart=/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml --storage.tsdb.path=/usr/local/prometheus/data
ExecStop=/bin/kill -9 $MAINPID

TimeoutStopSec=10
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

[root@localhost ~]# systemctl daemon-reload 
[root@localhost ~]# systemctl enable --now prometheus.service 
Created symlink /etc/systemd/system/multi-user.target.wants/prometheus.service → /usr/lib/systemd/system/prometheus.service.
[root@localhost ~]# ss -anltu
Netid     State      Recv-Q      Send-Q           Local Address:Port           Peer Address:Port     Process     
tcp       LISTEN     0           128                    0.0.0.0:22                  0.0.0.0:*                    
tcp       LISTEN     0           128                       [::]:22                     [::]:*                    
tcp       LISTEN     0           128                          *:9090                      *:*                    

浏览器输入ip+9090访问Prometheus自带的监控页面

被监控主机安装exporter
https://prometheus.io/download/
往下翻找到node_exporter’

[root@localhost ~]# wget https://github.com/prometheus/node_exporter/releases/download/v1.3.0/node_exporter-1.3.0.linux-amd64.tar.gz

prometheus搭配grafana使用
安装grafana
https://grafana.com/grafana/download

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/599418.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号