Class: Kube::Cluster::Standard::VictoriaMetrics::VMAlert

Inherits:
Object
  • Object
show all
Defined in:
lib/kube/cluster/standard/victoria_metrics/vm_alert.rb

Overview

Evaluates VMRule recording/alerting rules (selecting all by default). Recording-rule output is written back via remote_write_url; a notifier is only needed for alerting rules, so it is optional.

Instance Method Summary collapse

Constructor Details

#initialize(name:, datasource_url:, remote_write_url:, remote_read_url: nil, notifier_url: nil, evaluation_interval: nil, select_all: true, &block) ⇒ VMAlert

Returns a new instance of VMAlert.



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/kube/cluster/standard/victoria_metrics/vm_alert.rb', line 14

def initialize(name:, datasource_url:, remote_write_url:, remote_read_url: nil,
               notifier_url: nil, evaluation_interval: nil, select_all: true, &block)
  super() {
    .name           = name
    spec.selectAllByDefault = select_all
    spec.datasource         = { url: datasource_url }
    spec.remoteWrite        = { url: remote_write_url }
    spec.remoteRead         = { url: remote_read_url }      if remote_read_url
    spec.notifiers          = [{ url: notifier_url }]       if notifier_url
    spec.evaluationInterval = evaluation_interval           if evaluation_interval
    instance_exec(&block) if block
  }
end