实时监控。提供硬件和软件的运行状态展示告警。符合预设告警阈值则通过多种方式发送告警信息辅助决策。大数据监控不仅提供实时状态展现,更能帮助故障回溯和预测风险
zabbix和Prometheus区别因为除了学习Prometheus之外,还学了zabbix,所以进行了个对比
-
Zabbix 上手快,基本功能也都有,如果是常规监控,没有太多的个性化需求,或者很大的监控对象规模,zabbix 可以了。
-
Prometheus 架构复杂,上手有难度。胜在社区插件齐全,数据查询灵活,二次开发方便,还是CNCF 项目,不用担心未来没人管。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 是用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]# pwd /usr/local/src [root@localhost src]# ls 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]# tar -C /usr/local/ -xvf go1.17.3.linux-amd64.tar.gz [root@localhost src]# cd .. [root@localhost local]# ls bin etc games go include lib lib64 libexec sbin share src [root@localhost local]# cd [root@localhost ~]# vim /etc/profile //在文件的最后添加如下内容: 87 export PATH=$PATH:/usr/local/go/bin [root@localhost ~]# source /etc/profile //用go version 来验证是否成功 [root@localhost ~]# go version go version go1.17.3 linux/amd64在监控服务器上安装prometheus
[root@localhost src]# cd /usr/local/src/ [root@localhost src]# tar -vxf prometheus-2.32.0-beta.0.linux-amd64.tar.gz -C /usr/local 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]# ln -sv /usr/local/prometheus-2.32.0-beta.0.linux-amd64/ /usr/local/prometheus '/usr/local/prometheus' -> '/usr/local/prometheus-2.32.0-beta.0.linux-amd64/' [root@localhost src]# cd .. [root@localhost local]# ll 总用量 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]# /usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml & [root@localhost ~]# ss -anlt 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 *:*验证一下 查看监控任务的状态



