日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
監(jiān)控系統(tǒng)自監(jiān)控怎么做?

問題

監(jiān)控系統(tǒng)用于監(jiān)控其他的系統(tǒng)、基礎(chǔ)設(shè)施,絕對是 P0 級的服務(wù),那監(jiān)控系統(tǒng)的自監(jiān)控應(yīng)該怎么做呢?如果自己監(jiān)控自己,有些組件掛掉了難免循環(huán)依賴,如果單獨搞一套新的監(jiān)控系統(tǒng)來監(jiān)控當(dāng)前服役的監(jiān)控系統(tǒng),又搞得有些過于復(fù)雜。本文我們來探討一下監(jiān)控系統(tǒng)的自監(jiān)控應(yīng)該怎么做。

網(wǎng)站設(shè)計、成都網(wǎng)站設(shè)計的關(guān)注點不是能為您做些什么網(wǎng)站,而是怎么做網(wǎng)站,有沒有做好網(wǎng)站,給成都創(chuàng)新互聯(lián)公司一個展示的機會來證明自己,這并不會花費您太多時間,或許會給您帶來新的靈感和驚喜。面向用戶友好,注重用戶體驗,一切以用戶為中心。

解決方案:自身指標(biāo)

首先,監(jiān)控系統(tǒng)自身是會暴露監(jiān)控指標(biāo)的,比如 Prometheus、VictoriaMetrics、Nightingale,都通過 /metrics 接口暴露了自身的監(jiān)控指標(biāo),這些指標(biāo)通過監(jiān)控系統(tǒng)自身的采集機制去采集就好,相關(guān)數(shù)據(jù)的歷史趨勢圖、告警規(guī)則,也在監(jiān)控系統(tǒng)自身配置好,只要自身模塊沒有掛掉,或者沒有全部掛掉,相關(guān)數(shù)據(jù)基本都可以正常使用。

比如 Nightingale 的自身監(jiān)控指標(biāo),可以通過 categraf 的 input.prometheus 插件來采集,即 conf/input.prometheus/prometheus.toml 的內(nèi)容如下:

[[instances]]urls = [
    "http://localhost:17000/metrics"
]

localhost:17000 換成你的 Nightingale 的地址即可。然后導(dǎo)入內(nèi)置儀表盤:https://github.com/ccfos/nightingale/tree/main/integrations/n9e/dashboards,即可看到 Nightingale 自身的監(jiān)控指標(biāo)了。

解決方案:存活監(jiān)控

如果監(jiān)控系統(tǒng)同時有多個模塊故障,此時自身指標(biāo)可能都采集不到了,告警引擎可能也有故障,此時就沒法通過自身指標(biāo)來監(jiān)控了,此時就需要一個外掛的小監(jiān)控系統(tǒng)來監(jiān)控這類嚴重情況了。而且,告警通道盡量也不要復(fù)用之前的通道,因為通道可能也會故障。

我的建議是采用 catpaw + FlashDuty 來搞這個需求。FlashDuty 是外網(wǎng)的 SaaS 服務(wù),只要公網(wǎng)出口是好的,就能提供監(jiān)控服務(wù),而且無需我們維護,使用免費套餐都夠用,畢竟監(jiān)控系統(tǒng)也不會經(jīng)常掛。。。

catpaw 最新版本是 v0.7.0,已經(jīng)提供了 exec(執(zhí)行腳本的插件)、filechange(文件變化監(jiān)控的插件)、http(HTTP探測的插件)、journaltail(系統(tǒng)日志異常檢測插件)、mtime(遞歸判斷文件變化的插件)、net(TCP、UDP探測的插件)、ping(PING插件)、procnum(進程數(shù)量監(jiān)控插件)、sfilter(自定義腳本插件,相比exec插件更簡單,匹配腳本輸出) 等多個監(jiān)控插件,我們可以使用 net 插件來探測監(jiān)控系統(tǒng)的各個組件的存活情況,比如下面是 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"

如果目標(biāo) IP:Port 連不上了,就會報警,報警事件的具體推送策略在 [instances.alerting] 配置段配置。

如果監(jiān)控系統(tǒng)的某個模塊,不監(jiān)聽端口,沒法監(jiān)控端口存活,可以使用進程數(shù)量監(jiān)控,即 procnum 插件,相關(guān)配置樣例如下:

[[instances]]# # executable name (ie, pgrep )
# search_exec_substring = ""

# # pattern as argument for pgrep (ie, pgrep -f )
search_cmdline_substring = ""

# # windows service name
# search_win_service = ""

alert_if_num_lt = 1
check = "進程存活檢測(進程數(shù)量檢測)"
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 這兩個插件配合,理論上一定可以發(fā)現(xiàn)進程掛掉的情況,如此一來,嚴重的情況 catpaw 就可以發(fā)現(xiàn)了,不嚴重的情況,監(jiān)控系統(tǒng)自身的指標(biāo)就可以發(fā)現(xiàn)了,齊活。


名稱欄目:監(jiān)控系統(tǒng)自監(jiān)控怎么做?
轉(zhuǎn)載來于:http://www.dlmjj.cn/article/dpgdoid.html