基于prometheus的监控解决方案

1、前言

    鄙人就任于某安全公司,团队的定位是研发安全产品云汇聚平台,为用户提供弹性伸缩的云安全能力。前段时间产品组提出了一个监控需求,大体要求:平台对vm实行动态实时监控,输出相应图表界面,并提供警报(资源不足等问题而产生)等功能。前端

 

2、方案调研

    通过团队调研,目前业界流行的监控方案大体有这么几种:基于 zabbix 的、基于 prometheus 的、基于 influxdb 等时序数据库的。结合当前咱们的业务场景来说,zabbix对咱们来讲有点重,而 influxdb 方案灵活可是投入的研发时间多是比较多的,prometheus就成了咱们的不二之选择。mysql

 

 

3、prometheus介绍

    

         1. What is prometheus ?  下面是官网的一段原话:

    Prometheus is an open-source systems monitoring and alerting toolkit originally built at SoundCloud. Since its inception in 2012, many companies and organizations have  adopted Prometheus, and the project has a very active developer and user community. It is now a standalone open source project and maintained independently of any company.To emphasize this, and to clarify the project's governance structure, Prometheus joined the Cloud Native Computing Foundation in 2016 as the second hosted project,after Kubernetes.nginx

    大体就是说  prometheus是一个开源的监控,警报系统,最初呢是构建在SoundCloud之上的。。。而后不少公司组织都在用,活跃的开发者不少,社区也不少,反正很牛逼。。。这样。git

   

    2.Components

     prometheus大体有这么几个组件组成:github

       1). Prometheus server: 用于抓取数据,并存储到时序数据库

       2). client librabries:用于一些应用的定制化监控

       3). push gateway:用于短生存周期的job推送

       4). exporter:安装在监控目标的机子上,为server提供数据抓取的接口,须要定制化。。固然官网也提供了不少经常使用的exporter ,用于mysql,redis,nginx,宿主机等等等等,有需求的能够去这里https://prometheus.io/docs/instrumenting/exporters/看看。

                     5). alertmanager:用于处理警报。

     

    3.架构图

 

      

        

            应该不须要怎么介绍了吧,我相信你们均可以看得懂。redis

      

 

 

4、结合业务使用

    有了prometheus这个强大的监控开源系统以后,咱们所须要投入的工做就是查询api的封装和配置文件的下发。查询api的封装没什么好说的,无非就是前端调用咱们本身的server,咱们的   server呢经过http协议去调用prometheus的api接口查询到原始数据,而后进行组装,最后返回给前端。 配置文件的话包含三部分吧,警报的定义,alertmanager的配置,以及prometheus的配置,这里也很差展开讲,有兴趣的能够去官网看看,最后给出一张咱们的物理结构示意图,供你们参考。    sql

相关文章
相关标签/搜索