此儲存庫包含干擾素 gem。這個 gem 讓您能以程式碼的形式儲存您的警報設定。您應該建立自己的儲存庫,並使用一個匯入干擾素 gem 的 Gemfile
。如需此類儲存庫的範例,以及範例設定和警報檔案,請參閱 https://www.github.com/airbnb/alerts_example
這個 gem 提供一個單一可執行檔,稱為 interferon
。
您應該像這樣調用它
$ bundle exec interferon --config /path/to/config_file
其他選項
-h
, --help
-- 列印使用資訊-n
, --dry-run
-- 執行 interferon,但不對警報目的地進行任何變更設定檔以 YAML 格式撰寫。
它接受以下參數
verbose_logging
-- 是否列印更多輸出alerts_repo_path
-- 您的警報儲存庫的位置,包含您的 interferon DSL 檔案group_sources
-- 一個可以回傳要警報的人員群組的來源列表host_sources
-- 一個可以讀取庫存系統並回傳要監控的主機列表的來源列表destinations
-- 一個警報提供者的列表,它可以監控指標並根據您的警報 dsl 檔案中指定的內容發送警報如需更多資訊,請參閱此儲存庫中的 config.example.yaml 檔案。
這個儲存庫知道四種物件
主機來源
Datadog
目前 Datadog 是我們唯一的警報目的地。Datadog 的警報語法規則在此: http://docs.datadoghq.com/api/#alerts 這是一張說明 datadog 指標語法的圖表 (透過 asciiflow 產生)
+---------+ alert condition +-------------------------------------------------+
| |
| +-----+ metric to alert on |
| | |
| | tags to slice the metric by +------+ |
| | | |
v v v v
|----------| |-------------------------||--------------------------| |---|
max(last_5m):avg:haproxy_count_by_status{role:<%= role %>,status:up} by {host} > 0
^ ^ ^ ^
| | | |
| | +----|------------------------------+ |
| | | math on the metric over all tags | |
| | |-----------------------------------| +------------------------------------+
| | | * max, min, avg, sum | |trigger a separate alert for each |
| + +-----------------------------------+ |different value of these tags the |
| +----|----------------------------------------------+ |entire `by {}` clause can be ommited|
| | the interval to look at; always starts with last_ | +------------------------------------+
| |---------------------------------------------------|
| | * 5m, 10m, 15m, 30m |
| | * 1h, 2h, 4h |
+ +---------------------------------------------------+
+-------------------------------------------------------------------------------------------------+
| metric condition, can be one of: |
|-------------------------------------------------------------------------------------------------|
| * max: the metric gets this high at least once during the interval |
| * avg: the metric is this on average during the interval |
| * min: the metric is this small at least once during the interval |
| * change: the metric changes this much between a value N minutes ago and now (raw difference). |
| * pct_change: the metric changes this much between a value N minutes ago and now (percentage). |
+-------------------------------------------------------------------------------------------------+
群組
群組實際上來自 group_sources。我們目前只有一個群組來源,它可以從檔案系統讀取 YAML 檔案中的群組。但是,我們希望新增額外的群組來源,例如基於 LDAP 的來源。