您现在的位置是:系统运维 >>正文
监控系统自监控怎么做?
系统运维2人已围观
简介问题监控系统用于监控其他的系统、基础设施,绝对是 P0 级的服务,那监控系统的自监控应该怎么做呢?如果自己监控自己,有些组件挂掉了难免循环依赖,如果单独搞一套新的监控系统来监控当前服役的监控系统,又搞 ...
问题
监控系统用于监控其他的监控系统、基础设施,系统绝对是自监 P0 级的服务 ,那监控系统的监控自监控应该怎么做呢?如果自己监控自己 ,有些组件挂掉了难免循环依赖 ,系统如果单独搞一套新的自监监控系统来监控当前服役的监控系统,又搞得有些过于复杂 。监控本文我们来探讨一下监控系统的系统自监控应该怎么做 。
解决方案 :自身指标
首先,自监监控系统自身是服务器租用监控会暴露监控指标的,比如 Prometheus 、系统VictoriaMetrics、自监Nightingale ,监控都通过 /metrics 接口暴露了自身的系统监控指标 ,这些指标通过监控系统自身的自监采集机制去采集就好 ,相关数据的历史趋势图、告警规则,也在监控系统自身配置好 ,只要自身模块没有挂掉 ,或者没有全部挂掉,相关数据基本都可以正常使用。云计算
比如 Nightingale 的自身监控指标,可以通过 categraf 的 input.prometheus 插件来采集,即 conf/input.prometheus/prometheus.toml 的内容如下:
[[instances]] urls = [ "http://localhost:17000/metrics" ]localhost:17000 换成你的 Nightingale 的地址即可。然后导入内置仪表盘:https://github.com/ccfos/nightingale/tree/main/integrations/n9e/dashboards ,即可看到 Nightingale 自身的监控指标了。
解决方案:存活监控
如果监控系统同时有多个模块故障 ,此时自身指标可能都采集不到了 ,告警引擎可能也有故障,此时就没法通过自身指标来监控了,此时就需要一个外挂的源码下载小监控系统来监控这类严重情况了。而且,告警通道尽量也不要复用之前的通道 ,因为通道可能也会故障。
我的建议是采用 catpaw + FlashDuty 来搞这个需求 。FlashDuty 是外网的 SaaS 服务 ,只要公网出口是好的 ,就能提供监控服务,而且无需我们维护,模板下载使用免费套餐都够用 ,毕竟监控系统也不会经常挂。 。 。
catpaw 最新版本是 v0.7.0,已经提供了 exec(执行脚本的插件)、filechange(文件变化监控的插件)、http(HTTP探测的插件) 、journaltail(系统日志异常检测插件) 、mtime(递归判断文件变化的插件)、net(TCP、建站模板UDP探测的插件) 、ping(PING插件)、procnum(进程数量监控插件) 、sfilter(自定义脚本插件 ,相比exec插件更简单 ,匹配脚本输出) 等多个监控插件,我们可以使用 net 插件来探测监控系统的各个组件的存活情况 ,比如下面是 net 插件的配置样例 :
[[instances]] targets = [ # "127.0.0.1:22", # "localhost:6379", # ":9090" ] ## Set timeout (default 5 seconds) # timeout = "5s" ## Set read timeout (only used if expecting a response) # read_timeout = "5s" # # Concurrent requests to make per instance # concurrency = 10 # # gather interval # interval = "30s" # # Optional append labels # labels = { env="production", team="devops" } ## Protocol, must be "tcp" or "udp" ## NOTE: because the "udp" protocol does not respond to requests, it requires ## a send/expect string pair (see below). # protocol = "tcp" ## The following options are required for UDP checks. For TCP, they are ## optional. The plugin will send the given string to the server and then ## expect to receive the given expect string back. ## string sent to the server # send = "ssh" ## expected string in answer # expect = "ssh" [instances.alerting] ## Enable alerting or not enabled = true ## Same functionality as Prometheus keyword for for_duration = 0 ## Minimum interval duration between notifications repeat_interval = "5m" ## Maximum number of notifications repeat_number = 3 ## Whether notify recovery event recovery_notification = true ## Choice: Critical, Warning, Info default_severity = "Warning"如果目标 IP:Port 连不上了 ,就会报警,报警事件的具体推送策略在 [instances.alerting] 配置段配置。免费模板
如果监控系统的某个模块 ,不监听端口,没法监控端口存活,可以使用进程数量监控 ,即 procnum 插件 ,相关配置样例如下:
[[instances]] # # executable name (ie, pgrep <search_exec_substring>) # search_exec_substring = "" # # pattern as argument for pgrep (ie, pgrep -f <search_cmdline_substring>) search_cmdline_substring = "" # # windows service name # search_win_service = "" alert_if_num_lt = 1 check = "进程存活检测(进程数量检测)" interval = "30s" [instances.alerting] ## Enable alerting or not enabled = true ## Same functionality as Prometheus keyword for for_duration = 0 ## Minimum interval duration between notifications repeat_interval = "5m" ## Maximum number of notifications repeat_number = 3 ## Whether notify recovery event recovery_notification = true ## Choice: Critical, Warning, Info default_severity = "Warning"net 和 procnum 这两个插件配合 ,理论上一定可以发现进程挂掉的情况,如此一来 ,严重的情况 catpaw 就可以发现了,不严重的情况 ,监控系统自身的指标就可以发现了 ,齐活。
Tags:
转载:欢迎各位朋友分享到网络,但转载请说明文章出处“信息技术视野”。http://www.bziz.cn/html/097b699896.html
上一篇:网络安全知识:什么是云安全?
下一篇:基于追踪标记的WAF设计思路
相关文章
数百个Elasticsearch数据库遭到勒索攻击
系统运维据报道,因为Elasticsearch数据库安全防护薄弱的缘故,导致其被黑客盯上,并被黑客用勒索信替换了其数据库的450个索引,如需恢复则需要支付赎金620美元,而总赎金打起来则达到了279,000美 ...
【系统运维】
阅读更多如何利用Switch加速电脑?(教你简单操作,提高电脑速度!)
系统运维在日常使用电脑的过程中,我们经常会遇到电脑运行缓慢的情况。为了解决这个问题,本文将介绍如何利用Switch来加速电脑,提高其运行速度。Switch是一种网络设备,通过调整网络连接,优化带宽分配,从而提 ...
【系统运维】
阅读更多《牧场物语电脑操作教程——让你成为农场达人》(从零基础到游戏高手,掌握关键技巧!)
系统运维牧场物语是一款非常受欢迎的模拟经营类游戏,玩家在游戏中扮演农场主角色,通过耕种、养殖等活动来经营自己的农场。本篇文章将为大家详细介绍牧场物语在电脑上的操作技巧和注意事项,帮助初学者快速上手,让你成为一 ...
【系统运维】
阅读更多
热门文章
最新文章
友情链接
- 戴尔PowerFlex 4.0为客户的IT现代化之旅奠定了坚实的基础
- 雨林木风装机教程(一步步教你如何选择雨林木风配件,组装一台性能出色的电脑)
- 魅蓝2红米2电信版如何?(用一台手机满足所有需求,)
- 2015大白菜U盘装系统教程(使用大白菜U盘轻松安装操作系统)
- 数据中心领域的可持续性
- 如何合理利用闹钟提高生活效率(闹钟的功能和运用技巧)
- 戴尔Latitude 5530 业界首款使用生物基材料的PC
- 电脑U盘重做系统教程(详细步骤和注意事项)
- 大白菜v5.0装系统教程(一键安装系统,简单快捷省时省力)
- 揭秘格力U尊(智能控制、高能效、出色性能,格力U尊为你带来全新空调体验) 云服务器亿华云b2b信息平台香港物理机企业服务器网站建设源码库