自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

監(jiān)控系統(tǒng)自監(jiān)控怎么做?

安全 應(yīng)用安全
net 和 procnum 這兩個插件配合,理論上一定可以發(fā)現(xiàn)進(jìn)程掛掉的情況,如此一來,嚴(yán)重的情況 catpaw 就可以發(fā)現(xiàn)了,不嚴(yán)重的情況,監(jiān)控系統(tǒng)自身的指標(biāo)就可以發(fā)現(xià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)該怎么做。

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

首先,監(jiān)控系統(tǒng)自身是會暴露監(jiān)控指標(biāo)的,比如 Prometheus、VictoriaMetrics、Nightingale,都通過 /metrics 接口暴露了自身的監(jiān)控指標(biāo),這些指標(biāo)通過監(jiān)控系統(tǒng)自身的采集機(jī)制去采集就好,相關(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)控這類嚴(yán)重情況了。而且,告警通道盡量也不要復(fù)用之前的通道,因為通道可能也會故障。

我的建議是采用 catpaw + FlashDuty 來搞這個需求。FlashDuty 是外網(wǎng)的 SaaS 服務(wù),只要公網(wǎng)出口是好的,就能提供監(jiān)控服務(wù),而且無需我們維護(hù),使用免費(fèi)套餐都夠用,畢竟監(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(進(jìn)程數(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)控端口存活,可以使用進(jìn)程數(shù)量監(jiān)控,即 procnum 插件,相關(guān)配置樣例如下:

[[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 = "進(jìn)程存活檢測(進(jìn)程數(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)進(jìn)程掛掉的情況,如此一來,嚴(yán)重的情況 catpaw 就可以發(fā)現(xiàn)了,不嚴(yán)重的情況,監(jiān)控系統(tǒng)自身的指標(biāo)就可以發(fā)現(xiàn)了,齊活。

責(zé)任編輯:武曉燕 來源: SRETalk
相關(guān)推薦

2024-03-14 11:48:44

系統(tǒng)監(jiān)控指標(biāo)分布式

2010-05-26 12:57:59

linux 系統(tǒng)監(jiān)控

2019-10-22 08:47:32

HTTP監(jiān)控系統(tǒng)

2020-09-21 06:45:48

監(jiān)控延遲消息隊列

2022-03-10 11:25:51

InnoDB優(yōu)化

2023-09-27 22:44:18

數(shù)據(jù)遷移數(shù)據(jù)庫

2024-05-06 08:31:28

前端監(jiān)控JavaScript

2024-10-06 13:01:44

2020-12-30 08:09:46

運(yùn)維Prometheus 監(jiān)控

2022-08-29 08:08:58

SQLOracleCPU

2021-08-10 09:17:02

動環(huán)監(jiān)控機(jī)房監(jiān)控數(shù)據(jù)中心

2016-09-21 10:18:26

阿里Dubbo性能測試

2013-09-26 21:50:11

RIILIT綜合監(jiān)控

2018-09-17 08:36:59

機(jī)房監(jiān)控配電

2022-01-05 08:29:22

監(jiān)控Prometheus Post

2019-10-09 10:06:48

容器監(jiān)控軟件

2020-12-29 10:45:22

運(yùn)維Prometheus-監(jiān)控

2012-05-24 14:58:55

開源代碼

2020-07-28 08:36:54

數(shù)據(jù)安全數(shù)據(jù)泄露數(shù)據(jù)

2015-10-19 10:30:44

物聯(lián)網(wǎng)營銷
點贊
收藏

51CTO技術(shù)棧公眾號