系统监控方案 nodeexporter-prometheus-grafana VS collectd-influxdb-grafana

方案选型

系统监控有很多成熟的方案,商业级监控、企业级监控、小集群监控、个人资源监控等,在不同的应用场景下选型不同的技术方案。
知名度比较高的 zabbix、Nagios、Prometheus等
15个最好的免费开源监控系统
[图片上传失败...(image-1329a-1732168013380)]
https://i-blog.csdnimg.cn/blog_migrate/6d5bbc436a13f6545f103cf1512195b4.png

此处对比两个可私人部署的免费方案
collectd+influxDB+Grafana搭建性能监控平台
Prometheus+Node_exporter+Grafana监控

监控资源的原理

  • 数据采集 :探针程序, 负责收集被监控的终端主机上的cpu、内存、网络、进程等信息
  • 数据存储 :通常采用时序数据库,存储监控的数据
  • 数据显示 : 采用酷炫的前端网页,显示各种图表
  • 数据报警 : 通过定义监控字段的阈值,设置邮件、短信、webhook等方式的报警

方案介绍 nodeexporter + prometheus + grafana

本方案从2018起,几乎是覆盖性席卷,云服务器搭载docker、 kerbuners的资源监控必备。

  • node_exporter 用go写的,轻量级程序只有10M,采集主机上的监控数据
  • prometheus 用go写的,集成了时序数据库TSDB ,负责从node_exporter拉取监控数据并存储, 支持数据的时序查询语法和复杂聚合查询
  • grafana 专业的负责数据显示
    特点在于,go写的,主动拉取式,其方案框架和周边如下图:
    [图片上传失败...(image-97228c-1732168013381)]
    [图片上传失败...(image-c73169-1732168166828)]
    https://i-blog.csdnimg.cn/blog_migrate/9889c8de24a5bc67d0644f3b19a6137b.png

方案介绍 collectd + influxdb + grafana

collectd是c开发的,作为守护进程服务的探针程序。其本身不带数据库,可通过配置把采集的监控数据推送到其他数据库中。collectd可扩展各种数据采集插件,这也导致其看起来臃肿混乱。
[图片上传失败...(image-ba3f80-1732168013381)]
https://i-blog.csdnimg.cn/blog_migrate/a8418b8f4bb6106c13bef45434a983b5.png

方案对比

we will explore the key differences between Prometheus and collectd. Both Prometheus and collectd are popular monitoring tools used in the IT industry for collecting and visualizing metrics. However, they differ in several important aspects.

  • Data storage:
    Prometheus stores data in a time series database, allowing users to query and analyze metrics over time. On the other hand, collectd does not have built-in data storage capabilities and requires integration with other databases or monitoring systems for data storage.

  • Collection method:
    Prometheus uses a pull-based model for metric collection, where it actively queries targets at regular intervals to gather metric data. In contrast, collectd uses a push-based model, where it relies on agents installed on target systems to send metric data to a centralized server.

  • Metrics format:
    Prometheus uses its own exposition format called Prometheus exposition format (text-based format), which is simple and human-readable. In contrast, collectd uses a binary format for transmitting metrics, which is more efficient for data transport but not as easily readable by humans.

  • Monitoring system compatibility:
    Prometheus is designed to be a standalone monitoring system and includes its own visualization and alerting capabilities. Collectd, on the other hand, is often used as a data collection agent for other monitoring systems like Graphite or InfluxDB, which handle visualization and alerting.

  • Scalability and architecture:
    Prometheus uses a federated architecture, allowing multiple Prometheus servers to be connected and form a highly scalable monitoring solution. Collectd, on the other hand, does not have native support for federation and may require additional tools or configurations for achieving similar scalability.

  • Community and ecosystem:
    Prometheus has a large and active community, with a wide range of exporters and integrations available. It also has strong integration with Kubernetes for containerized environments. Collectd also has a community and ecosystem, but it may not be as extensive and mature as Prometheus.

In summary, Prometheus and collectd differ in terms of data storage, collection method, metrics format, monitoring system compatibility, scalability and architecture, and community/ecosystem support. Each tool has its own strengths and use cases, so it is important to consider these differences when choosing the right monitoring solution for your specific needs.

环境安装

====================== Prometheus =============================
wget prometheu-amd64.tar.gz
tar -xzf prometheu-amd64.tar.gz
sudo mv -r prometheus-2.27.1.linux-amd64/ /usr/share/prometheus/
cd /usr/share/prometheus/
./prometheus --version
sudo gedit ./prometheus.yml add node_exporter 127.0.0.1:9100
nohup ./prometheus --config.file=prometheus.yml &
./prometheus
http://127.0.0.1:9090/metrics
http://127.0.0.1:9090/graph

====================== node_exporter =============================
https://github.com/prometheus/node_exporter/releases
wget https://github.com/prometheus/node_exporter/releases/download/v1.2.0/node_exporter-1.2.0.linux-amd64.tar.gz
tar -zxvf node_exporter-1.8.2.linux-amd64.tar.gz
sudo mv node_exporter-1.8.2.linux-amd64 /usr/share/node_exporter
cd /usr/share/node_exporter
./node_exporter --help
./node_exporter --version
nohup ./node_exporter &

====================== grafana =============================
2005 wget https://dl.grafana.com/enterprise/release/grafana-enterprise_11.3.1_amd64.deb
2006 ll -lh
2007 sudo dpkg -i grafana-enterprise_11.3.1_amd64.deb
2008 systemctl status grafana-server.service
2009 systemctl enable grafana-server.service
2010 systemctl status grafana-server.service
2011 sudo systemctl start grafana-server.service
http://127.0.0.1:3000 admin admin or 123456
add datasource add dashboards

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 212,029评论 6 492
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 90,395评论 3 385
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 157,570评论 0 348
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 56,535评论 1 284
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 65,650评论 6 386
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,850评论 1 290
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,006评论 3 408
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,747评论 0 268
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,207评论 1 303
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,536评论 2 327
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,683评论 1 341
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,342评论 4 330
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,964评论 3 315
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,772评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,004评论 1 266
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,401评论 2 360
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,566评论 2 349

推荐阅读更多精彩内容