prometheus监控
监控系统的作用:
实时监控。提供硬件和软件的运行状态展示告警。符合预设告警阈值则通过多种方式发送告警信息辅助决策。大数据监控不仅提供实时状态展现,更能帮助故障回溯和预测风险
zabbix和Prometheus区别
因为除了学习Prometheus之外,还学了zabbix,所以进行了个对比
Prometheus的架构图
安装实践过程:
安装go 语言环境
在监控服务器上安装prometheus
在被监控环境上安装export
安装grafana
环境说明
环境 | 版本 |
---|
操作系统 | CentOS8-(192.168.230.131) | Prometheus | prometheus-2.31.1.linux-amd64.tar.gz | go | go1.17.3.linux-amd64.tar.gz |
Prometheus的部署
Prometheus 是用golang开发的,所以需要go环境
Prometheus官方下载地址:https://prometheus.io/download/#prometheus go官方下载地址:https://studygolang.com/dl Grafana下载地址:https://dl.grafana.com/oss/release/grafana-7.3.3-1.x86_64.rpm
[root@localhost src]
/usr/local/src
[root@localhost src]
go1.17.3.linux-amd64.tar.gz prometheus-2.32.0-beta.0.linux-amd64.tar.gz
grafana-7.3.3-1.x86_64.rpm
[root@localhost src]
[root@localhost src]
[root@localhost local]
bin etc games go include lib lib64 libexec sbin share src
[root@localhost local]
[root@localhost ~]
//在文件的最后添加如下内容:
87 export PATH=$PATH:/usr/local/go/bin
[root@localhost ~]
//用go version 来验证是否成功
[root@localhost ~]
go version go1.17.3 linux/amd64
在监控服务器上安装prometheus
[root@localhost src]
[root@localhost src]
prometheus-2.32.0-beta.0.linux-amd64/
prometheus-2.32.0-beta.0.linux-amd64/consoles/
prometheus-2.32.0-beta.0.linux-amd64/consoles/index.html.example
prometheus-2.32.0-beta.0.linux-amd64/consoles/node-cpu.html
prometheus-2.32.0-beta.0.linux-amd64/consoles/node-disk.html
prometheus-2.32.0-beta.0.linux-amd64/consoles/node-overview.html
prometheus-2.32.0-beta.0.linux-amd64/consoles/node.html
prometheus-2.32.0-beta.0.linux-amd64/consoles/prometheus-overview.html
prometheus-2.32.0-beta.0.linux-amd64/consoles/prometheus.html
prometheus-2.32.0-beta.0.linux-amd64/console_libraries/
prometheus-2.32.0-beta.0.linux-amd64/console_libraries/menu.lib
prometheus-2.32.0-beta.0.linux-amd64/console_libraries/prom.lib
prometheus-2.32.0-beta.0.linux-amd64/prometheus.yml
prometheus-2.32.0-beta.0.linux-amd64/LICENSE
prometheus-2.32.0-beta.0.linux-amd64/NOTICE
prometheus-2.32.0-beta.0.linux-amd64/prometheus
prometheus-2.32.0-beta.0.linux-amd64/promtool
[root@localhost src]
'/usr/local/prometheus' -> '/usr/local/prometheus-2.32.0-beta.0.linux-amd64/'
[root@localhost src]
[root@localhost local]
总用量 0
drwxr-xr-x. 2 root root 6 5月 19 2020 bin
drwxr-xr-x. 2 root root 6 5月 19 2020 etc
drwxr-xr-x. 2 root root 6 5月 19 2020 games
drwxr-xr-x. 10 root root 257 11月 4 22:04 go
drwxr-xr-x. 2 root root 6 5月 19 2020 include
drwxr-xr-x. 2 root root 6 5月 19 2020 lib
drwxr-xr-x. 3 root root 17 10月 30 20:20 lib64
drwxr-xr-x. 2 root root 6 5月 19 2020 libexec
lrwxrwxrwx. 1 root root 48 11月 25 23:25 prometheus -> /usr/local/prometheus-2.32.0-beta.0.linux-amd64/
drwxr-xr-x. 4 3434 3434 132 11月 16 19:35 prometheus-2.32.0-beta.0.linux-amd64
[root@localhost local]
[root@localhost ~]
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 128 *:9090 *:*
验证一下
查看监控任务的状态
查看 prometheus 的配置信息
查看 prometheus 运行状态
|