Skip to content
Prev Previous commit
Next Next commit
Move alerts to sep file
  • Loading branch information
v-zhuravlev committed Nov 16, 2023
commit 1d1dda995cb325657dfe79014222a9b5f9756ab8
23 changes: 23 additions & 0 deletions docs/macos-observ-lib/alerts.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
new(this, parentPrometheus):
{
groups:
//keep only alerts listed in alertsMacKeep
std.filter(
function(group) std.length(group.rules) > 0,
[
{
name: group.name,
rules: [
rule
for rule in group.rules
if std.length(std.find(rule.alert, this.config.alertsMacKeep)) > 0
],
}
for group in parentPrometheus.alerts.groups
],

),

},
}
19 changes: 2 additions & 17 deletions docs/macos-observ-lib/main.libsonnet
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
local alerts = import './alerts.libsonnet';
local config = import './config.libsonnet';
local g = import './g.libsonnet';
local panels = import './panels.libsonnet';
Expand Down Expand Up @@ -48,23 +49,7 @@ nodelib
},
prometheus+: {
recordingRules: {},
alerts:
{
groups:
[
{
name: group.name,
rules: [
rule
for rule in group.rules
if std.length(std.find(rule.alert, this.config.alertsMacKeep)) > 0
],
}
for group in parentPrometheus.alerts.groups
],

},

alerts: alerts.new(this, parentPrometheus),
},
},

Expand Down