Skip to content

3.2独享云服务机器状态调用预言

需求:监控任意一台主机的信息

镜像的话,直接带iserver+agent linux,就是iserver+agent安装工具+自动配置工具 windows,也是iserver+agent安装工具+自动配置工具

CB74F8F755EE53334F1B65E3082C3B84

Prometheus与Zabbix对比

参考资料:https://baijiahao.baidu.com/s?id=1754886952656175644&wfr=spider&for=pc

zabbixprometheus
时间老牌新秀
量级总量轻量
数据库关系数据库时序数据库
架构Zabbix在容器与云原生的监控不如更好地与容器平台、云平台配合

正如上述所说的,Prometheus在容器与云原生监控方面有优势,对于容器与云原生资源较多的企业,布署Prometheus基本是没有什么问题的;对基础监控需求更强的企业,一般来说,Zabbix大而全的功能可能更适合。

Prometheus

官网:https://prometheus.io

开发文档:https://prometheus.io/docs/introduction/overview/

prometheus各组件:https://prometheus.io/download/

阿里云产品:https://help.aliyun.com/product/122122.html?spm=a2c4g.11186623.0.0.386a5d03m7BFbi

研究院资料(imanager)

cd:http://192.168.11.188:31100/

docker开源监控方案:https://wiki.ispeco.com/pages/viewpage.action?pageId=64128262

云套件服务状态监控方案:https://wiki.ispeco.com/pages/viewpage.action?pageId=139472706

https://wiki.ispeco.com/pages/viewpage.action?pageId=105939916

数据库监控:https://wiki.ispeco.com/pages/viewpage.action?pageId=105946223

外网资料

https://blog.csdn.net/qq_46601365/article/details/126345819

https://github.com/yunlzheng/prometheus-book

Cdtest环境

granfana: http://monitoring.supermapol.cn/d/9CWBz0bik/zhu-ji-xiang-qing?orgId=1

prometheus: http://192.168.11.188:31530

imanager:http://192.168.11.188:31100

Java集成Prometheus获取Prometheus监控的数据

https://blog.csdn.net/qq_46601365/article/details/126345819

方案:

  • 使用Prometheus的http接口获取其监控的数据,推荐使用,每一个监控指标都有一个接口获取其监控的数据。
  • Prometheus底层是用go语言编写,如果想要模仿go语言的实现逻辑书写一套Java读取Prometheus数据库的操作,成本太高,不建议使用。
  • 使用Prometheus集成kafka的操作能大大降低其性能损耗,是目前最优的方式。(升级版)

PromQL

示例指标

node_load1 指1分钟内cpu平均负载

http_requests_total{code="200"} 200请求数

rate(node_cpu_seconds_total{mode="system"}[1m]) 系统模式下每秒平均花费的CPU时间(以秒为单位)

node_filesystem_avail_bytes 非root用户可用的文件系统空间(以字节为单位)

node_memory_MemAvailable 可用内存

container_cpu_usage_seconds_total:每个cpu消耗的累计cpu时间(秒)

process_cpu_seconds_total:用户和系统cpu花费的总时间(秒)

node_memory_Active_bytes/(102410241024) 内存实际容量